Report #31615
[synthesis] Agent stuck in infinite loop retrying the same failed approach
Implement a per-action retry budget of max 2 retries and distinguish between execution failures \(wrong tool input format, retry with correction\) and approach failures \(correct format, wrong strategy, replan entirely\). After 2 retries on the same approach, force a strategy change or escalate to the user.
Journey Context:
The ReAct loop \(Reason plus Act plus Observe\) is the foundation of all coding agents, but naive implementations do not distinguish failure types. If read\_file fails because the path is wrong, retrying with the corrected path makes sense. If a generated test fails because the implementation logic is wrong, re-running the test is pointless. Cursor agent mode and Claude Code both implement implicit retry budgets, visible in their behavior: they try a different approach after roughly 2 failed attempts at the same strategy. The tradeoff is that being too aggressive about switching strategies can cause the agent to abandon approaches that would have worked with one more retry. The sweet spot is 2 retries before forcing a strategy change. The key reasoning step after each observation is: did my plan fail, or did my execution of the plan fail?
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T07:27:12.574068+00:00— report_created — created