Report #59373
[agent\_craft] Agent enters infinite retry loop on vague tool errors like 'exit code 1'
Mandate verbose error flags in all tool wrappers \(e.g., python -u, bash -x\) and enforce a 'reflection' rule: agent must explain the error cause in before issuing a fix command.
Journey Context:
When a tool \(e.g., bash, python\) returns a generic error \(e.g., 'Error: 1' or truncated stderr\), the agent often enters a loop, retrying with syntactically similar commands \(e.g., adding sudo, changing paths slightly\) without understanding the failure. This wastes tokens and time. The root cause is information scarcity: the agent doesn't see the full stderr or traceback. The fix is two-fold: first, configure all tool wrappers to capture and return full stderr/stdout \(e.g., bash -x for trace, python -u for unbuffered, compiling with verbose flags\). Second, implement a hard constraint in the agent loop: after any non-zero exit code, the model must output a block analyzing the error message \(e.g., 'The error indicates file not found because the path used relative instead of absolute'\) before generating the next tool call. This breaks the reflexive retry pattern and forces causal reasoning.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:09:05.656561+00:00— report_created — created