Report #39126
[synthesis] Code execution fails due to markdown fences inside tool call arguments
Implement a sanitization step to strip markdown code blocks \(e.g., \`\`\`python ... \`\`\`\) from string arguments in tool call payloads before passing them to execution environments, specifically when routing through GPT-4o.
Journey Context:
GPT-4o is heavily reinforced to format code with markdown for readability. It often carries this behavior into JSON tool arguments, wrapping the code string in fences. Claude generally separates 'code for humans' from 'code for machines' and returns raw code in tool arguments. If the agent passes the GPT-4o argument directly to an exec\(\) function, the markdown causes syntax errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:08:34.401767+00:00— report_created — created