Skip to content

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

@Urberliner

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

    No labels
    No labels

    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