Repository navigation
Conversation
…ing mail and never refuse actions The runtime refused the 17th open long-poll (check --wait, ask, worker-start, terminal wait, prompted agent launch, agent-prompt send, browser-host attach) with runtime_busy before its handler ran. A coordinator's check --wait then reported no mail while mail sat in its mailbox, and idle waits refused worker-start and ask. Long-polls keep keepalive and the abort signal but no longer count against a cap. The 16 cap existed only to protect the local socket's 32-connection limit, so that limit is now 512; clients open one socket per request. An accept failure no longer crashes the runtime. Browser-host attach keeps its per-connection and per-device limits in the lease registry. Co-authored-by: Brennan Benson <[email protected]> Co-authored-by: Claude <[email protected]>
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
config/scripts/vitest-sqlite-database-runtime-files.mjs: 1
179-182: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the second duplicate entry.
The include list contains
runtime-orchestration-sender-names.test.tstwice. Keep the existing first entry and remove the later one.Suggested fix
'src/main/runtime/runtime-rpc-held-request-admission.test.ts', 'src/main/runtime/runtime-rpc-long-poll-transport.test.ts', - 'src/main/runtime/runtime-orchestration-sender-names.test.ts', 'src/main/runtime/runtime-rpc-orchestration-db-migration.test.ts',
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a4101efe-53aa-4402-9cbc-0c7fd66c7dc3
📒 Files selected for processing: 13
config/scripts/vitest-sqlite-database-runtime-files.mjssrc/main/runtime/rpc/methods/orchestration/messaging/check-direct.tssrc/main/runtime/rpc/unix-socket-transport.tssrc/main/runtime/runtime-rpc-browser-host-admission.test.tssrc/main/runtime/runtime-rpc-dispatch-inject-long-poll.test.tssrc/main/runtime/runtime-rpc-held-request-admission.test.tssrc/main/runtime/runtime-rpc-long-poll-transport.test.tssrc/main/runtime/runtime-rpc-websocket-long-poll-caps.test.tssrc/main/runtime/runtime-rpc/runtime-rpc-long-poll.tssrc/main/runtime/runtime-rpc/runtime-rpc-pairing-types.tssrc/main/runtime/runtime-rpc/runtime-rpc-request-admission.tssrc/main/runtime/runtime-rpc/runtime-rpc-state.tssrc/main/runtime/runtime-rpc/runtime-rpc-websocket-dispatch.ts
💤 Files with no reviewable changes: 2
- src/main/runtime/runtime-rpc/runtime-rpc-websocket-dispatch.ts
- src/main/runtime/runtime-rpc-websocket-long-poll-caps.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Two things from #26549 that aren't in this version, both costs that only appear once the 16 cap is gone:
|
ELI5
When many agents were waiting on Orca at once, Orca refused everyone after the 16th. A coordinator's
orchestration check --waitreported "no mail" for an hour while two questions sat in its mailbox, andworker-startkept failing with "long-poll capacity reached; retry with backoff". Now a wait whose mail is already there gets it, and starting a worker or asking a question works no matter how many other agents are waiting.This is a slimmer version of #26549 by @brennanb2025, built from the same pieces (credited as co-author).
What Changed
Before: Orca's runtime (the server the
orcaCLI, paired desktops and phones talk to) allowed at most 16 requests that stay open while they wait:check --wait,ask,terminal wait,worker-start,agent launchwith a prompt, prompt submission viaterminal send, chat inject, and a paired desktop's browser-host attach. Smaller shares inside the 16 were reserved for asks and browser hosts. The count was checked by request type before the request ran, so the 17th was refused without being read. The CLI doesn't retryruntime_busy, so each refusal was a failed command.After:
Why
The 16 existed only to keep the local socket's 32-connection limit from filling up (#1403, May). It measured nothing about what a wait costs: a held
check --waitis an in-memory waiter woken when mail arrives. Because it was checked before the request ran, it hid mail that was already waiting and let idle waits block real work. Earlier fixes carved it into shares (#10529 for ask, #15448 for browser hosts), and each one moved the wall to the next group of requests.Alternatives considered:
worker-startandask.Differences from #26549: it adds a 512 "budget" plus a 640 hard limit, a per-connection flag passed from the transport into request handling, and closes the socket after an over-budget reply. Every local client opens one socket per request (
src/cli/runtime/transport.ts, the sidecar client), so a single connection limit does the same job. Electron raises its file-handle limit at startup (checked: launched with a limit of 256, it reports about 1M), so 512 sockets is safe. Past 512 the CLI shows the same message as today's past-32 behaviour, which a 40-agent fleet (about 80 sockets) won't reach.Browser-host attach keeps its real limits:
assertBrowserHostLeaseAdmissionalready caps leases per connection and per paired device, so the deleted admission shares were a second copy of that limit.Linked Issue
Linear STA-11193. Also fixes #19342.
Visual Proof
N/A: no UI change. The before/after is the CLI/RPC result, covered by the tests below. #26549 has native Windows app screenshots of the same behaviour change.
Testing
New
runtime-rpc-held-request-admission.test.ts, all three cases fail onmainwithruntime_busyand pass here:check --wait,ask,worker-start, a promptedagent.launch, prompt submission viaterminal sendandstatus.getare all answered.orchestration.check --waitcalls held, a 41stcheck --waitwhose mail is already waiting returns that message immediately (real mail handler, no mock).Keepalive and cancel-on-disconnect transport tests are kept; cap-only tests are deleted. Locally:
pnpm tc:node, oxlint, oxfmt,check:code-quality:changed, and the affected runtime test files (43 tests) pass. No live app run; macOS only for the unit tests.Review
Reviewed against #26549; the connection-budget wiring was removed as unnecessary.
Agent skill upstream boundary
Notes
runtime_busystays a valid reply, and clients keep handling it because older servers still send it. An older CLI against a newer runtime stops seeing it for waits; a newer CLI against an older runtime sees it as before.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)