Repository navigation
fix(remote): a missed wake probe no longer closes slow remote connections - #33071
Conversation
…osing it On macOS wake and network online events every remote-runtime socket was probed with an 8 s deadline and closed on a miss. Relayed or lossy links still rerouting after a wake lost connections that would have survived. A miss now re-pings and leaves the socket until the normal 25 s keepalive window ends; the probe is skipped when data arrived in the last 3 s.
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a4c6ccc9-1fb6-4712-98f4-2d3f72fb4ece
Files selected for processing: 2-
src/shared/remote-runtime-socket-liveness.tssrc/shared/remote-runtime-socket-resume-probe.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
-
| armResumeProbeTimer(probedAt, deadlineMs, deadlineMs, () => { | ||
| // Why: a missed resume probe is suspect, not dead; a second ping covers a first one lost mid-reroute. | ||
| tryPing() | ||
| armResumeProbeTimer(now(), deathDelayMs, deadlineMs, () => { |
There was a problem hiding this comment.
🩺 Stability & Availability |
Clear the pending deadline after a late response.
If a socket answers after the first deadline, noteActivity() leaves this second timer armed. A later network-change probe then returns at Line 109 without sending a ping, even after the 3-second recent-activity period ends. For example, a response at 12 seconds followed by a network change at 21 seconds leaves the new path unprobed. An unanswered keepalive can then cause the socket to close without a ping after that network change. Clear the pending resume timer when activity arrives, and test a subsequent resume after a late response.
ELI5
When your Mac wakes up, or Wi-Fi comes back, Orca checks every connection to a remote server. If a server didn't answer within 8 seconds, Orca hung up and showed "Reconnecting to remote runtime". On a slow or relayed link, such as Tailscale going through a relay right after a wake, the answer often takes longer than that, so Orca dropped connections that were actually fine. Now a slow answer only makes Orca ask again. It hangs up only if the server stays silent for the normal 25 second keepalive window.
What Changed
onlineevent, each remote-runtime client socket got one ping with an 8 s deadline. A miss calledonDeadand closed the socket, then reconnected, so the banner showed.REMOTE_RUNTIME_SOCKET_LIVENESS_TIMEOUT_MSwindow the regular keepalive uses.src/shared/remote-runtime-socket-liveness.ts, which is shared by the shared-control, subscription and passthrough sockets. No caller or wire behaviour changes.Why
The wake probe from #29444 / #9092 exists so a socket that is really dead after sleep is noticed sooner than the 30–40 s the plain cadence needs. That goal still holds:
Trade-off: a really dead socket after sleep is now noticed about 17 s later than before, but still sooner than the plain keepalive. In exchange, a slow link coming back from a wake or a Wi-Fi change no longer gets a reconnect it didn't need.
Alternatives considered:
SSH, WSL and paired runtimes all use this monitor and get the same behaviour: less aggressive, never slower than the regular keepalive. The SSH host sleep probe (
ssh-host-sleep-reconnect.ts) is separate code and is untouched. Mobile has its own decisive 4 s relay resume probe (mobile/src/transport/mobile-relay-rpc-session.ts). This PR doesn't change it; it's a possible follow-up for parity.Linked Issue
Reported directly by a user whose desktop is paired over Tailscale, with no issue filed. Thanks to that reporter.
Visual Proof
N/A. This is transport timing with no UI change. The visible effect is fewer unnecessary "Reconnecting to remote runtime" banners.
Testing
src/shared/remote-runtime-socket-resume-probe.test.ts, run with production defaults:origin/main.ssh-host-user-disconnect,session-tabs-delta.integrationanduse-remote-runtime-recovery-triggersalso fail onorigin/mainwith this file reverted, so they are unrelated.paired-remote-terminal-serve-restart-binding.spec.ts› "pending snapshot", fails the same way onorigin/main.