Report #39345
[synthesis] Agent generates syntactically valid code that fails at runtime due to hallucinated internal package methods
Implement a static analysis gate that extracts import statements and method calls from the generated AST, validating them against a pre-computed dependency graph of the actual repository before execution. Do not rely on model confidence scores.
Journey Context:
Developers assume that if the LLM outputs code with high logprob confidence and no syntax errors, it is likely correct. However, LLMs confidently hallucinate internal APIs because they lack the repo's full type context. Runtime failures are caught too late. AST validation against the actual codebase dependency graph catches this silent degradation immediately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:30:39.920054+00:00— report_created — created