Skip to content

Webchat: messages lost during WebSocket reconnect (no client-side queue/ACK) #45952

Description

@Urberliner

Problem

Messages sent via the Webchat UI are silently lost when the WebSocket connection drops and reconnects (code 1001 / "Going Away"). This happens when:

  • The browser tab reloads or navigates
  • The WebSocket briefly disconnects for any reason
  • The user hits Enter at the exact moment of a reconnect cycle

The gateway never receives the message, so there is nothing to drop server-side — it simply never arrives.

Evidence

Gateway logs show rapid disconnect/reconnect cycles:

2026-03-14T10:46:40.506+01:00 [ws] webchat disconnected code=1001 conn=abd60847
2026-03-14T10:46:40.750+01:00 [ws] webchat connected conn=96f826be
2026-03-14T10:46:52.316+01:00 [ws] webchat disconnected code=1001 conn=96f826be
2026-03-14T10:46:52.458+01:00 [ws] webchat connected conn=0a55022e

User-sent message during this window was lost with no error feedback.

Expected behavior

Messages should be queued client-side and only removed from the queue after server ACK. On reconnect, unACKed messages should be re-sent automatically.

Suggested fix

  1. Client-side outbound queue: Buffer messages locally before sending
  2. Server ACK: Gateway responds with an ACK per message received
  3. Retry on reconnect: After WebSocket reconnects, flush any unACKed messages from the queue
  4. UI feedback: If a message cannot be delivered after N retries, show an error indicator on that message (like messaging apps do)

Environment

  • OpenClaw Gateway on macOS (Darwin 25.3.0 arm64)
  • Webchat Control UI v2026.3.12
  • Occurs intermittently, more likely during rapid interactions or tab focus changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions