Repository navigation
fix(orchestration): prevent slow worker-start stalls - #16300
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe changes add orchestration mutation recovery commands with shell-aware rendering and credential filtering. Runtime errors preserve structured recovery metadata across local, remote, and WebSocket paths. Federated worker startup uses shared timing budgets, receipt validation, and contract verification. Worker-start and agent-prompt requests use long-poll handling with keepalives. End-to-end terminal tests create fake agents through runtime terminals. Several test, localization, and formatting-only updates are included. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides detailed scope, rationale, reliability requirements, testing, platform coverage, performance constraints, and residual gaps. However, it does not follow the repository template and omits the required linked issue, Visual Proof section or explicit N/A, checklist confirmations, and several required headings. Resolution Rewrite the description using the repository template. Add a valid issue reference such as ✨ Finishing Touches 💡 1📝 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/cli/runtime/orchestration-recovery-command.ts (1)
30-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify the parameter type.
string | unknowncollapses tounknown, which is what the static analysis warning reports. Declare the parameter asunknown.♻️ Proposed change
- executableOrParams?: string | unknown, + executableOrParams?: unknown,Source: Linters/SAST tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 49ac2177-c108-40b5-8463-4a83db1a98df
📒 Files selected for processing (23)
src/cli/index.tssrc/cli/orchestration-mutation-recovery.test.tssrc/cli/orchestration-mutation-recovery.tssrc/cli/runtime/client-recovery.test.tssrc/cli/runtime/client.tssrc/cli/runtime/orchestration-recovery-command.test.tssrc/cli/runtime/orchestration-recovery-command.tssrc/cli/runtime/websocket-transport-error.test.tssrc/cli/runtime/websocket-transport.tssrc/main/runtime/agent-prompt-submission-verification.test.tssrc/main/runtime/agent-prompt-submission-verification.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/orchestration-federated-worker-start.tssrc/main/runtime/rpc/methods/orchestration-migration-behavior.test.tssrc/main/runtime/rpc/methods/orchestration-worker-start-budgets.tssrc/main/runtime/runtime-rpc-long-poll-transport.test.tssrc/main/runtime/runtime-rpc.tssrc/shared/orchestration-timing-budgets.test.tssrc/shared/orchestration-timing-budgets.tssrc/shared/remote-runtime-client-error.tssrc/shared/remote-runtime-shared-control-protocol.tstests/e2e/terminal-send-agent-prompt-submit.spec.tstests/tools/repro-terminal-send-submit.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Review verification (2026-08-24): final Codex implementation review task_b2787e5c558e reported CLEAN on exact head |
|
QA evidence status (2026-08-24): manual Electron validation is NOT APPLICABLE to the reviewed change surface (orchestration timeout/recovery and CLI/runtime contracts; no rendered UI path was claimed by the implementation review). No screenshot or visual proof was captured, and no QA pass is claimed. This is a status/blocker note, not an evidence attachment; merge-ready remains false. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b683c7f6-efe4-4ee0-83f6-7845ab01fcf8
📒 Files selected for processing (8)
src/cli/handlers/orchestration-gate-cli.test.tssrc/cli/orchestration-mutation-recovery.test.tssrc/cli/orchestration-mutation-recovery.tssrc/cli/runtime/client-recovery.test.tssrc/cli/runtime/orchestration-recovery-command.test.tssrc/cli/runtime/orchestration-recovery-command.tssrc/main/ssh/ssh-remote-cli-host-passthrough.test.tssrc/main/ssh/ssh-remote-cli-host-passthrough.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8e7c4215-2183-45b9-abe4-09002e6ec3e0
📒 Files selected for processing (35)
src/cli/handlers/orchestration-gate-cli.test.tssrc/cli/index.tssrc/cli/orchestration-mutation-recovery.test.tssrc/cli/orchestration-mutation-recovery.tssrc/cli/runtime/client-recovery.test.tssrc/cli/runtime/client.tssrc/cli/runtime/orchestration-recovery-command.test.tssrc/cli/runtime/orchestration-recovery-command.tssrc/cli/runtime/websocket-transport-error.test.tssrc/cli/runtime/websocket-transport.tssrc/main/daemon/pty-subprocess-foreground-degraded-scan.test.tssrc/main/runtime/agent-prompt-submission-verification.test.tssrc/main/runtime/agent-prompt-submission-verification.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/orchestration-federated-attach-receipt.tssrc/main/runtime/rpc/methods/orchestration-federated-worker-start.tssrc/main/runtime/rpc/methods/orchestration-migration-behavior.test.tssrc/main/runtime/rpc/methods/orchestration-worker-start-budgets.tssrc/main/runtime/runtime-rpc-long-poll-transport.test.tssrc/main/runtime/runtime-rpc.tssrc/main/ssh/ssh-remote-cli-host-passthrough.test.tssrc/main/ssh/ssh-remote-cli-host-passthrough.tssrc/renderer/src/components/editor/rich-markdown-tab-key-handler.test.tssrc/renderer/src/components/skills/SkillBundleInstallFlow.tsxsrc/renderer/src/components/skills/SkillInstallDialog.tsxsrc/renderer/src/components/skills/SkillInstallManagementDialog.tsxsrc/renderer/src/hooks/ipc-events/direct-ssh-hydration-fanout.test.tssrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/orchestration-timing-budgets.test.tssrc/shared/orchestration-timing-budgets.tssrc/shared/remote-runtime-client-error.tssrc/shared/remote-runtime-shared-control-protocol.tstests/e2e/terminal-send-agent-prompt-submit.spec.tstests/tools/repro-terminal-send-submit.mjs
💤 Files with no reviewable changes (1)
- src/renderer/src/components/editor/rich-markdown-tab-key-handler.test.ts
🚧 Files skipped from review as they are similar to previous changes (22)
- src/main/ssh/ssh-remote-cli-host-passthrough.ts
- src/shared/remote-runtime-client-error.ts
- src/shared/orchestration-timing-budgets.test.ts
- src/cli/runtime/orchestration-recovery-command.test.ts
- src/main/runtime/rpc/methods/orchestration-migration-behavior.test.ts
- src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts
- src/cli/orchestration-mutation-recovery.ts
- src/cli/index.ts
- src/cli/runtime/websocket-transport.ts
- src/main/ssh/ssh-remote-cli-host-passthrough.test.ts
- tests/tools/repro-terminal-send-submit.mjs
- src/cli/runtime/websocket-transport-error.test.ts
- src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts
- src/shared/orchestration-timing-budgets.ts
- src/cli/runtime/client-recovery.test.ts
- src/shared/remote-runtime-shared-control-protocol.ts
- src/main/runtime/runtime-rpc-long-poll-transport.test.ts
- src/cli/runtime/orchestration-recovery-command.ts
- src/cli/runtime/client.ts
- src/cli/handlers/orchestration-gate-cli.test.ts
- src/cli/orchestration-mutation-recovery.test.ts
- src/main/runtime/orca-runtime.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a34d665-c2ab-489d-ad3b-a2cbe7d31bc0
📒 Files selected for processing (2)
tests/e2e/terminal-send-agent-prompt-submit.spec.tstests/tools/repro-terminal-send-submit.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Exact-head review verificationReviewed |
Exact-head QA and evidencePASS at |
|
Windows high-spec QA (2026-08-26) — BLOCK / do not merge yet. Checked out live head f3a2b9d on AWIN (Windows 10 Pro build 26200; Orca 1.4.191-adhoc.20260826221547): real native Codex 0.149.1 and Claude Code 2.1.247 prompt submissions both completed and returned their exact markers, with repeated terminal reads before/after completion. Unit verification passed (20/20), but the exact-head Electron Playwright prompt-submit fixture fails on Windows before exercising the flow: fake Codex is not recognized (foregroundProcess=null, 30s) across a clean rerun; required /Users/brennanbenson skill installer and $electron/CDP visual-proof tooling were unavailable, so no screenshot/restart evidence; full e2e typecheck also has numerous unrelated errors. |
Independent exact-head review verificationVerified live PR head The same-model review loop returned CLEAN. Independent verification passed all 13 changed deterministic suites / 142 tests, the eight focused reliability/state-machine suites / 126 tests, full Node 24 No proven in-scope production defect remains across worker-start timing/recovery, federated receipts, delayed prompt verification, daemon-owned PTY retention, quoting/redaction, wire compatibility, SSH/WSL boundaries, folder workspaces, lifecycle, or performance. Review verdict: code CLEAN and conflict-free. The strict merge-evidence verdict remains HOLD only because no current-head physical Windows, live WSL/relay, or real remote SSH host run was available; those paths are |
Independent exact-head QA + evidenceQA target: live final head A separate exact-head source-built Electron instance was launched from this worktree and controlled only through Playwright CDP. App identity matched This screenshot is uncropped real-app evidence for the local macOS retained-terminal path, not a claim about another host. Physical Windows, live WSL/relay, and real remote SSH were not exercised on this exact head because the reachable remote workspaces were on older SHAs; current-head results for those environments remain |
Independent Claude adversarial review — PR head
|
Native Linux + real SSH QA — exact head
|
| scenario | result |
|---|---|
| Codex, idle → submit | accepted 1.70s, working→done, exact ORCA_LINUX_QA_16300_CODEX_OK; UI treeitem read Done |
| Claude, idle → submit | accepted 1.71s, exact ORCA_LINUX_QA_16300_CLAUDE_OK |
submit while already working (observedDeliveryEvidence) |
accepted 7.35s |
Failure modes via the PR's own repro-terminal-send-submit.mjs, all three correct on Linux:
- normal —
contractOk true,submitted true,rescueSent false, 1 Enter, 0 swallowed, bracketed-paste framed - swallowed Enter —
agent_prompt_stalledat ~34s wall (the new 30s budget),rescueSent: false; the longer budget does not mask a genuinely swallowed Enter - permission —
agent_prompt_blockedin 2s withreceivedBytes: 0,receivedEnters: 0(fail-closed, no bytes leaked into the dialog)
Supervised worker-start (the actual STA-5235 path)
state: ready, stage: input_accepted, exit 0, 3.72s, residualResources: []. Dispatch settled completed / succeeded / settled, failure_count: 0, capability revoked at completion. worker-read renders the transcript with the credential elided as [dispatch capability redacted] — the PR's redaction hardening confirmed live.
Restart / reconnect
App killed and relaunched: 4 terminals rehydrated with new handles; a pre-restart handle was correctly refused terminal_handle_stale (no bytes written into the new incarnation); fresh Codex submission post-restart accepted in 1.75s.
Real SSH → Linux (the PR's largest stated gap)
Real OpenSSH execution host with the PR-head relay deployed (status: connected, remotePlatform: linux); terminal executionHostId: ssh:…, hostPlatform: linux, running real Codex.
- SSH submission accepted 1.76s → exact
ORCA_SSH_LINUX_16300_OK - Boundary truthfulness: disconnected SSH mid-turn. The send was refused
terminal_not_writable— Orca never claimed the remote process exited. After reconnect the remote Codex was still counting (32→37) and stillrunning: loss of contact was demonstrably not death. - Post-reconnect submission accepted 1.76s →
ORCA_SSH_RECONNECT_16300_OK - Neighboring observation, not attributed to this PR: for ~12s after disconnect
terminal showstill reportedconnected/writable: truewhilessh.getStatewas alreadynull. Writes correctly failed and nothing claimed death, and those snapshot fields are outside this diff (the PR only overrideswaitTextthere).
Folder workspace (non-git)
kind: 'folder' workspace, Codex terminal, submission accepted 1.74s → exact ORCA_FOLDERWS_16300_OK.
Electron-headless Playwright fixture — pre-existing on Linux, not a regression
tests/e2e/terminal-send-agent-prompt-submit.spec.ts fails 2 of 3 on Linux at PR head (the two that actually write prompt bytes; the zero-byte permission test passes). The failures surface as bare Error: Command failed with empty stdout/stderr because the spec's execFileAsync({ timeout: … }) kills the child, discarding its output. Re-running a copy with raised timeouts surfaces the real cause: the child dies on CLI runtime_timeout ("Timed out waiting for the Orca runtime to respond").
I ran the same spec on origin/main: identically 2 failed / 1 passed. So on Linux this fixture failure predates the PR. This is the same fixture the Windows QA comment blocked on — on Linux it is not PR-attributable. (I can't speak to the distinct Windows symptom of foregroundProcess=null / fake Codex unrecognized.) Suggest a separate ticket; surfacing the child's stdout/stderr on timeout would have made this far cheaper to diagnose in both runs.
Environment blockers worth their own ticket (not PR-caused)
- No
org.freedesktop.Notificationsdaemon on this session bus. Eachagent-task-completenotification then blocks the main process ~25s on a libnotify D-Bus timeout, leaving the runtime unresponsive and producing spurious CLIruntime_timeouts until I disabled notifications. The PR touches no notification code; this is a real native-Linux robustness gap. - Electron
chrome-sandboxneeded the standardroot:root/4755fix in a fresh dev worktree on Linux.
Not covered
Live WSL, physical Windows, mobile/relay, and daemon-PTY delayed-hook startup. No RPC field or stream opcode changed, so no mixed-version wire risk was introduced.
Screenshots captured locally (rendered app, not mocks): Codex working→done with the exact token; the SSH-host pane showing the first SSH token, the count continuing across the disconnect window, and the post-reconnect token, alongside the local and folder-workspace projects.
Exact-head platform-evidence status (2026-08-27)Rechecked live PR head Exact-head local source-built Electron/CDP evidence now shows the retained terminal submitting once with no rescue or premature Enter and rendering Strict platform-evidence verdict: HOLD. Reachable Windows, WSL, and SSH workspaces were on older SHAs, so no current-head physical Windows, WSL/relay, or real remote SSH result is claimed; those paths remain |
…-exact-head-r1 # Conflicts: # src/shared/runtime-client-export-parity.test.ts
Exact-head physical-host QA —
|
| Arm | Verdict | Exact-head evidence |
|---|---|---|
| Windows | VERIFIED — live | Physical Windows high-spec saved environment, clean detached worktree C:/Users/neil/orca/workspaces/orca/pr-16300-windows-wsl-qa-r1, source runtime 34eecf52-7cce-4869-bd30-c3353db7b80d, Playwright CDP on port 9440. Exact-head terminal send accepted 74 bytes in 2.328s; real Codex 0.149.1 returned PR16300_WIN_EXACT_35973E33_OK, the rendered workspace reached Done, and focused exact-head suites passed 27/27. |
| WSL/relay | VERIFIED — live | The same physical host exposed running WSL2 distro Ubuntu-24.04; argv was built with buildWslExecArgs and contained -d Ubuntu-24.04 --exec, and parsed output was fenced with buildWslCapturedLoginShellCommand. The exact-head runtime created WSL PTY term_36e46ab5-a83f-48ef-b945-b93aab5db8fe; exact-head terminal send accepted 69 bytes and real Claude Code 2.1.246 returned PR16300_WSL_CLAUDE_EXACT_35973E33_OK in 1s. |
| SSH | VERIFIED — live | Exact-head Electron/Playwright ran against a disposable Docker OpenSSH Debian target with a real Git repo, deployed out/relay/linux-x64/relay.js, and real remote Codex 0.141.0. The scoped journey passed (1 passed (1.5m)); container, key, and copied auth were removed by fixture cleanup. |
| Delayed hook | VERIFIED — live | In that disposable SSH target only, the managed Codex hook was prefixed with an intentional 8-second delay (past the former 5-second deadline). The real remote Codex journey completed through the hook-driven Working state and the exact-head Playwright assertion passed; the temporary harness change was reverted and the checkout is clean at the SHA above. |
Windows rendered proof:
WSL rendered proof:
Real Docker/OpenSSH Codex proof:
Two environment notes are intentionally disclosed. The first WSL Codex attempt reached Working but stopped with the exact host error Missing environment variable: CODEX_LB_API_KEY; the live WSL arm was then completed with real Claude rather than treating that agent failure as host death. During that first attempt, a stale Playwright ref caused the WSL Codex updater's default choice to run, changing the Orca-managed WSL Codex from 0.148.0 to 0.150.1; no rollback was attempted.
Cleanup was exact-PID/scoped: the recorded Windows source runner PID 42572 was command-line verified before stopping, its exact crashpad/daemon remnants (67556/125032) were separately verified and stopped, and the Playwright session was closed. The isolated Windows profile was removed except three locked queue_1.sqlite{,-shm,-wal} files retained by an unidentified process; no broad process kill was used.
* Extend orchestration agent submission timing budgets * fix(orchestration): preserve mutation recovery identity * fix(orchestration): preserve recovery executable identity * fix(orchestration): keep worker starts and recovery commands safe * test(orchestration): cover federated worker preflight * fix(orchestration): harden mutation recovery * fix(orchestration): redact dispatch recovery credentials * chore: preserve upstream skill dialog formatting * test(orchestration): stabilize agent prompt submit e2e * fix(orchestration): validate federated start receipts * perf(runtime): cache unchanged prompt verification tail * fix(orchestration): reject worker-start timer overflow * fix(orchestration): normalize worker-start timeout defaults * fix(orchestration): normalize worker-start readiness budgets * fix(orchestration): normalize federated readiness timeout * test(runtime): tolerate current-main degradation exports * chore: preserve current-main orcad formatting * chore: drop unrelated formatting carryover (cherry picked from commit 913509e)
* Extend orchestration agent submission timing budgets * fix(orchestration): preserve mutation recovery identity * fix(orchestration): preserve recovery executable identity * fix(orchestration): keep worker starts and recovery commands safe * test(orchestration): cover federated worker preflight * fix(orchestration): harden mutation recovery * fix(orchestration): redact dispatch recovery credentials * chore: preserve upstream skill dialog formatting * test(orchestration): stabilize agent prompt submit e2e * fix(orchestration): validate federated start receipts * perf(runtime): cache unchanged prompt verification tail * fix(orchestration): reject worker-start timer overflow * fix(orchestration): normalize worker-start timeout defaults * fix(orchestration): normalize worker-start readiness budgets * fix(orchestration): normalize federated readiness timeout * test(runtime): tolerate current-main degradation exports * chore: preserve current-main orcad formatting * chore: drop unrelated formatting carryover




Summary
Reliability contract
agent-session.prompt-confirmation): a submitted prompt that publishes a matching working lifecycle transition within 30 seconds must not be recorded asagent_prompt_stalledor have its Dispatch capability revoked. Permission, terminal-generation replacement, abort, and no transition by the exact deadline remain fail-closed.workingafter the former five-second deadline and must resolve; restoring the five-second constant makes it fail withagent_prompt_stalled. Budget, keepalive, and federation tests assert one status preflight, host verification, and strictverify < attach < clientdeadline nesting. A source-built macOS Electron run with real Codex 0.149.1 visibly transitioned from working to done and returned the expected terminal output while CDP backing state recorded hook revisions 2 and 3.terminal-input.cli-agent-prompt-submitcoverage protects PTY delivery, but the reliability manifest has no dedicated composed worker-start late-hook gate yet; the deterministic verifier, transport, federation, and recovery tests are the PR-local protection.agent_prompt_stalledwithout rescue, and permission blocking with zero prompt bytes. No live delayed-hook capture was run on physical Windows/Linux or through SSH/WSL/relay.Verification
Scope
The timing and transport changes implement STA-5235. Recovery hardening is limited to preserving unknown-outcome identity across the same mixed-version/provider paths without exposing credentials or inferring worker death.