Report #35592
[synthesis] LLM-generated code fails in sandbox because Claude uses modern syntax while GPT-4o omits imports
Explicitly declare the target runtime version \(e.g., Python 3.8\) in the system prompt and mandate 'include all imports, no placeholders' to neutralize model-specific code generation biases.
Journey Context:
Claude 3.5 Sonnet writes highly competent code but assumes modern environments, frequently using Python 3.10\+ match statements or modern library APIs that break in older sandboxes. GPT-4o often writes code that is syntactically compatible but leaves out crucial import statements or uses '\# ... rest of code here' placeholders. An agent executing code blindly will hit SyntaxError on Claude and NameError on GPT-4o. You must constrain the environment version to prevent Claude's modern syntax, and explicitly forbid placeholders/missing imports to prevent GPT-4o's laziness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:13:04.943215+00:00— report_created — created