fix: reconnect past connection timeout - #1874
Merged
Merged
Conversation
isekovanic
requested review from
MartinCupela,
oliverlaz,
santhoshvai,
szuperaz and
vishalnarkhede
as code owners
September 17, 2026 09:38
MartinCupela
approved these changes
Sep 17, 2026
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.
CLA
Description of the changes, What, Why and How?
Cold starting an app with no network and staying offline for longer than
defaultWSTimeout(15s) permanently killed reconnection. Restoring connectivity after that point never brought the socket back — the UI sat on "Searching for Network" indefinitely.So,
connectUserwas tearing down its own retry loop._connect()fails, andonerror/onclosestart the_reconnect()backoff loop. That loop is what used to recover._waitForHealthytimes out and throws{"message":"initial WS connection could not be established","isWSFailure":true}, soconnectUserrejects, even though the retry loop behind it is perfectly healthy.catchranpersistUserOnConnectionFailure ? closeConnection() : disconnectUser(). Both callwsConnection.disconnect(), which setsisDisconnected = true.onlineStatusChanged('online'), and_reconnect()bails withAborting reconnect: disconnect() was called.forever.This did not bite before v10 because the two
isDisconnectedguards in_connect/_reconnectwere ANDed withoptions.enableWSFallback, which nothing ever set. Verified against a builtv9.53.0:enableWSFallbackisundefined, so both guards were dead code and the retry loop always survived the teardown. #1760 removed the WS fallback along with the option, leaving the guards unconditional and turning a previously inert cleanup into a permanent kill switch.How. On the
persistUserOnConnectionFailurepath, only close the connection when the failure is not a WebSocket failure. A terminal failure, so a rejected token, bad API key or something I can't think of still cleans up, so nothing is left retrying against a connection that cannot succeed. A network failure is left alone, becauseStableWSConnectionis still retrying and owns recovery from there.The non persist branch keeps calling
disconnectUser(), so with no user retained there is nothing to reconnect as, and the application is expected to callconnectUseragain.Changelog
connection for longer than the WebSocket connect timeout.