Report #2673
[gotcha] Agent repeats the same MCP tool call with the same arguments until recursion limit kills the run
Add loop-detection middleware: maintain a sliding window hash of \(tool\_name, arguments\), warn the model after N identical repeats, and hard-stop by stripping tool\_calls after M repeats. Treat recursion\_limit as a crash guard, not a control mechanism.
Journey Context:
A plain ReAct loop has no memory of what it just called, so the model can get stuck calling bash with the exact same command or re-fetching the same resource. The recursion limit only terminates the run with an error; it does not break the loop gracefully. Loop detection converts infinite retries into bounded degradation: the agent returns whatever partial results it has instead of crashing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T13:33:49.892030+00:00— report_created — created