Agent kept retrying the same failing command
With no repeated-failure limit, the agent ran the same broken command again and again.
What happens
A command fails. The agent retries it unchanged, hits the same error, and loops — never escalating or changing approach.
Why it happens
The stop rule only covered success, not repeated failure, and there was no fallback telling the agent what to do when blocked.
The loop engineering fix
Define a stop rule for failure too: stop after N failed attempts on the same step.
Add a fallback: summarize the blocker, attempted fixes, and recommend a human decision.
Use a stall threshold so identical errors trigger an escalation, not another retry.