Repository navigation
Description
Problem
The globalCircuitBreakerThreshold setting is implemented as a per-tool-type counter, not a session-level global counter. This allows agents to evade the circuit breaker by switching tools, leading to unbounded loops.
Real-world incident
- Date: 2026-05-08
- Session: feishu DM, model qwen/qwen3.5-plus
- What happened: Agent entered a loop calling
wecom_mcp→ blocked after 5 calls → switched toexec→ blocked after 5 calls → switched tomemory_search→ blocked after 5 calls → switched again... repeated across 4+ tools. - Result: ~60+ LLM calls, ~750k input tokens consumed, user had to manually
/stop - Root cause:
globalCircuitBreakerThresholdresets its counter for each tool type, so switching tools resets the count
Expected behavior
Per documentation: globalCircuitBreakerThreshold is described as "global no-progress breaker threshold". The word "global" implies it should count across all tools within a session, not per-tool-type.
Actual behavior
Each tool type has its own independent counter. Switching tools resets the count:
| Tool | Calls before block | After block |
|---|---|---|
wecom_mcp |
5 | blocked → switch to exec |
exec |
5 | blocked → switch to memory_search |
memory_search |
5 | blocked → switch to sessions_list |
| ... | ... | continues indefinitely |
Proposed fix
Track no-progress counts at the session level, not per-tool-type:
{
"tools": {
"loopDetection": {
"globalCircuitBreakerThreshold": 5 // total across ALL tools in session
}
}
}When the session-level counter reaches the threshold, block all tool calls (not just the current tool) and force the agent to produce a text response.
Workaround
Lower the threshold to 2-3 to reduce the blast radius of each tool switch, but this does not solve the fundamental issue.
Environment
- OpenClaw 2026.5.6
- Ubuntu 24.04
- Model: qwen/qwen3.5-plus
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 8, 2026
Codex review: this still needs some work.
Summary
Keep open: current main still allows stable three-tool rotations to evade critical loop detection, although bounded recovery mitigates the original block-and-switch sequence.
Reproducibility: Source establishes that three stable successful tool signatures rotating within the 30-call window stay below critical thresholds and escape the two-pattern detector; no live reproduction is claimed.
Root-cause cluster
Relationship:
canonicalCanonical: #79252
Summary: This issue remains the focused cross-tool counting report; the historical fix is unmerged and the open semantic-stagnation report covers broader behavior.
Members:
fixed_by_candidate: fix: make tool loop circuit breaker session-global #97577 - Explicitly targeted this issue with shared stable-pattern aggregation but is closed unmerged.partial_overlap: [Bug]: gpt-5.6-sol enters mixed read/exec exploration loops that evade recovery #128100 - Also concerns mixed-tool loops, including changing successful arguments and outcomes beyond stable-pattern counting.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Maintainer decision needed
Next step
Define cross-tool progress and reset rules, then establish a failing three-tool rotation regression through production admission before implementing the shared cutoff.
Review details
Best possible solution:
Extend the existing run-scoped detector with conservative cross-tool aggregation that feeds the existing bounded recovery mechanism.
Do we have a high-confidence way to reproduce the issue?
Source establishes that three stable successful tool signatures rotating within the 30-call window stay below critical thresholds and escape the two-pattern detector; no live reproduction is claimed.
Is this the best way to solve the issue?
Shared counting addresses the gap, but counting every call or requiring identical hashes across unrelated tools is insufficient; aggregate repeated patterns with explicit progress resets.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 279739bbd9e1.
Label changes
Label changes:
clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: Enabled rolling detection retains a bounded coverage gap, while current critical recovery mitigates the original repeated-block sequence.impact:other: Undetected tool rotations can waste model tokens and computation without completing the requested task.Evidence reviewed
What I checked:
src/agents/tool-loop-no-progress.ts:39, 279739bbd9e1)src/agents/tool-loop-detection.ts:56, 279739bbd9e1)src/agents/tool-loop-admission.ts:51, 279739bbd9e1)packages/agent-core/src/agent-loop.ts:537, 279739bbd9e1)docs/tools/loop-detection.md:1, 279739bbd9e1)src/agents/tool-loop-detection.test.ts:300, 279739bbd9e1)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 27, 2026, 4:31 AM ET / 08:31 UTC.
barnacle-openclaw commentedon May 31, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
34 remaining items
openclaw-barnacle commentedon Oct 28, 2026
This issue has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.
openclaw-barnacle commentedon Nov 5, 2026
Closing as not planned after the inactivity notice and full retest/update grace. This is an administrative close; the reported problem has not been confirmed fixed. Please reopen with current reproduction details if it still occurs.