# fix\(client\): slow networks no longer drop working connections · PR \#19426 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/19426)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: open

Source repository: pingdotgg/t3code

Source branch: t3/slow-links-keep-connections

Target branch: main

Head commit: aa7bb7087eb8390248c6fd8ea06329a21bc105ca

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/19426)

[Commits](https://git.cafe/pingdotgg/t3code/pull/19426/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/19426/diffs?format=markdown)

## Description

---

Healthy slow connections can be dropped when a health check or cached T3 Connect ticket takes more than three seconds. The shared connection supervisor now gives quick probes six seconds and extends them when raw WebSocket messages still arrive, with an absolute fifteen-second cap. Cached ticket requests also get six seconds, including learned LAN and tailnet routes.

Frame counting runs before the RPC read loop, so a full subscription buffer cannot hide incoming traffic. The message listener belongs to the socket scope and is removed on release. Mobile returns from an inactive state without a background visit reset retries and check for a better route without probing or resubscribing shell/thread streams. Genuine background resumes retain their existing probe/reconnect behavior. Effect's five-second ping cadence, direct endpoint identity checks, and current main's token-preservation rules are unchanged.

Maintainer takeover of [#19426](https://github.com/pingdotgg/t3code/pull/19426), building on @t3dotgg's work and @nick-potts's original contribution in [#18704](https://github.com/pingdotgg/t3code/pull/18704). All contributor commits are preserved; current main was merged and follow-ups simplify the tests, socket ownership, and comments.

Verification on headless Linux, Node 24, at [aa7bb7087e](https://github.com/pingdotgg/t3code/commit/aa7bb7087eb8390248c6fd8ea06329a21bc105ca):

- Focused tests: **421 tests / 19 files → 419 tests / 19 files**, passing. Eight mutations demonstrate failures for the old quick timeout, missing frame extension, wrong retry window, excessive cap, missing raw listener, old ticket timeout, inactive refocus probe, and refocus resubscription. Client-runtime, mobile, web, and desktop typechecks pass; all changed files pass lint/format and whitespace checks.
- [Actual loopback WebSocket timing evidence](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/4440c8e41997d4ec/19426-websocket-proof.txt): production RpcSession and EnvironmentSupervisor with Node's WebSocket client and a controlled server. Substituting the base supervisor replaces the healthy socket at **3,014 ms**; the rebuilt head keeps the same socket through an **8,006 ms** probe reply while messages arrive. A silent socket is replaced at **6,018 ms**; continuous incoming messages cannot extend a stalled probe beyond **15,022 ms**. All owned loopback servers closed. This is protocol-level evidence with synthetic configuration, not a browser recording or a real WAN reproduction.
- Both independent full-diff adversarial reviewers found no substantive issues in round 1. One independently reran 224 tests across seven relevant files. Human review of authorization-path and runtime default changes remains required; this audit does not supply approval.
- Trade-off: detecting silence through a quick probe now takes six seconds. Incoming messages can defer replacement to fifteen seconds. A stalled cached ticket uses six seconds of the existing fifteen-second setup budget, leaving roughly nine seconds for renewal and the next ticket request on that route.
- Native device access is disabled in this environment. Real slow-network T3 Connect/Tailscale connections, iOS Control Center/Face ID and background lifecycle, Android, macOS, Windows, hosted browser, and Electron desktop were not exercised. Device/network verification and human approval remain outstanding. Current-head CI passes every executed job, including Check, Test, Test Web, Build and Typecheck, Lint, and eight server shards. Correctness and CodeRabbit pass; Approvability remains neutral. A duplicate fingerprint job was cancelled before a successful replacement. This PR remains unmerged.

Tests: GPT-6-Astra (high); implementation: GPT-6.1-Sol (high); adversarial reviews: Claude Opus 5.5 and GPT-6-Sol through T3 Code delegated tasks. Coordinated with GPT-6.1-Sol through the Codex harness in T3 Code.

