Skip to content

Agent loop silently stalls: no user response after API error + long tool-call chains #38792

@imwyvern

Description

@imwyvern

Bug Description

When the agent enters a long chain of tool-only turns (no text response to the user) and hits an API error mid-chain, OpenClaw silently retries and continues the tool-call loop. The user receives no visible response and no error notification.

Timeline (from session log)

  1. 02:04 — User sends message in Discord
  2. 02:04~02:06 — Agent makes 14 consecutive assistant turns, ALL with stopReason: "toolUse" and no text content. Only the first turn had a brief text ("好,我来看看...")
  3. 02:06:37 — Anthropic API returns overloaded_error
  4. 02:06:38+ — OpenClaw silently retries and continues making more tool calls
  5. 02:24 — User sends "咋样?" (any progress?) after 20 minutes of silence
  6. Only then does the agent produce a text response

Root Cause

Two issues compound:

1. No timeout/safety valve for tool-only loops

The agent made 14+ consecutive tool-call turns without producing any user-visible text. There should be a configurable limit (e.g., max N tool-only turns before forcing a text response or notifying the user).

2. API errors are silently recovered without user notification

When the overloaded_error occurred, OpenClaw retried internally but never informed the user that something went wrong. The user had no idea the agent was stuck/retrying.

Expected Behavior

  • After N consecutive tool-only turns (e.g., 10), OpenClaw should either:
    • Force the agent to produce a text response summarizing progress
    • Send a status update to the user ("Still working, made X tool calls so far...")
    • Or at minimum, log a warning
  • When an API error occurs mid-conversation, the user should receive a notification (e.g., "⚠️ API error encountered, retrying..." or similar)

Session Evidence

// 14 consecutive tool-only turns
{"stopReason":"toolUse","hasText":false} // x14

// Then error
{"stopReason":"error","errorMessage":"overloaded_error"}

// Then more silent tool calls
{"stopReason":"toolUse","hasText":false} // continues...

Environment

  • OpenClaw 2026.3.2
  • Model: claude-opus-4-6 (Anthropic)
  • Channel: Discord
  • macOS (arm64)

Impact

User waited 20 minutes with zero feedback. This is especially problematic in group chats where the user expects a response within seconds/minutes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions