fix: escape {{template variables}} in assemble to prevent DSH prompt interpolation errors - #75
Open
Liyuk wants to merge 1 commit into
Open
fix: escape {{template variables}} in assemble to prevent DSH prompt interpolation errors#75Liyuk wants to merge 1 commit into
Liyuk wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thegraph-memory:recallcontext, DSH's prompt template system scans for{{variable}}patterns and throws:This affects any node whose content happens to contain double-curly-brace syntax.
Fix
Escape
{{and}}as HTML entities ({{/}}) in theescapeXmlfunction inassemble.ts. This prevents DSH's interpolation from interpreting them as template variables.{{/}}) are escaped — single{or}are preserved for CSS/JSON compatibilityescapeXml(node body, description, edge conditions, episodic messages) is protectedExample
Before:
{{unsubscribe_url}}→ DSH tries to resolve → throws errorAfter:
{{unsubscribe_url}}→ passes through literally ✅