Skip to content

fix: escape {{template variables}} in assemble to prevent DSH prompt interpolation errors - #75

Open
Liyuk wants to merge 1 commit into
adoresever:mainfrom
Liyuk:fix/escape-prompt-variables
Open

fix: escape {{template variables}} in assemble to prevent DSH prompt interpolation errors#75
Liyuk wants to merge 1 commit into
adoresever:mainfrom
Liyuk:fix/escape-prompt-variables

Conversation

@Liyuk

@Liyuk Liyuk commented Aug 18, 2026

Copy link
Copy Markdown

Problem

Node content may contain {{unsubscribe_url}} or similar template syntax (e.g. from Buttondown email templates). When graph-memory recalls these nodes and injects them into the graph-memory:recall context, DSH's prompt template system scans for {{variable}} patterns and throws:

unknown prompt variable "{{unsubscribe_url}}" in context "graph-memory:recall"

This affects any node whose content happens to contain double-curly-brace syntax.

Fix

Escape {{ and }} as HTML entities ({{ / }}) in the escapeXml function in assemble.ts. This prevents DSH's interpolation from interpreting them as template variables.

  • Only paired braces ({{ / }}) are escaped — single { or } are preserved for CSS/JSON compatibility
  • All content passing through escapeXml (node body, description, edge conditions, episodic messages) is protected

Example

Before: {{unsubscribe_url}} → DSH tries to resolve → throws error
After: {{unsubscribe_url}} → passes through literally ✅

…interpolation errors

Node content may contain {{unsubscribe_url}} or similar template syntax
(e.g. from Buttondown email templates). DSH's prompt template system
scans injected contexts for {{variable}} patterns and throws when
encountering unregistered ones.

Escape {{ and }} as HTML entities in escapeXml so they pass through
DSH's interpolation untouched. Only paired braces are escaped; single
{ or } are preserved for CSS/JSON compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant