Report #79473
[agent\_craft] Markdown code fence parsing ambiguity in tool outputs
Enforce XML tag delimiters \(e.g., \`...\`\) instead of markdown code fences \(\`\`\`language ... \`\`\`\) for all tool outputs and user-provided code snippets; explicitly prohibit the model from generating markdown inside these tags to prevent delimiter collision.
Journey Context:
Standard practice uses markdown code fences to delimit code blocks in prompts, but when the code itself contains triple backticks \(e.g., a Python f-string with a markdown template or a shell script with here-docs\), the parser \(both regex-based and LLM-based\) confuses the inner backticks with the closing delimiter. The alternative is to use custom delimiters like '\#\#\# START \#\#\#', but these lack semantic meaning. The hard-won insight is that XML tags provide unambiguous, nestable, semantically meaningful boundaries \(e.g., \`\`\). They prevent the 'delimiter collision' problem because the closing tag \`\` is unique and unlikely to appear in source code, whereas backticks are common in many languages \(Markdown, RST, shell\). This also makes parsing robust enough for automated extraction without regex ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:59:32.801580+00:00— report_created — created