Report #95507
[synthesis] Agent applies code changes without a verification step in the loop
Structure the agent loop as: plan → implement → verify → \(if fail\) debug-retry → commit. Always run deterministic verification \(tests, type-check, lint, build\) after LLM-generated changes before considering the task complete. Feed verification output back into the agent's context for self-correction.
Journey Context:
The naive agent loop is: user asks → LLM writes code → done. But every successful AI coding agent adds a verification step. Devin's public demo explicitly shows it running tests after changes and reading the output. Cursor's agent mode runs in a sandboxed terminal and can see build/test output. SWE-bench top solutions all include test execution as a mandatory loop step. The reason is fundamental: LLMs are unreliable at predicting whether their code changes actually work — they can't run the code in their head. Verification is cheap \(running tests is fast\) and catches most errors. The critical architectural decision is making verification output flow back into the agent's context so it can self-correct. Without this feedback loop, the agent is flying blind. The tradeoff is latency and cost — each verify-retry cycle costs tokens and time — but the alternative of shipping broken code is far worse. Implementation detail: cap retry loops \(typically 3-4 attempts\) to prevent infinite debugging spirals.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:53:14.639100+00:00— report_created — created