Repository navigation
Conversation
An abnormal close (1006) only reconnected with backoff when wasConnectedRef was set. connectToHost resets that flag, so when a reconnect attempt itself failed before connecting (the network still down right after the computer wakes), the close took the "first connection failed" branch: it showed the error and set isConnecting to false. The effect that connects a visible tab then called connectToHost again on the next frame, which failed at once again, many times a second until the network came back, each time adding "Connection closed unexpectedly" to the connection log. A failed attempt during a reconnect (reconnectAttempts > 0) now goes on with attemptReconnection's backoff. A tab's first connection that fails stops at the error like a rejected connection or an expired login does, so the effect does not retry it on the next frame; the error screen offers Reconnect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
AI review | Looks safe to merge The PR fixes a frontend logic bug where a terminal tab floods the connection log with warnings when a reconnect attempt fails before establishing a connection. The change adjusts the reconnect condition and sets a flag to stop immediate retries, accompanied by a targeted test and a compliant CHANGELOG entry. No security or stability risks found. Reviewed 9e3f5bb. AI can be wrong, a maintainer still decides. Comment |
# Conflicts: # CHANGELOG.md
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.
Problem
Right after the computer wakes, a terminal tab whose connection dropped fills its connection log with "Connection closed unexpectedly. This may be due to a reverse proxy or SSL configuration issue. Please check server logs." In one tab I counted 134 of them within about a second, until the network was back. The proxy and SSL hint is misleading here: the attempts never left the computer.
Cause
On an abnormal close (1006) the close listener reconnects with backoff only when
wasConnectedRefis set.connectToHostresets that flag, so a reconnect attempt that fails before connecting (the network is not back yet after the wake) takes the other branch, which is meant for a first connection that fails. That branch shows the error and setsisConnectingto false, but leavesshouldNotReconnectRefalone. The effect that connects a visible tab that is neither connected nor connecting then callsconnectToHostagain after two animation frames. That attempt fails at once again, and so on for as long as the network is down. Each pass adds the warning, and sinceisReconnectingRefis false on that path,connectToHostalso resetsreconnectAttempts, so the attempt limit never applies.A tab's first connection that fails loops the same way while the server cannot be reached.
Fix
reconnectAttempts > 0) goes on withattemptReconnection: the usual 2/4/8 second waits, and the Disconnected screen after the last attempt.shouldNotReconnectRef, as a rejected connection (1000/1005) and an expired login (1008) already do, so the effect does not retry it on the next frame. The error screen offers Reconnect.Frontend only, one branch in the close listener. CHANGELOG entry under 1.4.1.
Testing
abnormal-close-backoff.test.tsruns the 1006 branch and the auto-connect effect from the source, asauto-reconnect.test.tsdoes. A failed reconnect attempt keeps backing off; a failed first connection stops and the effect does not callconnectToHostagain. Both of those cases fail without the change.🤖 Generated with Claude Code