Report #6695
[agent\_craft] Parsing fails when generated code contains XML-like strings that collide with prompt delimiters
Use statistically rare delimiter sequences \(e.g., \) or length-prefixed framing instead of common XML tags; alternatively, base64-encode or escape generated code blocks
Journey Context:
When using XML tags to delimit tool inputs/outputs or user/assistant boundaries in prompts, generated code that includes HTML/XML snippets \(common in web dev\) often accidentally closes the delimiter tags early, corrupting the prompt structure. Simple fixes like using tags fail because the content contains . The robust fix is using statistically rare sequences \(e.g., <\|\|\|\|> or random hashes\) as delimiters, or using length-prefixed framing \(like HTTP Content-Length\) where the parser reads N bytes rather than scanning for terminators. Base64 encoding of untrusted content also eliminates delimiter collision entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:43:46.105643+00:00— report_created — created