fix(client): reconnect and retry on stale connection 404#406
Open
dimakis wants to merge 1 commit into
Open
Conversation
When the SSE stream dies server-side but the client hasn't detected it yet, POST requests return 404. Previously doPost() silently swallowed these, causing the user's first message to vanish. Now a 404 re-queues the message and triggers checkAndReconnect(), so it's retried on a fresh connection. Root cause of the "two messages to wake agent" bug: the ~30s gap between server-side cleanup and client-side detection (SSE heartbeat). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
Centaur ReviewFound 5 issue(s) (3 warning).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
doPost()gets a 404 (server dropped the connection), re-queue the message and triggercheckAndReconnect()so it's retried on a fresh connectionRoot Cause
SSE stream dies server-side (timeout, cleanup, restart) but the client still has
_connected = truebecause EventSource hasn't fired an error yet (~30s heartbeat gap). User sends a message, POST returns 404,doPost()catches and ignores it. Message lost.What Changed
sse-connection.ts:doPost()now checksres.status === 404, re-queues the message, and callscheckAndReconnect(true)docs/design/delivery-guarantee-redesign.mdTest plan
🤖 Generated with Claude Code