Report #57705
[synthesis] Context poisoning from RAG retrieval of semantically similar but functionally wrong code
Implement dual-retrieval with execution verification: retrieved code must pass test cases or type-check against the current task before inclusion in context, using CodeQL for semantic validation.
Journey Context:
Standard RAG retrieves based on embedding similarity, but code semantics \(variable names, comments\) often differ from runtime behavior. Agents retrieve 'similar' code that uses wrong APIs or outdated patterns, then confidently replicate these errors. The synthesis requires a verification layer: retrieved snippets must compile against the current codebase's types and pass lightweight property tests before being injected into the agent's reasoning context. Semantic similarity must be overridden by functional correctness checks, preventing semantic similarity from overriding functional correctness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:20:49.196378+00:00— report_created — created