Skip to content

fix(client-runtime): reset tolerant reconnect budget across a network drop - #27

Merged
radroid merged 1 commit into
mainfrom
t3x/issue-21-offline-tolerant-reset
Jul 27, 2026
Merged

fix(client-runtime): reset tolerant reconnect budget across a network drop#27
radroid merged 1 commit into
mainfrom
t3x/issue-21-offline-tolerant-reset

Conversation

@radroid

@radroid radroid commented Jul 27, 2026

Copy link
Copy Markdown
Owner

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. The network === "offline" branch did not.

A network drop is not backend slowness. Leaving tolerant/consecutiveSlowTimeouts set 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

  • Reset tolerant = false and consecutiveSlowTimeouts = 0 in the offline branch. failureCount is intentionally preserved so backoff continuity survives a transient blip.
  • Add a regression test: arm the tolerant budget via a synchronizing-stage slow timeout, blip offlineonline, then assert the reconnect times out on the normal 15s budget (a leaked flag would keep it connecting until 45s).

Verification

  • vp test run src/connection/supervisor.test.ts34 passed (incl. the new test)
  • tsgo --noEmit -p tsconfig.json0 errors
  • vp fmt / vp lint → clean

🤖 Generated with Claude Code

… 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>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8a4cd3c7-11c5-4b66-9eed-269fcd671b59

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3x/issue-21-offline-tolerant-reset

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@radroid
radroid merged commit 7772b55 into main Jul 27, 2026
2 checks passed
@radroid
radroid deleted the t3x/issue-21-offline-tolerant-reset branch July 27, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant