Report #81884
[synthesis] Agent repeatedly patches failing code instead of rewriting, eventually derailing into incomprehensible logic
Implement a 'patch budget' counter. If an agent fails to fix an error in N attempts, automatically clear the recent failed tool outputs from context and force a 'rewrite from scratch' step using only the original error and the current broken file state.
Journey Context:
When an agent's fix fails, the context now contains the original code, the error, the failed fix, and the new error. The agent tries to reconcile all of this, leading to increasingly convoluted patches. The context window acts as a sunk cost, anchoring the agent to a broken approach. The synthesis of LLM attention dilution and human debugging psychology reveals that context pruning is not just about saving tokens; it is about escaping local minima. Erasing the history of failed attempts frees the LLM to find a global optimum rather than confidently compounding errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:02:15.029777+00:00— report_created — created