Flow20

OpenClaw streamidletimeout: how to stop stalled runs

OpenClaw stream_idle_timeout

OpenClaw stream_idle_timeout: how to stop stalled runs

An OpenClaw stream_idle_timeout error means your model stream stopped delivering data long enough for a component to end the request. A missing cancellation deadline can also leave an ACP session stuck, so you need bounded execution and reliable cleanup, not repeated attempts.

The message, “The model stopped responding. Please try again.”, doesn’t identify whether the provider, network or runtime caused the silence. Start by separating a stalled stream from a slow agent loop.

Key takeaways

A connected socket doesn’t prove your model is responding. Idle timeouts, overall execution limits and retry policies handle different problems.

For the ACP failure described in issue #17258, the practical protection is an abort signal that reaches runTurn(), followed by cleanup that releases the session queue. Before sending another request, establish whether any tool action already completed.

Why OpenClaw stream_idle_timeout happens

A technical illustration titled 'Silent Stream' showing a server and a client connected by a line.

An open connection can stop carrying events

The stalled-session issue report describes an Anthropic SSE stream that stopped producing events whilst its TCP connection remained open. An open connection doesn’t prove that streaming is active.

The reporter used lsof to identify an established connection to 160.79.104.10:443, with no data flowing. That address is evidence from that incident, not an endpoint you should hard-code.

This explains why connection monitoring alone can miss the problem. Your application needs to measure stream activity as well.

One stalled turn can block later messages

In the reported ACP runtime, runTurn() lacks an enforced deadline when the caller supplies no abort signal. Before assuming a PI timeout applies, verify whether this path uses resolveAgentTimeoutMs().

Its asynchronous for-await loop can then wait indefinitely. The session remains running, and its unresolved promise blocks subsequent messages for the same session key through KeyedAsyncQueue. The diagnostic function logSessionStuck warns about a stuck session but doesn’t recover it.

That is the reported failure mechanism, rather than proof that every release behaves identically. A successful retry in another session doesn’t demonstrate that the original queue has recovered.

Diagnose the failure before sending another request

First, distinguish slow responses from a stream that has gone silent. The HTTP status alone isn’t enough to show where progress stopped.

What you observeLikely categoryUseful evidence
Stream events stop but connection stays openStreaming inactivityTimestamp of the last SSE event
Tool starts but never finishesTool or downstream service stallTool start and completion records
HTTP 429 responseThrottling or exhausted allowanceError body and response headers
Run ends at a fixed elapsed durationExecution deadlineConfigured timeout and cancellation reason

The distinction matters because increasing an execution budget won’t repair a stream that has stopped sending events.

  1. Record the request identifier, session key, runtime path, model, last stream event and last tool event.
  2. Compare one affected session with another. A single blocked session suggests a queue problem; widespread failures suggest a shared dependency.
  3. Test the same model through an approved path without your usual proxy or integration layer.

If the direct path works, investigate buffering, dropped connections and proxy inactivity limits. If both paths stall, retain provider request identifiers for diagnosis.

If you only use the chat interface, stop the turn where that control exists and report the session identifier. Sending more messages into a blocked queue adds work without restoring service. For customer-facing B2B website chatbots, provide a human contact route whilst the session is unavailable.

Put a deadline around the affected runtime

An illustration with the headline Set A Timeout, a central blue timer ring, and data stream elements.

Separate PI protection from ACP protection

The issue contrasts ACP with pi-embedded-runner/run/attempt.ts, where setTimeout calls abortRun(true) at params.timeoutMs.

It also describes PR #21555’s 90-second streaming inactivity watchdog for the embedded PI runner, without equivalent coverage for the reported ACP path.

The setting agents.defaults.timeoutSeconds, read through resolveAgentTimeoutMs(), is described as feeding PI rather than that ACP implementation. Trace the resolved value into the actual runtime before relying on it. OpenClaw’s agent-loop timeout documentation distinguishes per-model-attempt budgets from provider idle protection.

For example, {"agents":{"defaults":{"timeoutSeconds":300}}} expresses a five-minute attempt budget. It isn’t a universal five-minute stream inactivity setting.

Pass cancellation through your caller

For code you control, wrap the operation in an abort deadline:

async function withDeadline(start, callerSignal, timeoutMs = 30_000) {
  const controller = new AbortController();
  const timer = setTimeout(
    () => controller.abort(),
    Math.max(30_000, timeoutMs)
  );
  const signal = callerSignal
    ? AbortSignal.any([callerSignal, controller.signal])
    : controller.signal;


  try {
    return await start(signal);
  } finally {
    clearTimeout(timer);
  }
}

Pass the resulting signal into your actual runTurn() call. The callback avoids assuming a particular ACP argument shape.

The issue’s proposed runtime fix supplies a fallback timeout when no signal is passed, with a minimum of 30,000 milliseconds. This wrapper also preserves caller cancellation.

Cancellation must reach the underlying operation. A timer that merely rejects an outer promise can leave the original turn running and its queue blocked.

Retry transient failures without repeating completed work

