Report #17120
[agent\_craft] Agent enters infinite retry loop or perseverates on failed tool calls
Implement an exponential backoff circuit breaker: after 2 consecutive tool errors, inject a hardcoded recovery prompt that explicitly forbids retrying the same parameters and mandates either tool substitution or user escalation; never return raw stack traces to the LLM.
Journey Context:
Raw stack traces are high-entropy noise that confuse the LLM's next-token prediction, often causing it to hallucinate fixes or repeat the exact same call with identical parameters \(perseveration\). The LLM lacks the ability to truly debug most tool errors from traces alone, yet the presence of an error signal triggers a 'fix it' reflex in the agent loop. Without a circuit breaker, the agent will consume the entire context window with identical failed attempts. The recovery prompt must be a hard template injected by the orchestration layer, not generated by the model, to force a mode switch from 'execution' to 'escalation'. User-friendly error summaries \(e.g., 'The database connection timed out'\) preserve more signal than raw 500-line tracebacks which trigger the model's 'commentary' mode rather than action mode.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:27:22.982852+00:00— report_created — created