Repository navigation
fix(server): idle /ws connections behind a reverse proxy no longer drop every 60s - #40932
Conversation
…op every 60s The /ws RPC socket only answered client frames, so a suspended client that stopped pinging lost its socket to any proxy with a 60s idle timeout. The server now writes a heartbeat frame every 20 seconds on each /ws socket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
**v0.1.12-nightly.20261122.5111** · 30 changes from 10 contributors - **Multi-file diffs.** Open diff now shows every file in a multi-file Codex patch. - **Mixed-content paste.** Pasting a message with text and a picture now keeps both. - **Queued attachments.** Edit a queued message without losing its image or file attachment chips. - **Pull request checks.** Agents watching a pull request can recognize checks that already passed instead of waiting indefinitely. - **Notebook outputs.** Saved HTML outputs now appear when you scroll them into view. ### Plus 24 more bug fixes and performance improvements. <details> <summary>Full changelog</summary> ## What's Changed * perf(mobile): keep image bytes outside draft JSON by @t3dotgg in pingdotgg/t3code#9727 * fix(server): watch_pull_request says when checks already passed by @juliusmarminge in pingdotgg/t3code#40866 * fix(codex): Open diff shows every file of a multi-file patch by @Abhiram-745 in pingdotgg/t3code#40874 * fix(server): ACP startup gives up when the agent never answers the handshake by @juliusmarminge in pingdotgg/t3code#40864 * fix(server): a branch prefixed with another remote's name publishes under its full name by @Abhiram-745 in pingdotgg/t3code#40877 * fix(server): list open delegated tasks when task_status or task_cancel finds no match by @Project516 in pingdotgg/t3code#40886 * fix(gitlab): find merge requests opened from a fork by @Abhiram-745 in pingdotgg/t3code#40894 * fix(web): pasting a chat message with text and a picture keeps both by @juliusmarminge in pingdotgg/t3code#40909 * fix(antigravity): bound silent post-settle background command holds by @Lokkuchakreshkumar in pingdotgg/t3code#40858 * fix(desktop): WSL is not offered or started when only the Windows install stub exists by @juliusmarminge in pingdotgg/t3code#40918 * fix(server): idle /ws connections behind a reverse proxy no longer drop every 60s by @juliusmarminge in pingdotgg/t3code#40932 * fix(server): thread reads no longer attribute T3 Code's compact-before-send /compact to the user by @juliusmarminge in pingdotgg/t3code#40934 * fix(web,mobile): @-file mentions show by name in message previews, not as raw links by @tiliakoos in pingdotgg/t3code#40924 * fix(web): tool calls stay grouped after a usage-limit pause again by @matthew-waters in pingdotgg/t3code#40905 * fix(server): t3 doctor no longer reports a database just under 1 GiB as "1024.0 MiB" by @tiliakoos in pingdotgg/t3code#40952 * fix(web): show clone failure after progress is dismissed by @StiensWout in pingdotgg/t3code#40951 * Invalidate pending theme imports when a replacement is too large by @StiensWout in pingdotgg/t3code#40965 * fix(mobile): show linked thread history page errors by @StiensWout in pingdotgg/t3code#40973 * fix(client-runtime): skip waiting for lower-priority linked addresses by @StiensWout in pingdotgg/t3code#40989 * fix(web): navigate Excel sheets from the focused tab by @StiensWout in pingdotgg/t3code#41008 * fix(mobile): bound app-owned composer attachment filenames by @StiensWout in pingdotgg/t3code#40991 * fix(web): prioritize visible saved notebook outputs by @StiensWout in pingdotgg/t3code#40998 * fix(web): editing a queued message keeps its attachment chips resolved by @smirea in pingdotgg/t3code#40945 * fix(server): unlinking an environment ends its session on the other machine by @juliusmarminge in pingdotgg/t3code#41005 * fix(mobile): scope Git result banners to their originating thread by @StiensWout in pingdotgg/t3code#41015 * fix(web): keep the conversation when a pairing tab closes by @StiensWout in pingdotgg/t3code#41025 * fix: restart linked thread reads when trying again by @StiensWout in pingdotgg/t3code#41020 * fix(client-runtime): count ambiguous projects in chat file links by @StiensWout in pingdotgg/t3code#40986 * fix(mobile): keep media actions on each sent image page by @StiensWout in pingdotgg/t3code#41018 * perf(server): a run's provider turn lookup is linear, not quadratic by @navidnadali in pingdotgg/t3code#38791 ## New Contributors * @Lokkuchakreshkumar made their first contribution in pingdotgg/t3code#40858 * @matthew-waters made their first contribution in pingdotgg/t3code#40905 **Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261122.5098...v0.1.12-nightly.20261122.5111 </details> Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261122.5111
An idle connection to a T3 Code server behind a reverse proxy (nginx's default 60s
proxy_read_timeout, AWS ALB) was closed every 60 seconds whenever the app was backgrounded or the machine slept, because the server's/wssocket only answered client messages and never sent anything on its own. The server now sends a small heartbeat frame on every/wsconnection every 20 seconds, as its server-sent event streams already do.withSocketHeartbeat(new,apps/server/src/socketHeartbeat.ts) writes{"_tag":"Pong"}on an interval for as long as the connection's writer is open./wsinws.tswraps every upgraded socket with it, alongside the existing large-frame splitting.Fixes #40927
Reproduction on main
Commit 2c4310e (origin/main). Ran
node apps/server/src/bin.ts serve --mode web --host 127.0.0.1 --port 47927 --base-dir <fresh scratch dir> --no-browserwith T3CODE_DEV_SEED=0. In front of it ran a Node TCP proxy on :47928 that, like nginx proxy_read_timeout 60s, closes a connection after 60s with no bytes from upstream (https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6e599f9d3e987467/idleproxy.mjs). A Node client (https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6e76642ceabceda1/silentclient.mjs) paired with the startup token via POST /api/auth/browser-session, took a ticket from POST /api/auth/websocket-ticket/rpc, opened /ws?wsTicket=…&orchestrationProtocol=2 through the proxy, then sent nothing, modelling a suspended app or a sleeping Mac. Observed: open at +0.1s, zero server frames, closed with code 1006 at +60.1s; the proxy logged 'upstream silent 60000ms, closing (lived 60.0s)' (log: https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e0fd2751e5b59e04/silent-run.log). The multi-minute reconnect was not reproduced: on main, a session that lasted at least BACKOFF_RESET_AFTER_MS (30s) resets the retry ladder, and the first loss of a live session retries after about 250ms (SESSION_LOSS_RETRY_DELAY_MS). The reported delays are likely the client being suspended by the OS, which needs a real macOS and iOS device to observe.Evidence
Started each real server with fresh data, paired a silent Node WebSocket client through a TCP proxy enforcing a 60s upstream idle timeout, and observed it for up to 150s. The client sent no WebSocket frames. Images and videos below are labeled transcript replays of the actual runtime logs, not app screenshots.
Drivers: TCP proxy, silent client, comparison runner, transcript renderer.
The head log also shows an unused HTTP keepalive connection timing out; the WebSocket continues receiving heartbeats and remains open.
Not shown:
Tests
vp test run src/socketHeartbeat.test.ts(apps/server): 1 passedvp run check:changed: lint, knip, graphql, typecheck (3 packages) and tests (3 files, 37 tests) passed. Format failed on the new file; fixed withvp fmt, and the pre-commitvp fmt, lint and knip then passednode apps/server/src/bin.ts serve --mode webon a fresh base dir, connecting directly with no proxy, 45s per side: base had 0 server frames; the fix had a heartbeat at +20.1s and +40.1sNot in this change
HEARTBEAT_INTERVALin eventStreamResponse.ts rather than shared, because the two have different stated reasons.Who did the work
Run by the t3code factory in T3 Code.