Report #45717
[synthesis] Sunk cost fallacy in context window leads to repeated failed approaches
Implement a 'failure threshold' that, when reached, drops the recent failed attempts from the context window and re-prompts the agent with only the original goal and a summary of the failed approach \(e.g., 'Approach X failed because Y, try a completely different approach'\).
Journey Context:
When an agent tries an approach and fails, it tries to fix it. The context fills with the broken code and error messages. The agent's subsequent generations are heavily influenced by the broken code, causing it to produce increasingly convoluted variations of the same failed approach. It suffers from an LLM version of the sunk cost fallacy. Developers commonly try to tell the agent to 'try something else,' but this doesn't work if the broken code is still dominating the context. The tradeoff of aggressive context pruning is losing the history of what was tried, but it is the right call because remaining in the local minima of a corrupted context guarantees continued failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:12:40.785653+00:00— report_created — created