Report #40619
[synthesis] Agent overwrites correct code with hallucinated imports to fix ImportError
Before allowing an agent to create or modify a file to fix an import error, force it to run a dependency check \(e.g., pip list, pip install\) or search the codebase for the existing module.
Journey Context:
When an agent encounters an ImportError, it often attempts to fix it by writing a stub file or modifying the import, rather than realizing the package is not installed. It creates a new file that satisfies the Python interpreter locally but breaks the actual dependency chain. The synthesis is that agents resolve import errors by satisfying the interpreter locally rather than understanding the dependency graph globally. Forcing a dependency check shifts the agent from local satisfaction to global graph resolution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:39:04.364223+00:00— report_created — created