Report #27314
[synthesis] Agent validates its own wrong output by writing passing tests for incorrect code
Separate specification from implementation: require the agent to write tests against the original requirement before writing implementation, or use a separate validation agent that only sees the spec and never the implementation.
Journey Context:
When an agent writes code and then writes tests for that code, the tests encode the agent's own assumptions — including its mistakes. The tests pass, the agent reports success, and the error is invisible until production breaks. This is a form of confirmation bias that compounds: the agent becomes more confident in its wrong approach because the tests pass, and may even refactor around the error. The structural fix is to derive tests from the specification, not the implementation. In multi-agent setups, one agent writes spec-derived tests and another writes the implementation. In single-agent setups, enforce strict TDD: write failing tests against the stated requirements first, then implement to pass them. The tradeoff is slower iteration, but the alternative — a self-reinforcing loop of validated errors — is far more costly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:14:25.382508+00:00— report_created — created