openclaw - 💡(How to fix) Fix WebChat WebSocket drops (1006) during long model turns — missing keepalive pings [1 participants]

Official PRs (…)
ON THIS PAGE

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#61508Fetched 2026-04-08 02:57:49
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

The Control UI webchat WebSocket connection drops with close code 1006 (abnormal closure) during long model responses (particularly Opus). The connection dies silently — the UI shows "..." indefinitely and queues subsequent messages. Recovery requires refreshing or sending a message through another channel to reset the gateway connection.

Root Cause

The Control UI webchat WebSocket connection drops with close code 1006 (abnormal closure) during long model responses (particularly Opus). The connection dies silently — the UI shows "..." indefinitely and queues subsequent messages. Recovery requires refreshing or sending a message through another channel to reset the gateway connection.

Code Example

webchat connected  conn=xxx
webchat disconnected code=1006 reason=n/a conn=xxx   ← drops after 5-20 min
webchat connected  conn=yyy                           ← immediate reconnect
webchat disconnected code=1005 reason=n/a conn=yyy   ← bounces once
webchat connected  conn=zzz                           ← stabilizes
RAW_BUFFERClick to expand / collapse

Description

The Control UI webchat WebSocket connection drops with close code 1006 (abnormal closure) during long model responses (particularly Opus). The connection dies silently — the UI shows "..." indefinitely and queues subsequent messages. Recovery requires refreshing or sending a message through another channel to reset the gateway connection.

Logs Pattern

Repeating pattern in gateway.log:

webchat connected  conn=xxx
webchat disconnected code=1006 reason=n/a conn=xxx   ← drops after 5-20 min
webchat connected  conn=yyy                           ← immediate reconnect
webchat disconnected code=1005 reason=n/a conn=yyy   ← bounces once
webchat connected  conn=zzz                           ← stabilizes

This repeats consistently throughout the day. No explicit errors, timeouts, or crashes in gateway logs — just silent 1006 drops.

Expected Behavior

Gateway should send WebSocket ping frames during long model turns to keep the connection alive. Currently there does not appear to be a configurable keepalive/ping interval.

Environment

  • OpenClaw 2026.4.2
  • macOS 14.8.4 (arm64)
  • Mac mini M2 8GB
  • Gateway bound to loopback
  • Model: claude-opus-4-6 (long response times trigger the issue more frequently)

Reproduction

  1. Open Control UI webchat
  2. Send a message that triggers a long model response (Opus with tool calls)
  3. Wait — connection drops within 5-20 minutes with code 1006
  4. UI shows persistent "..." spinner, subsequent messages queue but never resolve

extent analysis

TL;DR

Implementing a WebSocket ping/keepalive mechanism is likely necessary to prevent the connection from dropping with code 1006 during long model responses.

Guidance

  • Investigate the OpenClaw 2026.4.2 documentation for any hidden or undocumented configuration options that may allow setting a keepalive or ping interval for WebSocket connections.
  • Consider modifying the gateway to send periodic WebSocket ping frames during long model turns to keep the connection alive, potentially using a custom implementation if no built-in option is available.
  • Review the WebSocket connection handling in the Control UI webchat to ensure it properly handles ping frames and responds accordingly to prevent silent drops.
  • Test the reproduction steps with different model configurations to confirm the issue is specific to long response times and not related to other factors.

Example

No specific code example can be provided without more information on the gateway and Control UI webchat implementation details.

Notes

The lack of explicit errors or timeouts in the gateway logs suggests the issue may be related to the WebSocket connection handling or the keepalive mechanism. The consistent repetition of the disconnection pattern points towards a specific trigger, in this case, long model responses.

Recommendation

Apply a workaround by implementing a custom WebSocket ping/keepalive mechanism, as there is no clear indication that upgrading to a different version of OpenClaw would resolve the issue, and the problem seems to be related to the specific configuration and usage of the gateway and Control UI webchat.

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