Skip to content

fix(client-runtime): sync #45024 fixes and resolve #44850 review findings - #135

Merged
yvesoddly merged 7 commits into
mainfrom
fix/client-runtime-carried-route-fixes
Dec 2, 2026
Merged

yvesoddly merged 7 commits into
mainfrom
fix/client-runtime-carried-route-fixes

Conversation

@yvesoddly

@yvesoddly yvesoddly commented Dec 2, 2026 •

Copy link
Copy Markdown

Upstream closed pingdotgg#45024 after adding three bug-fix commits on top of the one the fork carries, and pingdotgg#44850 still has two unresolved CodeRabbit findings. This PR pulls in the pingdotgg#45024 fixes, fixes both pingdotgg#44850 findings, and refreshes the carried-PR manifest.

pingdotgg#45024: upstream's follow-up fixes

Cherry-picked unchanged from pingdotgg/t3code#45024 (the changed lines match upstream exactly, and pingdotgg#44850's route cooldown is untouched):

  • c3128677a8: the silent-route backoff starts at one check interval, so after connecting over T3 Connect, LAN is still checked at one minute. The schedule is 0, 1, 3, 7 minutes instead of 0, 2, 6.
  • 835e3ce79e: betterRouteChecks is Queue.sliding(1), so a check still queued for an ended session can no longer drop the new session's check on connect.
  • f432f5b91b: a silent route's deadline is set half an interval early, so a check that runs a little after its tick still gets the next tick.

CodeRabbit's backoff finding on f432f5b91b is a false positive, so the code is unchanged. The finding said 2 ** (failures - 1) halves the backoff compared with 2 ** failures. It does, on purpose: the new check on connect counts as the first failure, so the shorter exponent keeps main's 1, 3, 7 minute schedule and adds the 0-minute check. I restored 2 ** failures locally and the "checks a silent LAN route again" tests failed (4 LAN checks instead of 5, so the one-minute check was skipped). CodeRabbit withdrew the finding upstream after the author gave the same explanation.

pingdotgg#44850: review findings

Silent sockets now count as route losses (valid, fixed). A socket that went silent while its host still answered a fresh request was replaced without being recorded, so a route whose sockets kept going silent (for example, a black-holed Tailscale tunnel) never cooled down. That replacement now records a route loss.

Replacements during a long resume (10 s or more in the background) still don't count. After a long suspension, iOS killing the socket is the likely cause, not the route. That applies both to a silent socket found during a long resume and to the long-resume probe timeout. Otherwise, switching apps a few times would push a healthy LAN to the back for five minutes.

Removing an environment now forgets cached ath hashes (valid, fixed). The hash cache is a module-level map keyed by the raw access token, and explicit removal never reached it. DpopProof.forgetAccessTokenHashes clears the cache, and EnvironmentRegistry calls it next to the other cleanup on explicit removal. The cache does not know which environment a token belongs to, so removal clears every entry. Other environments rehash once on their next request.

Carried-PR manifest

  • #45024: takenSha set to f432f5b91b, closedUpstream: true.
  • #42658: closedUpstream: true.
  • #44742: closedUpstream: true. Upstream's head also moved from 4b16012003 to 462b6289c5, which only merges upstream main into the PR. The fork already matches it: ProviderEventIngestor.ts is identical, and the PR diff at 462b6289c5 reverse-applies cleanly to this branch. So takenSha now points at 462b6289c5, with a note like #17890's. Otherwise it would keep reporting drift.
  • #44850: added a note that the fork carries the two fixes above on top of it.

node scripts/fork-carried-prs.ts now reports all 18 carried PRs as unchanged.

Verification

  • vp test run src/connection/ src/relay/ in packages/client-runtime: 297 tests in 19 files pass.
  • New tests, each confirmed to fail when its fix is undone:
    • Three silent-socket replacements within the window move the next connection to T3 Connect.
    • Three long-resume replacements keep LAN.
    • An access token is hashed once, and hashed again after forgetAccessTokenHashes.
  • vp test run scripts/fork-carried-prs.test.ts passes.
  • vp run typecheck in packages/client-runtime passes.
  • vp run check:changed 1318ff6efb passes: format, lint, knip, typecheck (43 packages, since the manifest change runs everything), and 155 tests next to the changed files.

Not exercised on a device. These are client-runtime connection changes with no UI.

Model and harness: Claude Opus 5.5 via Claude Code in T3 Code.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

maria-rcks and others added 6 commits December 1, 2026 19:52
…ver relay

The better-route check now runs on connect, and a silent result there backed
off for two minutes, so it skipped the check main ran at one minute. Start the
silent-route backoff at one check interval.

(cherry picked from commit c312867)
A check still queued for an ended lease filled the one-slot dropping queue, so
the check the new lease asked for on connect was discarded. Keep the newest
request instead.

(cherry picked from commit 835e3ce)
A check runs a little after its tick, so a silent route's deadline landed just
past the tick it was meant for and the route waited a whole extra interval.
Set the deadline half an interval early.

(cherry picked from commit f432f5b)
A socket that went silent while its host still answered a fresh request was
replaced without counting against its route, so a route whose sockets kept
going silent never cooled down. Record a route loss for that replacement,
except during a long resume, when the OS killing a suspended socket is the
likely cause. Fixes a CodeRabbit finding on pingdotgg#44850.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t is removed

The ath hash cache is keyed by the raw access token, and explicit removal
never reached it, so a removed environment's token stayed in memory until a
later miss filled the cache. Removal now clears the cache. Fixes a CodeRabbit
finding on pingdotgg#44850.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d upstream

pingdotgg#45024 is taken at its final head f432f5b. pingdotgg#42658, pingdotgg#44742 and pingdotgg#45024 are
closed upstream. pingdotgg#44742's head only merged upstream main, which the fork
already resolved the same way, so its taken SHA moves to that head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T02:06:30.984541Z 2901513 PR opened
🔒 Security Review ✅ Completed 2026-12-02T02:08:18.599778Z 2901513 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M labels Dec 2, 2026
@yvesoddly
yvesoddly changed the base branch from sync/upstream-main-20261201 to main December 2, 2026 04:01
@yvesoddly
yvesoddly merged commit 345fe24 into main Dec 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants