fix(client-runtime): reset tolerant reconnect budget across a network drop - #27
Merged
Merged
Conversation
… drop Follow-up to #25 (closes the last review nit on #21). The adaptive reconnect budget added in #25 arms a "tolerant" 45s establishment timeout after a backend-reached slow timeout. Three of the four run-loop branches that step away from an attempt already reset that budget, but the `network === "offline"` branch did not. A network drop is not backend slowness, so carrying the enlarged budget across the outage let the first attempt after the network returned wait 45s instead of the normal 15s. Reset `tolerant`/`consecutiveSlowTimeouts` in the offline branch (keeping `failureCount` so backoff continuity survives a transient blip) and add a regression test that arms the tolerant budget, blips offline→online, and asserts the reconnect times out on the normal 15s budget. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What & why
Follow-up to #25, landing the one low-severity nit surfaced by the independent review of that PR (issue #21).
The adaptive reconnect budget introduced in #25 arms a tolerant 45s establishment timeout after a backend-reached slow timeout, so a genuinely slow-but-alive backend isn't given up on prematurely. Three of the four run-loop branches that step away from an attempt (
!desired, stable success, blocked) already reset that budget. Thenetwork === "offline"branch did not.A network drop is not backend slowness. Leaving
tolerant/consecutiveSlowTimeoutsset across an outage meant the first reconnect attempt after the network returned would wait the enlarged 45s budget instead of the normal 15s — slower failure detection exactly when the user is most likely watching for a reconnect.Change
tolerant = falseandconsecutiveSlowTimeouts = 0in the offline branch.failureCountis intentionally preserved so backoff continuity survives a transient blip.offline→online, then assert the reconnect times out on the normal 15s budget (a leaked flag would keep itconnectinguntil 45s).Verification
vp test run src/connection/supervisor.test.ts→ 34 passed (incl. the new test)tsgo --noEmit -p tsconfig.json→ 0 errorsvp fmt/vp lint→ clean🤖 Generated with Claude Code