Chat can silently lose the first prompt despite an open WebSocket

Author: dongwook-chanCreated Sep 27, 2026Updated Sep 27, 2026

Severity

A first chat prompt can disappear silently while CloudCLI leaves a titled session with no provider transcript. This affects the primary send flow and can cause users to believe a prompt was submitted when no provider run started.

Reproduction

  1. Open a project's New Session composer and enter a prompt.
  2. Keep the WebSocket reporting OPEN, but prevent the first chat.send frame from reaching the server (for example, intercept WebSocket.prototype.send in a browser test and return without sending that frame).
  3. Click Send.

The current client treats the return from socket.send() as delivery. It clears the input and opens the new session. The server never receives chat.send; the app row has a title but no provider session ID or transcript. We reproduced this deterministically against a running instance in Chromium. A real interrupted or half-open connection has the same observable outcome.

Root cause

WebSocket.send() queues a frame locally and returns undefined. It does not confirm that the server received or accepted the chat turn. A readyState === OPEN check or boolean return from the wrapper therefore cannot close this loss window.

Expected behavior

  • Correlate each chat.send with a client request ID and acknowledge it only after the server registers the turn.
  • Keep the composer draft until acceptance is confirmed; show a retryable error otherwise.
  • Make retries idempotent so a lost acknowledgement cannot start the same turn twice.
  • Atomically remove a newly allocated session only when the server has never accepted its first turn.
  • Cover the swallowed-frame case and the ordinary successful reply path in regression tests.

This is distinct from #1450 and #1451, which address a socket known to have closed before send() is called. The latest v1.37.3 release still sends the frame without a server receipt.