Skip to content

fix(orchestration): prevent slow worker-start stalls - #16300

Merged
brennanb2025 merged 20 commits into
mainfrom
brennanb2025/sta-5235-impl
Aug 27, 2026
Merged

brennanb2025 merged 20 commits into
mainfrom
brennanb2025/sta-5235-impl

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1244 $\color{#cf222e}{\Huge{\mathbf{−}}}$​70 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1174
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​668 $\color{#cf222e}{\Huge{\mathbf{−}}}$​129 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​539

Summary

  • extend worker-start prompt-effect confirmation from 5 seconds to a shared 30-second budget, with nested local, paired, and federated transport deadlines
  • keep Unix-socket and Windows named-pipe transports alive while prompt confirmation is pending, and perform exactly one bounded federated contract preflight before effects
  • preserve exact mutation recovery identity across POSIX, PowerShell, cmd, WSL, SSH relay, and paired-runtime paths while blocking recovery output that contains pairing or Dispatch credentials

Reliability contract

  • Invariant (agent-session.prompt-confirmation): a submitted prompt that publishes a matching working lifecycle transition within 30 seconds must not be recorded as agent_prompt_stalled or have its Dispatch capability revoked. Permission, terminal-generation replacement, abort, and no transition by the exact deadline remain fail-closed.
  • Failure source: STA-5235; real Codex/Kimi cold starts published the first matching hook event after the former fixed five-second verifier had already failed the Dispatch.
  • Oracle: the verifier test publishes working after the former five-second deadline and must resolve; restoring the five-second constant makes it fail with agent_prompt_stalled. Budget, keepalive, and federation tests assert one status preflight, host verification, and strict verify < attach < client deadline 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.
  • Gate: accepted gap. Existing terminal-input.cli-agent-prompt-submit coverage 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.
  • Provider/platform coverage: local PTY/macOS is covered by deterministic tests and a live CDP flow. Unix sockets, Windows named pipes, WSL command identity, SSH relay identity, paired-runtime error propagation, and mixed-version wire behavior have deterministic coverage. Daemon PTY, live SSH/remote, live WSL, physical Windows/Linux delayed-hook startup, and mobile/relay are either unchanged or remain explicit live-evidence gaps; no RPC field or stream opcode changed.
  • Performance budget: one active submission may perform the existing constant-time activity read every 50 ms for at most 30 seconds. No global session listing, provider fanout, subprocess, renderer wake, persistence growth, retry loop, or new polling surface is added; federation removes a duplicate status preflight and all waits retain explicit stop conditions.
  • Diagnostics: failures retain the exact stage and error vocabulary, durable request/Dispatch identity, residual resources, and structured query/retry steps. Recovery output removes pairing codes and Dispatch capabilities instead of serializing a runnable command containing credentials.
  • Residual gaps: the Electron-headless Playwright fixture now deterministically covers delayed composer submission, swallowed Enter settling as agent_prompt_stalled without 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

  • 127 focused Vitest tests across verifier, budgets, keepalive, federation receipt validation, recovery, shell quoting, credential redaction, WebSocket propagation, and SSH passthrough
  • Node and CLI typechecks
  • ordinary and type-aware oxlint, formatting, and reliability-manifest validation
  • 19 WSL/Windows recovery tests and 5 cross-version wire tests
  • real source-built Electron/CDP Codex working → done flow with exact terminal response and matching hook-backed state
  • 3-case Electron-headless Playwright worker-start fixture (delayed submit, swallowed Enter, and permission block)

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.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 564874ab-47b8-4219-af5f-40067ff619c6

📥 Commits

Reviewing files that changed from the base of the PR and between 9e2b773 and e61d296.

📒 Files selected for processing (4)
  • src/main/runtime/rpc/methods/orchestration-federated-attach-receipt.test.ts
  • src/main/runtime/rpc/methods/orchestration-federated-attach-receipt.ts
  • src/main/runtime/rpc/methods/orchestration-federated-worker-start-receipt.test.ts
  • src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 33 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides detailed scope, rationale, reliability requirements, testing, platform coverage, performance constraints, and residual gaps. However, it does not follow the repository templat… Rewrite the description using the repository template. Add a valid issue reference such as Fixes #<issue>, include Visual Proof with attachments or an explicit N/A reason, complete the Testing checklist with tested platforms, complete t…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: preventing slow worker-start stalls through orchestration timing and transport changes.
Full details: Description check

Explanation

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 Fixes #&lt;issue&gt;, include Visual Proof with attachments or an explicit N/A reason, complete the Testing checklist with tested platforms, complete the Agent skill upstream boundary and general Checklist sections, and retain the existing technical details under the matching headings.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/cli/runtime/orchestration-recovery-command.ts (1)

30-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the parameter type.

string | unknown collapses to unknown, which is what the static analysis warning reports. Declare the parameter as unknown.

♻️ 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

📥 Commits

Reviewing files that changed from the base of the PR and between 08f5570 and 7f5d59f.

📒 Files selected for processing (23)
  • src/cli/index.ts
  • src/cli/orchestration-mutation-recovery.test.ts
  • src/cli/orchestration-mutation-recovery.ts
  • src/cli/runtime/client-recovery.test.ts
  • src/cli/runtime/client.ts
  • src/cli/runtime/orchestration-recovery-command.test.ts
  • src/cli/runtime/orchestration-recovery-command.ts
  • src/cli/runtime/websocket-transport-error.test.ts
  • src/cli/runtime/websocket-transport.ts
  • src/main/runtime/agent-prompt-submission-verification.test.ts
  • src/main/runtime/agent-prompt-submission-verification.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration-migration-behavior.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts
  • src/main/runtime/runtime-rpc-long-poll-transport.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/shared/orchestration-timing-budgets.test.ts
  • src/shared/orchestration-timing-budgets.ts
  • src/shared/remote-runtime-client-error.ts
  • src/shared/remote-runtime-shared-control-protocol.ts
  • tests/e2e/terminal-send-agent-prompt-submit.spec.ts
  • tests/tools/repro-terminal-send-submit.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/cli/runtime/client-recovery.test.ts Resolved
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review verification (2026-08-24): final Codex implementation review task_b2787e5c558e reported CLEAN on exact head 7f5d59f9fa4000c9526c853b5a989111af4aea3; focused suites, node/CLI typechecks, lint and formatting passed. GitHub CodeRabbit has three unresolved major findings (POSIX quote escaping, host-dependent executable assertion, and pairing-code redaction) at #16300 (comment), #16300 (comment), and #16300 (comment); required CI is also red (static analysis, Node 24/26 shards 10/14, verify). Review-loop verdict for merge gating is therefore NOT CLEAN; this comment does not claim merge readiness.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f5d59f and 4221792.

📒 Files selected for processing (8)
  • src/cli/handlers/orchestration-gate-cli.test.ts
  • src/cli/orchestration-mutation-recovery.test.ts
  • src/cli/orchestration-mutation-recovery.ts
  • src/cli/runtime/client-recovery.test.ts
  • src/cli/runtime/orchestration-recovery-command.test.ts
  • src/cli/runtime/orchestration-recovery-command.ts
  • src/main/ssh/ssh-remote-cli-host-passthrough.test.ts
  • src/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.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d60a3c9 and 76b3b39.

📒 Files selected for processing (35)
  • src/cli/handlers/orchestration-gate-cli.test.ts
  • src/cli/index.ts
  • src/cli/orchestration-mutation-recovery.test.ts
  • src/cli/orchestration-mutation-recovery.ts
  • src/cli/runtime/client-recovery.test.ts
  • src/cli/runtime/client.ts
  • src/cli/runtime/orchestration-recovery-command.test.ts
  • src/cli/runtime/orchestration-recovery-command.ts
  • src/cli/runtime/websocket-transport-error.test.ts
  • src/cli/runtime/websocket-transport.ts
  • src/main/daemon/pty-subprocess-foreground-degraded-scan.test.ts
  • src/main/runtime/agent-prompt-submission-verification.test.ts
  • src/main/runtime/agent-prompt-submission-verification.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/orchestration-federated-attach-receipt.ts
  • src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts
  • src/main/runtime/rpc/methods/orchestration-migration-behavior.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts
  • src/main/runtime/runtime-rpc-long-poll-transport.test.ts
  • src/main/runtime/runtime-rpc.ts
  • src/main/ssh/ssh-remote-cli-host-passthrough.test.ts
  • src/main/ssh/ssh-remote-cli-host-passthrough.ts
  • src/renderer/src/components/editor/rich-markdown-tab-key-handler.test.ts
  • src/renderer/src/components/skills/SkillBundleInstallFlow.tsx
  • src/renderer/src/components/skills/SkillInstallDialog.tsx
  • src/renderer/src/components/skills/SkillInstallManagementDialog.tsx
  • src/renderer/src/hooks/ipc-events/direct-ssh-hydration-fanout.test.ts
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/orchestration-timing-budgets.test.ts
  • src/shared/orchestration-timing-budgets.ts
  • src/shared/remote-runtime-client-error.ts
  • src/shared/remote-runtime-shared-control-protocol.ts
  • tests/e2e/terminal-send-agent-prompt-submit.spec.ts
  • tests/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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 76b3b39 and 9e2b773.

📒 Files selected for processing (2)
  • tests/e2e/terminal-send-agent-prompt-submit.spec.ts
  • tests/tools/repro-terminal-send-submit.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Exact-head review verification

Reviewed f3a2b9d6845aafce243ff378d718aa8fd37364c5 against origin/main in two review/fix rounds, including the complete changed-file scope and all six review threads; every thread is resolved. I rechecked federated receipt validation, timing and preflight nesting, credential redaction and recovery quoting, SSH/WSL/Windows execution boundaries, mixed-version wire behavior, and lifecycle/resource failure paths. One in-scope performance issue was proven and fixed: the 30-second verifier was rebuilding and scanning retained terminal wait text on every unchanged 50 ms poll; it now caches by PTY output sequence and invalidates when output advances, with deterministic regression coverage. No remaining in-scope findings; merge was not performed.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Exact-head QA and evidence

PASS at f3a2b9d6845aafce243ff378d718aa8fd37364c5. Local verification passed: 167 focused Vitest tests across 15 files; Node, CLI, and web typechecks; ordinary, native-plugin, and type-aware oxlint; formatting; reliability, max-lines, and runtime/Electron ratchets; plus the 3-case Electron-headless Playwright suite for delayed submit, swallowed Enter, and permission blocking. Fresh source-built Electron validation used Playwright CDP only and the exact review worktree: a real Codex turn visibly transitioned from Working to Done and rendered STA5235_ELECTRON_OK, while backing hook state advanced through revisions 2–5 and recorded the matching final assistant message. Exact-head GitHub CI is fully green (53 successful, 4 intentional skips), the PR is mergeable and non-draft, and all review threads are resolved; live physical Windows/Linux and SSH/WSL/relay delayed-hook flows remain the explicit evidence gaps, so the merge gate passes with those documented gaps and no merge was performed.

@OrcaWin

OrcaWin commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@brennanb2025

brennanb2025 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Independent exact-head review verification

Verified live PR head 35973e33fd1e359cc5e8c11044bef6413b90032e against current main fecdf0bde8850b81403df4609fbc98d0e805f31f. This review superseded the stale branch by merging current main, resolving the sole runtime-client-export-parity.test.ts conflict with the current-main export inventory, and removing unrelated formatting carryover. The resulting PR diff is focused at 34 files / +1912 −199; origin/main is an ancestor, git merge-tree --write-tree succeeds, GitHub reports MERGEABLE / CLEAN, and all six review threads are resolved.

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 pnpm tc, changed-code ordinary/type-aware/React quality checks with zero findings, oxfmt, max-lines, reliability manifest, and git diff --check. Failing-first evidence also proved the extended prompt-verification deadline: reverting it to the former five-second limit produced agent_prompt_stalled, while the restored 30-second limit passed. Exact-head CI is green at 53 successes / 4 intentional skips after one unrelated Node 24 persistence-test timeout passed on rerun; that exact test also passed three local Node 24 repetitions.

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 unverifiable, never treated as exited. No merge or Linear change was performed.

@brennanb2025

brennanb2025 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Independent exact-head QA + evidence

QA target: live final head 35973e33fd1e359cc5e8c11044bef6413b90032e, conflict-free with current main. Deterministic verification passed 13 changed files / 142 tests, eight focused reliability/state-machine files / 126 tests, full Node 24 typecheck, changed-code quality, format, max-lines, reliability manifest, and diff checks. Exact-head GitHub CI is fully green at 53 successes / 4 intentional skips, including Windows packaging and native smoke, cross-version wire compatibility, the changed Electron e2e suite, and Docker SSH watcher plus terminal-parking/startup-readiness journeys.

A separate exact-head source-built Electron instance was launched from this worktree and controlled only through Playwright CDP. App identity matched pr-16300-winwsl-review-r1 @ brennanb2025/pr-16300-exact-head-r1. A real retained-terminal prompt flow submitted the marker PR16300_EXACT_HEAD_35973E33 exactly once and rendered ORCA_TERMINAL_SEND_REPORT ok; backing evidence recorded contractOk: true, submitted: true, one Enter, zero premature or swallowed Enters, bracketed-paste framing present, rescueSent: false, and a still-connected/writable local terminal before scoped cleanup.

Exact-head retained terminal proof

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 unverifiable. QA verdict: PASS for deterministic, CI, local Electron/CDP, daemon/PTY retention, and containerized SSH startup-readiness evidence; incomplete for an unconditional strict physical-platform gate. No merge or Linear change was performed.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Independent Claude adversarial review — PR head f3a2b9d6845aafce243ff378d718aa8fd37364c5

Reviewed the live head independently, in a fresh child workspace, without relying on prior reports. Everything below was re-run locally on macOS; I have not reproduced anything on Windows/Linux/WSL/SSH and make no claims there.

What I independently verified

  • The oracle is non-vacuous. Restoring AGENT_PROMPT_EFFECT_TIMEOUT_MS to 5_000 makes exactly 2 tests fail with agent_prompt_stalled (accepts a working transition after the former five-second deadline, holds the extended hook window open past the former hook timeout). Reverting my edit restores green. The test genuinely pins the fix.
  • 136 focused tests pass across the verifier, timing budgets, federated receipts, migration behavior, mutation recovery, client recovery, recovery command, websocket transport error, gate CLI, long-poll transport, and SSH passthrough.
  • The e2e fixture passes against a real build of this branch — pnpm ensure:electron-runtime + Playwright electron-headless, all 3 cases green (23.2s / 55.6s / 24.9s): delayed composer submit, swallowed Enter settling as stalled without rescue, and permission block with zero prompt bytes.
  • pnpm tc exits 0.
  • The wire-compat claim holds. No new stream opcode and no new RPC field; the data plumbing in RemoteRuntimeClientError / toRemoteRuntimeClientError only forwards already-transmitted error payloads client-side.
  • The i18n/skill-dialog reformatting is safe. ko.json/zh.json are semantically identical before and after (12015 and 12035 leaf keys, zero added/removed/changed), and SkillBundleInstallFlow.tsx at the merge base genuinely fails oxfmt --check while the PR version passes — so this is formatting drift being corrected, not a revert of main. It is still unrelated scope that will conflict with any concurrent i18n PR.

Finding 1 — worker-start now counts against the long-poll cap, and can be refused with runtime_busy (undisclosed, untested)

classifyRuntimeLongPoll returning 'wait' does more than arm keepalive. In runtime-rpc.ts the classification feeds admitLongPoll before dispatch, so orchestration.workerStart and agent-prompt terminal.send now consume one of the 16 global long-poll slots (LONG_POLL_CAP = 16), shared with terminal.wait, orchestration.ask, orchestration.check --wait, and browser.clientHost.attach.

Reproduced both directions with a throwaway probe (longPollCap: 1, slot held by a blocking orchestration.check --wait, then one orchestration.workerStart):

  • This branch: {"code":"runtime_busy","message":"long-poll capacity reached; retry with backoff"}
  • Same probe with only the orchestration.workerStart branch removed from the classifier (pre-PR behavior): {"code":"consumer_fenced","message":"worker-start requires the coordinator terminal currently bound to the Task Run."} — i.e. it was admitted and dispatched.

This is fail-closed and safe — the refusal happens before dispatcher.dispatch, so no effects are applied and the message tells the caller to back off. It is a genuine improvement over an ambiguous teardown. But it is a new refusal path that the PR description does not mention, and the added tests cover only the keepalive intent (classifies worker-start as a keepalive-backed long poll, emits keepalives while orchestration.workerStart blocks) — nothing covers the admission-fence consequence.

Worth noting because worker-start now holds a slot for the 90–110s the code comment cites, and agent-prompt sends hold one for up to 30s. A coordinator fanning out workers while existing workers park on check --wait can plausibly reach 16. Suggest either a dedicated sub-cap/accounting for worker-start, or an explicit note plus a regression test pinning the runtime_busy behavior so it is a decision rather than a side effect.

Finding 2 — the blocked-recovery message states the wrong cause for every credential-bearing command

recoverableOrchestrationArgs correctly refuses to emit a retry command when argv contains --pairing-code or --dispatch-capability, and I confirmed no credential leaks into the message or data. But both that case and the genuinely-missing-command case collapse into one string. Exact output I reproduced for a worker's own orchestration send --dispatch-capability dcap_… --type worker_done:

Run orca orchestration worker-show --dispatch ctx_… --json before retrying.
Recovery is blocked until the exact original command is available; no retry command was emitted.

with recovery.recoveryBlocked: true and no reason code. The original command is available — it was suppressed because it carried a credential. orchestration.send, orchestration.ask, and orchestration.reply are all mutations, so this is the message on the single most common orchestration mutation there is (a worker reporting worker_done), and it also fires for any command run with the global --pairing-code flag — i.e. precisely the remote/paired callers most likely to hit an unknown outcome.

Nothing about safety requires the vagueness: "re-run your original command adding --retry-request <id>" is safe advice without printing the credential. Suggest a distinct reason code (e.g. recoveryBlockedReason: 'credential_in_command') and a message that says so, since the PR's own contract promises exact diagnostic vocabulary.

Finding 3 — the caching commit doubles the snapshot on every cache miss (minor)

In getAgentPromptActivity, readAgentPromptWaitText(..., () => this.getTerminalAgentStatusSnapshot(handle, ptyId).waitText) is immediately followed by this.getTerminalAgentStatusSnapshot(handle, ptyId, waitText). On a miss the snapshot is built twice per poll; on a hit once. Net win in the target scenario (a cold-starting agent emitting nothing, so the sequence is static and every poll hits), net loss while output is actively streaming. Correctness looks sound to me: the cache object is created fresh per submission so there is no cross-submission staleness, and the fail-closed guards (assertLiveTerminalHandleTargetsPty, terminal_not_writable / terminal_exited / terminal_gone) still run on the un-cached path every poll. I traced the pty.preview / tailBuffer writers looking for a mutation that bypasses the outputSequence bump and did not find one reachable on a live connected PTY mid-submission — the restore path writes an identical value or is guarded by length > 0. Flagging the double call only because the commit is labelled perf.

Verdict

Merge-ready. The central fix is real, the oracle is falsifiable, and it holds up against a real built runtime. Findings 1 and 2 are worth addressing — 1 as disclosure plus a regression test, 2 as a small diagnostics correction — but neither is a correctness or data-safety blocker, and both leave the system fail-closed. Finding 3 and the i18n reformat are non-blocking.

Not covered by me and still open per the PR's own residual-gaps list: live Windows/Linux delayed-hook startup, live SSH/WSL/relay, and daemon PTY.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Native Linux + real SSH QA — exact head f3a2b9d6845aafce243ff378d718aa8fd37364c5

Verdict: PASS from the Linux / SSH side. No in-scope defect found; no code edited. This targets the PR's own stated residual gaps: "no live delayed-hook capture was run on physical Windows/Linux or through SSH/WSL/relay." Both the physical-Linux and the live-SSH halves are now covered with real agents.

Environment. Ubuntu neil-ubuntu, kernel 7.0.0-28-generic, x86_64. Source-built Electron dev app, PR-head CLI (out/cli) and PR-head relay (out/relay/linux-x64) — no packaged/installed binaries in the loop. Real Codex 0.150.1 and real Claude Code 2.1.233. Driven via Playwright + CDP (port 9333) and the PR-head orca CLI; no computer-use / accessibility / OS-level input. Skill setup ran from the Linux equivalent of the requested path (/home/brennan/.orca-internal/eng/scripts/install-orca-skills.sh, linked 51 skills) — the /Users/brennanbenson/... path in the request does not exist on Linux.

Deterministic layer (Linux)

  • All 15 changed test files → 167/167 pass; pnpm tc exit 0; oxlint clean on the changed prod files.
  • Extra probe on the head commit's retained-tail cache (readAgentPromptWaitText): repeated reads served from cache, invalidation returns fresh text, a backwards sequence (PTY restart) invalidates, and '' caches without re-reading. Behavior is correct. Minor coverage note: the shipped unit test returns the same string on invalidation, so it cannot distinguish "fresh" from "retained" — worth a distinct value.

Live local PTY, real agents

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_stalled at ~34s wall (the new 30s budget), rescueSent: false; the longer budget does not mask a genuinely swallowed Enter
  • permission — agent_prompt_blocked in 2s with receivedBytes: 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 still running: 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 show still reported connected/writable: true while ssh.getState was already null. Writes correctly failed and nothing claimed death, and those snapshot fields are outside this diff (the PR only overrides waitText there).

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.Notifications daemon on this session bus. Each agent-task-complete notification then blocks the main process ~25s on a libnotify D-Bus timeout, leaving the runtime unresponsive and producing spurious CLI runtime_timeouts until I disabled notifications. The PR touches no notification code; this is a real native-Linux robustness gap.
  • Electron chrome-sandbox needed the standard root:root / 4755 fix 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.

@brennanb2025

brennanb2025 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head platform-evidence status (2026-08-27)

Rechecked live PR head 35973e33fd1e359cc5e8c11044bef6413b90032e. The previous merge-conflict blocker is resolved: current main is an ancestor, local merge-tree succeeds, GitHub reports mergeStateStatus: CLEAN / mergeable: MERGEABLE, all six review threads are resolved, and exact-head CI is green at 53 successes / 4 intentional skips.

Exact-head local source-built Electron/CDP evidence now shows the retained terminal submitting once with no rescue or premature Enter and rendering ORCA_TERMINAL_SEND_REPORT ok; the saved QA comment contains the uncropped screenshot and backing report. CI also passed Windows native smoke and packaging plus Docker SSH watcher/terminal-parking/startup-readiness, but these do not replace a physical Windows prompt run or a live WSL/real-SSH delayed-hook journey.

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 unverifiable, never inferred exited. Code-review verdict is CLEAN and conflict-free. No merge or Linear change was performed.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Exact-head physical-host QA — 35973e33fd1e359cc5e8c11044bef6413b90032e

This run closed the previously documented physical-host gaps without merging, approving, or changing Linear state.

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:

Windows exact-head Codex proof

WSL rendered proof:

WSL exact-head Claude proof

Real Docker/OpenSSH Codex 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.

@brennanb2025
brennanb2025 merged commit 913509e into main Aug 27, 2026
105 of 107 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 30, 2026
* 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)
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants