openclaw - 💡(How to fix) Fix [Bug]: session_status tool-call loop not hard-aborted — agent repeats 30+ identical calls despite loop detector warnings [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#73763Fetched 2026-04-29 06:15:24
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Timeline (top)
commented ×1

Error Message

  • #58726 — "Loop detector should hard-abort agent after N identical tool calls, not just warn" (OPEN, same root cause, requests configurable hard-abort threshold)

Root Cause

  • #58726 — "Loop detector should hard-abort agent after N identical tool calls, not just warn" (OPEN, same root cause, requests configurable hard-abort threshold)
  • #71615 — "tool-heavy main sessions can jump from low context to near-full within 1-2 replay turns" (CLOSED in 2026.4.26, related context pressure that may increase loop likelihood)
  • #40144 — "scope tool-loop detection history to the active run" (fixed in 2026.4.26, scoping fix only, not hard-abort)
  • #34574 — "ignore volatile exec metadata when comparing tool-loop outcomes" (fixed in 2026.4.26, exec-specific)

Fix Action

Workaround

Using openclaw status --json and openclaw cron list --json via the exec tool instead of calling session_status directly. This bypasses the tool-call loop entirely.

RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw: 2026.4.26 (be8c246)
  • OS: Linux 6.8.0-107-generic (x64)
  • Node: v22.22.1
  • Model: claude-opus-4.6 (via custom provider)
  • Session type: human-facing agent:main:main (Telegram direct)

Bug summary

When the agent calls session_status as part of assembling a status dashboard, it enters an infinite loop — calling session_status with identical (empty) arguments 30+ times. The built-in loop detector fires warnings at 10/20/30 but never hard-aborts the agent run. The session gets stuck until manual intervention.

This has happened at least twice on our instance (April 21 and April 29, 2026), both times triggered by a user request to display a status panel, which causes the agent to call session_status as part of data gathering.

Steps to reproduce

  1. Run a long-lived agent:main:main session with moderate context usage (~47%)
  2. User asks the agent to show a status dashboard
  3. Agent calls session_status with {} to gather session metadata
  4. Agent enters a degenerate loop — repeats the same session_status call indefinitely
  5. Loop detector warns at N=10, N=20, N=30 but does not stop the agent

Expected behavior

The agent run should be hard-aborted after a configurable threshold (e.g. 5 identical tool calls), not just warned.

Actual behavior

  • Loop detector prints warnings in tool results
  • Agent ignores warnings and continues calling
  • Session is stuck, blocking the queue (queueDepth=1)
  • Burns API tokens on identical calls
  • Requires manual gateway restart or session kill to recover

Workaround

Using openclaw status --json and openclaw cron list --json via the exec tool instead of calling session_status directly. This bypasses the tool-call loop entirely.

Related issues

  • #58726 — "Loop detector should hard-abort agent after N identical tool calls, not just warn" (OPEN, same root cause, requests configurable hard-abort threshold)
  • #71615 — "tool-heavy main sessions can jump from low context to near-full within 1-2 replay turns" (CLOSED in 2026.4.26, related context pressure that may increase loop likelihood)
  • #40144 — "scope tool-loop detection history to the active run" (fixed in 2026.4.26, scoping fix only, not hard-abort)
  • #34574 — "ignore volatile exec metadata when comparing tool-loop outcomes" (fixed in 2026.4.26, exec-specific)

Notes

The 2026.4.26 release includes two loop-detection improvements (#40144, #34574), but neither adds a hard-abort mechanism. The loop detector remains advisory-only — it warns but never force-stops the agent. This is the same gap described in #58726.

A hard-abort at N>5 identical calls (configurable, default 5) would prevent this class of stuck sessions entirely.

extent analysis

TL;DR

Implement a hard-abort mechanism after a configurable threshold of identical tool calls to prevent the agent from entering an infinite loop.

Guidance

  • Review the related issue #58726, which requests a configurable hard-abort threshold, to understand the desired behavior.
  • Consider using the provided workaround: replace direct session_status calls with openclaw status --json and openclaw cron list --json via the exec tool to bypass the tool-call loop.
  • Investigate the context pressure issues mentioned in #71615, as they may contribute to the likelihood of the loop occurring.
  • Verify that the loop detector warnings are being properly logged and monitored to detect potential issues before they cause sessions to become stuck.

Example

No code snippet is provided, as the issue does not contain sufficient information to create a specific example.

Notes

The 2026.4.26 release includes improvements to loop detection, but a hard-abort mechanism is still missing. Implementing this feature would require changes to the agent's behavior.

Recommendation

Apply the workaround using openclaw status --json and openclaw cron list --json via the exec tool to prevent the agent from entering an infinite loop, as a hard-abort mechanism is not currently available.

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…

FAQ

Expected behavior

The agent run should be hard-aborted after a configurable threshold (e.g. 5 identical tool calls), not just warned.

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 [Bug]: session_status tool-call loop not hard-aborted — agent repeats 30+ identical calls despite loop detector warnings [1 comments, 2 participants]