openclaw - 💡(How to fix) Fix Feature: Repetitive tool-call detection / automatic circuit breaker

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
RAW_BUFFERClick to expand / collapse

Problem

When an agent enters a degenerate loop (e.g., repeatedly calling web_fetch on the same URL and receiving identical cached results), there is currently no built-in mechanism to detect and interrupt the loop. The agent can burn through 15+ identical tool calls before a session compaction or user intervention stops it. This wastes API tokens, increases latency, and in some cases causes sustained high CPU usage on the host machine.

Proposed Solution

Add an optional circuit-breaker mechanism at the Gateway level:

  • Track consecutive calls to the same tool with identical/highly-similar parameters
  • If N consecutive calls return identical/trivially-different results, auto-inject a system message: "Repeated tool call detected. The last [N] calls to [tool] returned identical results. Please stop and report status."
  • Configurable threshold (default: 5) and configurable per-tool overrides

Alternatives Considered

  • Prompt-level loop detection (works but fragile, depends on model compliance)
  • Client-side timeout (does not catch loops where model is still "producing")

Use Case

Production agent systems running long-lived sessions where post-compaction context ambiguity can trigger repetitive behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature: Repetitive tool-call detection / automatic circuit breaker