Repository navigation
fix(orchestration): treat ask as a long-poll so it survives the 30s socket idle wall - #9351
Conversation
📝 WalkthroughWalkthroughThe RPC runtime now classifies 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/runtime-rpc.test.ts (1)
3566-3569: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReorder shutdown sequence and clean up the temporary directory.
It is safer to stop the server before closing the database to ensure that no in-flight requests or shutdown routines attempt to access a closed database connection, which could throw unhandled exceptions. Additionally, consider removing the temporary
userDataPathdirectory to avoid resource leaks across test runs.♻️ Proposed refactor
} finally { - db.close() await server.stop() + db.close() + rmSync(userDataPath, { recursive: true, force: true }) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9184c62e-38c0-46b4-a212-5c5766e82e8f
📥 Commits
Reviewing files that changed from the base of the PR and between d8629c4 and c85816822a08ea8d6628791ca7b90fce177fae5e.
📒 Files selected for processing (3)
src/cli/runtime/client.tssrc/main/runtime/runtime-rpc.test.tssrc/main/runtime/runtime-rpc.ts
c858168 to
1cd244d
Compare
…ocket idle wall
orchestration.ask blocks server-side until a reply lands or its timeout
(default 600s) elapses, holding the RPC open — but isLongPollRequest never
classified it as a long-poll. So the keepalive that resets the 30s
RUNTIME_RPC_SOCKET_IDLE_TIMEOUT_MS was never armed, and any ask left
unanswered for 30s died with a misleading runtime_unavailable ("The Orca
runtime closed the connection"), regardless of --timeout-ms. The same
omission left the handler's abort signal unwired (it is only passed for
long-polls), so the client-disconnect release path guarded by
signal?.aborted was dead code.
Add orchestration.ask to isLongPollRequest so it gets the keepalive, the
abort signal, and long-poll admission. The client already extends its
per-call socket timeout for ask (handlers/orchestration.ts passes
timeoutMs + 5s at the call site), so only the server-side classification
was missing.
1cd244d to
2f0c964
Compare
|
Thanks so much for this, @averydev — treat ask as a long-poll so it survives the 30s socket idle wall. Verified (fail-on-main/pass-on-branch), rebased on latest |
|
My pleasure @nwparker I've been using the orca cli primitives for some really fun stuff that is a bit off the beaten path so I think I'm exercising a slightly unusual combinations of tools. I'll keep em coming! great work! |
…ocket idle wall (stablyai#9351) orchestration.ask blocks server-side until a reply lands or its timeout (default 600s) elapses, holding the RPC open — but isLongPollRequest never classified it as a long-poll. So the keepalive that resets the 30s RUNTIME_RPC_SOCKET_IDLE_TIMEOUT_MS was never armed, and any ask left unanswered for 30s died with a misleading runtime_unavailable ("The Orca runtime closed the connection"), regardless of --timeout-ms. The same omission left the handler's abort signal unwired (it is only passed for long-polls), so the client-disconnect release path guarded by signal?.aborted was dead code. Add orchestration.ask to isLongPollRequest so it gets the keepalive, the abort signal, and long-poll admission. The client already extends its per-call socket timeout for ask (handlers/orchestration.ts passes timeoutMs + 5s at the call site), so only the server-side classification was missing.
fix(orchestration): treat
askas a long-poll so it survives the 30s socket idle wallSummary
Fixes
orchestration.askcalls dying at 30 seconds with a misleadingruntime_unavailableerror regardless of the requested timeout.ELI5
When one agent asked another a question and waited for the answer, the connection was silently killed after 30 seconds even if you asked it to wait longer. This keeps the line open until a real reply arrives.
Root cause & fix
orchestration.askblocks server-side until a reply lands or its deadline (default 600s) passes, holding the RPC socket open exactly likecheck --wait. ButisLongPollRequest()only classifiedterminal.waitandcheck --waitas long-polls, soaskfell through. That meant keepalive frames were never armed (the 30s socket idle timer then destroyed the connection) and the abort signal was never wired (so a client disconnect never released the waiter). The fix addsorchestration.asktoisLongPollRequest(), arming the existing keepalive machinery and abort wiring — no new--wait-style param gate is needed sinceaskblocks unconditionally.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.
origin/main(base7ab601487c, head1cd244d304); changed files:runtime-rpc.ts(fix),runtime-rpc.test.ts(test).orchestration.ask blocks→ 1 passed (55 skipped).oxlint src/main/runtime/runtime-rpc.ts→ exit 0.Trade-offs
None — pure fix.
Regression risk
Zero-regression: the change is purely additive to the long-poll classifier. Short RPCs and non-
askpaths are byte-identical and unaffected.orchestration.askgenuinely holds the socket, so keepalive/abort wiring is the correct treatment, proven by the passing test that fails when reverted.Credit to original author @averydev. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.