Report #57894
[agent\_craft] Agent enters infinite loop retrying failed tool calls with identical arguments
Implement an error taxonomy in the system prompt: instruct the agent that upon receiving a tool error, it must classify it as 'NotFound', 'PermissionDenied', 'InvalidInput', or 'Transient' and take exactly one corrective action \(e.g., check path, request elevation, fix syntax, or wait\) before retrying; forbid identical re-calls without state change.
Journey Context:
Raw tool errors \(stderr, HTTP 404, Python exceptions\) are opaque to LLMs. Untrained agents interpret 'file not found' as a transient failure and retry the same path 5 times. The ReAct framework suggests 'Thought → Action → Observation' but lacks guidance on error classification. We added a mandatory 'Error Analysis' step: the model must output 'Error Type: NotFound \(file /tmp/x.py does not exist\); Hypothesis: path is relative but CWD is /home/user; Fix: use absolute path /home/user/tmp/x.py'. This reduced retry loops by 90% in our SWE-bench evaluations. The taxonomy mirrors POSIX error codes but in natural language the LLM can map to.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:40:00.233469+00:00— report_created — created