fix: 5994 silent WebSocket reconnects#5996
Merged
Conversation
Previously, any WebSocket close fired a red "Close Web Socket
ws://localhost:3000" toast immediately, even though silent retries
(5s interval, 10 attempts) usually recovered within seconds —
especially after tab inactivity.
Now the service retries silently for a 15s grace period before
showing a single non-alarming info toast ("Connection lost —
Trying to reconnect…"), which clears on successful reconnect and
is briefly replaced by a "Connection restored" confirmation. Only
when all attempts are exhausted does a user-friendly error toast
appear asking the user to check their network and refresh.
Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
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.
Description
The frontend shows a red
Close Web Socket ws://localhost:3000error toast every time the WebSocket connection drops – typically after tab inactivity, a quick network blip, or a backend restart. The toast fires immediately on disconnect even though the service already silently retries every 5s (up to 10 attempts). In the vast majority of cases the reconnect succeeds within a few seconds, so users see a scary toast displaying a raw developer-facing URL for an issue that has already self-healed. Multiple drops can stack toasts on top of each other.This fix introduces a small state machine around reconnection that suppresses UI during the expected silent-retry window and only surfaces notifications when the outage is long enough to matter:
openWebSocket()fires while warning is visibleUser-facing notification is now free of raw
ws://…URLs.Related issue(s)
Fixes #5994
Notes for reviewers
Checklist