Repository navigation
Conversation
A shared-control keepalive frame refreshed the timeout of every pending request on the shared socket. Those pending requests are ordinary short RPCs (git/repo/session-tabs), while the keepalive is armed server-side only for an unrelated long-poll on the same socket. So while any long-poll kept keepalives flowing, a genuinely-stuck short RPC never hit its deadline: the caller hung forever, the timeout-driven teardown/reconnect/ replay never fired, and eight such hangs exhausted the per-environment call queue (concurrency 8), wedging all further control-plane calls. Tag each pending request with `refreshTimeoutOnKeepalive` (default false). Short RPCs now keep an absolute deadline so a stuck server call times out, tears the socket down, and reconnects/replays as designed. Only requests that explicitly opt in (long-polls routed through the short-RPC path) may have their deadline extended by keepalives — preserving that escape hatch without changing any current caller, since today's long-polls run on the subscription map, not pendingRequests. Applies to both SSH remote-runtime and remote Orca Server topologies, which share this control connection.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughShared control requests now carry an opt-in 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
A remote-runtime server keepalive frame refreshed the timeout of every pending request on the shared-control socket. Those pending requests are ordinary short RPCs (git / repo / session-tabs — nearly all control-plane calls except
status.get), while the keepalive is armed server-side only while a long-poll subscription is in flight on the same socket (runtime-rpc.tsarms it forterminal.wait/orchestration.check --wait).Consequence: while any long-poll kept keepalives flowing, a genuinely-stuck short RPC never reached its deadline. The caller hung forever with no error, the timeout-driven teardown → reconnect → subscription-replay never fired, and 8 such hangs exhausted the per-environment call queue (concurrency 8,
runtime-rpc-call-queue.ts), wedging all further control-plane calls for that environment.Fix
Distinguish request kinds. Each pending request is now tagged with
refreshTimeoutOnKeepalive(default false):onTimeoutwas designed to do ([Bug]: Remote Orca Server issues #7718).refreshTimeoutOnKeepalive: true) to keep the old keepalive-extends-deadline behavior.No current caller sets the opt-in: today's long-polls (
terminal.wait,orchestration.check --wait) run on the subscription map (.subscribe()), which has no per-request timeout and whose longevity is driven by replay/response — not bypendingRequests. So the refresh overpendingRequestsnever had a legitimate use; the flag is a preserved escape hatch, and subscription behavior is unchanged.Only the refresh semantics change — every timeout value is left exactly as it was.
Screenshots
No visual change.
Testing
pnpm typecheckpnpm test— fullremote-runtime-shared-controlsuite (28) +runtime-rpc,runtime-rpc-call-queue,runtime-environment-request-connections,runtime-environment-transport-routing(66) all passpnpm check:max-lines-ratchetremote-runtime-shared-control-keepalive-refresh.test.ts):main; passes with the fix)AI Review Report
Reviewed the timeout registration/refresh/teardown path across
remote-runtime-shared-control-{requests,state,frame-dispatch,connection,send,subscription-start}.ts. Confirmed subscriptions never enterpendingRequests, so tighteningpendingRequestsdeadlines cannot shorten subscription longevity; theonTimeout→ teardown/reconnect/replay wiring is preserved and still covered by the existing "tears down the socket when a request times out" test. Change is pure TypeScript control-plane logic with no platform-specific code (no shortcuts, labels, paths, shell, or Electron surfaces) — identical on macOS, Linux, and Windows.Security Audit
No new input handling, command execution, path handling, auth, secrets, dependency, or IPC surface. The change only makes a client-side request deadline stricter (absolute vs refreshable), which strictly reduces the window a wedged/half-open connection can hold resources. No follow-up needed.
Notes
Core SSH / remote-server territory: this shared-control connection backs both the SSH remote-runtime and remote Orca Server topologies (both route control-plane RPCs through
RemoteRuntimeSharedControlConnection), so both benefit from the queue-wedge fix. Risk for legitimately long-running short RPCs: they already had a bounded caller-supplied timeout before this change (keepalive refresh only ever masked hangs, it did not grant well-behaved long RPCs a larger budget), so none regress; if a genuinely long short-RPC surfaces later, bump itstimeoutMsat the call site or opt it into refresh.Made with Orca 🐋