You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(client-runtime): retry saving repeated direct routes - #45443
A temporary storage outage could leave T3 Connect on the relay after the host advertised a direct Tailscale route. The client retries saving the latest endpoint report with capped backoff, even when no more snapshots arrive. Closing the session cancels retries waiting for the registry lock, while an in-flight save finishes publishing the route so the registry stays consistent with storage.
Commit 0fbd32628b (main). The client discards the repeated address and keeps only the relay route. Expected: The client saves the Tailscale route so it can connect directly.
The cause is at packages/client-runtime/src/connection/supervisor.ts:374. Ran cd packages/client-runtime && pnpm exec vp test run src/connection/registry.test.ts with the repro test added: it failed in 2 of 2 runs on a clean checkout, with expected 1 to be 2 in the output.
Evidence
Environment: Linux x64, the repository's own tests.
Outside view: not shown in the running app. The bug fails the rule that every step is the person's or the world's. Staying on the relay depends on connection settings failing to save at the moment the host first advertises a Tailscale address, then succeeding before a later snapshot repeats that same address, and nothing a person does in the app, nor a network change or an outside service, puts the running app into that temporary save failure.
Tests
26b3d03cf2 adds the failing test, alone, before the fix.
pnpm exec vp run check:changed 23aed63ceccac3b5ecd3d8020986c3206a7bb4e8 passed on head.
Not in this change
Route eligibility and ranking keep their existing behavior.
The disconnect regression uses a paused catalog write at the registry’s persistence boundary.
Who did the work
Repro written by GPT 6.2 Sol, in Codex
Outside view by Grok 4.7, in Grok
Duplicate check judged by Claude Opus 5.5, in Claude Code
Written by GPT 6.2 Sol, in Codex
Trimmed by Claude Opus 5.5, in Claude Code
Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex, and by Grok 4.7, in Grok
Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol, Claude Opus 5.5 and Grok 4.7
…ptible sleeping fiber
Drops the cancel Deferred and join: interrupting the retry fiber already waits for an in-flight save.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…y test harness
Drops the separate file's hand-built layer, driver and session for the existing makeHarness, which gains one beforeSetRoutes hook.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The gate folds registry.test.ts edits into the repro commit, which allows only small lint and type edits.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Macroscope's review found this PR requires human approval — Failed learned-route saves now retry, and catalog writes finish despite session closure. An unresolved review concern identifies a gap where the supervisor can retain stale routes after publication, affecting subsequent reconnects; that synchronization question needs resolution.
Notes:
All code in this push has already been reviewed. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
The registry now propagates learned-route persistence errors after acquiring the lease lock. The supervisor retries failed saves with increasing delays, handles newer reports during retries, and supports disconnect or removal while a save is pending.
The registry keeps route-learning work uninterruptible after acquiring the lease lock and propagates operation errors. Tests cover repeated configuration reports and disconnect or removal during persistence.
The supervisor fingerprints reports, retries failed saves with increasing delays, and handles newer reports by canceling a delay or joining an in-flight save. Tests cover successful retries and disconnect during a blocked save.
pingdotgg/t3code#15468: Adds learned routes from ServerConfig.directEndpoints, which this change retries when saving fails.
Suggested labels:bugfix
Suggested reviewers:juliusmarminge
Merge Risk: Low · up to e65e5
The change makes the client keep retrying to save a newly advertised direct route instead of staying on the relay route after a temporary save failure. One open edge case remains. If a session closes just as a route save completes, reconnect attempts may keep using the older relay-only routes until a new report arrives or the app restarts. This is narrow and recoverable, so the change is mergeable with owner awareness.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(client-runtime): retry saving repeated direct routes" matches the main change: the supervisor now retries failed saves of the latest endpoint report, and the registry lock and session c…
Description check
The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem and Change sections explain the storage-outage retry behavior and the session-close handling…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(client-runtime): retry saving repeated direct routes" matches the main change: the supervisor now retries failed saves of the latest endpoint report, and the registry lock and session close handling are adjusted. It uses a conventional commit prefix and names the affected package. It is specific and accurate to the changeset.
Full details: Description check
Explanation
The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem and Change sections explain the storage-outage retry behavior and the session-close handling. Verification gives a focused test command, observed failing and passing results, and a check run. Scope links related issues but does not clearly say whether a maintainer requested the PR or why it is a bug fix rather than a feature. The description also includes a long provenance and model attribution list, and an 'Outside view' section that argues the bug is not reachable in the running app, which does not match the template's expected content. These points are weaknesses but the required information is mostly present.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Heavy lift
Keep the supervisor's route state in step with the published catalog entry.
The registry publishes the learned route in an uninterruptible region. The supervisor applies that same result to currentEntry only after learn returns, at supervisor.ts:388. If the session closes during that gap, Effect can deliver the pending interruption before Ref.set runs. The registry then holds the direct route, and the supervisor keeps the older routes.
The later reconnect attempts read currentEntry. Until a changed report or a restart, they can use the relay-only routes. A repeated identical report does not repair this state because handled is not recorded on interruption, and the re-run learn may return no update.
The fix must keep lock acquisition interruptible, as the registry comment requires. It must also ensure the supervisor's route state matches the published entry even when the save is interrupted. Do not wrap the whole learn call in Effect.uninterruptible.
…est harness
Drops the separate file's hand-built layer for the existing makeHarness, per
the testing guide's extend-before-add rule, and keeps main's expect import.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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
size:M30-99 changed lines (additions + deletions).takeover:in-progressA takeover lead is working on this PRvouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
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.
A temporary storage outage could leave T3 Connect on the relay after the host advertised a direct Tailscale route. The client retries saving the latest endpoint report with capped backoff, even when no more snapshots arrive. Closing the session cancels retries waiting for the registry lock, while an in-flight save finishes publishing the route so the registry stays consistent with storage.
Related: #33484, #45024, #36311, #34826, #34963, #44850, #44344
Reproduction on main
Commit 0fbd32628b (main). The client discards the repeated address and keeps only the relay route. Expected: The client saves the Tailscale route so it can connect directly.
The cause is at
packages/client-runtime/src/connection/supervisor.ts:374. Rancd packages/client-runtime && pnpm exec vp test run src/connection/registry.test.tswith the repro test added: it failed in 2 of 2 runs on a clean checkout, withexpected 1 to be 2in the output.Evidence
Environment: Linux x64, the repository's own tests.
Proven: the repro fails at the test commit 26b3d03cf2 and passes on the head 31a571d548, both on main 23aed63cec.
Outside view: not shown in the running app. The bug fails the rule that every step is the person's or the world's. Staying on the relay depends on connection settings failing to save at the moment the host first advertises a Tailscale address, then succeeding before a later snapshot repeats that same address, and nothing a person does in the app, nor a network change or an outside service, puts the running app into that temporary save failure.
Tests
pnpm exec vp run check:changed 23aed63ceccac3b5ecd3d8020986c3206a7bb4e8passed on head.Not in this change
Who did the work
Made in T3 Code by GPT 6.2 Sol, Claude Opus 5.5 and Grok 4.7