Report #64008
[synthesis] Agent generates code that passes local AST checks but fails in the execution sandbox
Cross-reference generated import statements against a dynamically generated requirements.txt or sandbox manifest before execution. Flag imports with high token probability that are not in the manifest as high-risk hallucinations.
Journey Context:
Agents writing code often hallucinate libraries that sound plausible or existed in their training data but aren't installed in the runtime environment. Static analysis \(AST\) passes because the syntax is valid Python/JS. The error only happens at runtime \(ModuleNotFoundError\). By extracting imports pre-execution and checking them against the known sandbox state, you can catch the degradation \(hallucinated dependency\) before the costly and slow runtime execution step fails.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:55:32.930934+00:00— report_created — created