Use bounded backoff after cleanup

Retry only after the failed turn has ended and released its resources. Otherwise, your replacement request can sit behind the original stuck session.

A reasonable integration policy allows three retries, using exponential backoff with delays of one, two and four seconds. Add random jitter so workers don’t retry together, and honour a valid Retry-After header first.

The performance-guide examples use maxRetries: 3, backoff: 'exponential' and retryableErrors containing rate_limit, timeout and network. These are integration-policy examples, not established native OpenClaw configuration syntax.

Classify stream_idle_timeout explicitly before submitting another request. Also account for SDK retries, which can multiply your intended attempt count.

Protect writes and shared allowances

A timeout doesn’t prove that a tool action failed. Before repeating a write, read the current account state. Use supported idempotency controls and retain one identifier linking the approved action to its result.

This matters when an agent changes Google Ads or Facebook Ads accounts. Repeating an accepted change can create another problem.

For HTTP 429 responses, distinguish temporary throttling from exhausted credits. Stop automatic retries when billing action is required. Workers sharing credentials also need a shared limiter, because adding workers doesn’t create additional provider capacity.

Reduce slow agent loops without masking a stall

Set budgets around the task

Claw Mart’s performance guide suggests maxToolCalls: 8 and maxDuration: 45000, alongside maxTokens, costLimit and an onLimitReached callback.

Treat these as framework-specific budget examples, not a configuration block to paste into OpenClaw. The callback should stop dispatching work and preserve unfinished tasks.

A 45-second total budget may suit a narrow task but interrupt a longer research job. For each agent loop, set budget limits around expected task work, then measure completion rates.

For PPC account changes, put execution behind approved tools with restricted accounts and fields. Keep SEO research tools read-only unless a separate publishing action is authorised. Our guide to digital marketing automation covers the wider operational context.

Keep tools and context relevant

Each agent-loop iteration requires at least one LLM call, plus any tool calls. A search followed by three separate page visits can involve roughly eight sequential round trips, with LLM calls and tool calls in the sequence.

Loaded tool schemas add input and selection overhead to the context window. Include only the tools your task needs, and combine predictable operations in a controlled custom tool where appropriate.

The guide’s contextManagement: 'auto-summarize' example separates retention for userPreferences, toolResults and conversationHistory. OpenClaw’s documented approach uses compaction controls to reduce the context window when accumulated history or tool results no longer help the task. Don’t assume those example names transfer directly.

Enabling stream: true shows output earlier without reducing total runtime. Claw Mart attributes about 70% of slow-response complaints to presentation, but that claim doesn’t establish protection against stalled streams.

Log recovery as well as failure

Use logging to record request start, first stream event, last stream event, tool start and completion, abort, and final cleanup. Include the runtime path, cancellation reason, and identifiable start and completion events for any custom tool.

This lets you distinguish slow first output, a silent model stream and a blocked tool. More importantly, it shows whether cancellation actually released the session.

Claw Mart’s debugging examples use logging: { level: 'detailed', onEvent }, agent.saveState() and claw.replayFromState(). Treat those as integration-specific interfaces rather than assumed OpenClaw commands.

When your integration supports saved-state replay, disable live writes during diagnosis. A replay shouldn’t resend messages, publish content or change an advertising account.

Keep credentials and unnecessary customer data out of logs. Your diagnostic record needs operational evidence, not a complete CRM export.

Frequently asked questions

How many seconds of silence trigger stream_idle_timeout?

There isn’t one threshold established by the error payload. The reported PI watchdog uses 90 seconds, whilst a provider client, proxy or integration can enforce another limit.

Record which component emitted the error. The message alone doesn’t prove that OpenClaw’s PI watchdog fired.

Will increasing timeoutSeconds fix a stuck ACP session?

It won’t address the reported ACP failure if that runtime path doesn’t consume the setting. You need cancellation passed into the affected operation.

Increasing an overall execution budget can also increase your wait without restoring stream activity. Separate the idle threshold from the maximum permitted run duration.

Is stream_idle_timeout the same as a rate limit?

No. It describes missing stream activity. HTTP 429 describes throttling or an allowance problem, although the response body determines which.

Both can justify retries in some circumstances, but they need different diagnosis. Neither justifies repeatedly submitting an action that might already have completed.

Make recovery part of your workflow

Your OpenClaw stream_idle_timeout fix should end the stalled operation, release its session and preserve enough evidence for diagnosis and error recovery. Further attempts are useful only after those controls work.

Start with the affected runtime, then add bounded cancellation, safe retries and task budgets. That gives you a recovery process instead of another request waiting behind the first.

If you need help connecting AI workflows to measurable business results, speak to us about Digital marketing.

Shirish Agarwal

Shirish Agarwal

Shirish Agarwal leads Flow20 and has been featured as one of the Top 30 Digital Marketing Influencers of 2019 alongside Neil Patel and Rand Fishkin. His new book Gen Z to Gen Zero, which discusses the impact of AI on the job marketplace, is now out and available on Amazon.

0Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Ad Rank in Google and AI Search