Report #61642
[synthesis] Agent makes a mistake early in a refactoring task and spends the remaining steps trying to patch the broken code rather than reverting
Implement a 'revert threshold' in the agent's logic: if more than 3 consecutive attempts to fix a compilation error fail, force a git checkout and prompt the agent to try a completely different approach.
Journey Context:
Because context windows contain the entire history of the agent's attempts, the LLM's attention is anchored to the existing broken code. It cannot unsee the broken implementation to imagine a fresh one. It suffers from the sunk cost fallacy. The synthesis is applying the psychological concept of sunk cost to the mechanical reality of autoregressive attention: the agent cannot generate a novel solution because the context window is filled with the failed solution, mathematically biasing the next token prediction towards variations of the failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:57:11.377883+00:00— report_created — created