Stopping a runaway refactoring agent loop that never converges
CCDV-F
Agents & Workflows
Medium
Question 36 of 105
An autonomous refactoring agent runs shell commands and edits files in a loop. On a repository with circular test failures it re-runs the same two commands for hours without converging.
Which control stops the runaway loop?
Show answer and explanation
DCap the loop at 40 iterations plus a token budget, and halt on a repeated tool call
Stopping conditions such as a maximum number of iterations are what hold an agent loop, and a token budget plus a check for a repeated tool signature catches this circular case specifically. A per-request max_tokens bounds one response, not the number of responses, and more container memory lets the loop run longer. A prompt rule asks the model that cannot tell it is looping to notice that it is. tool_choice auto is already the default and leaves termination to that same judgement.
Anonymous, no account needed. Your tally stays in this browser.