Skip to content

fix(orchestration): launch remote workers as host-owned agent sessions - #28975

Draft
brennanb2025 wants to merge 15 commits into
mainfrom
brennanb2025/wslchat-pr11
Draft

brennanb2025 wants to merge 15 commits into
mainfrom
brennanb2025/wslchat-pr11

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​650 $\color{#cf222e}{\Huge{\mathbf{−}}}$​66 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​584
Prod 32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​768 $\color{#cf222e}{\Huge{\mathbf{−}}}$​343 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​425

ELI5

Starting a worker on another Orca server always opened a terminal, even when the user preferred native chat and that server could run it. Federation assumed every worker was a terminal; simply removing that assumption still left headless servers choosing from their own hidden chat setting. Workers now follow the dispatching coordinator's chat preference, while the server running the worker checks whether it can create the chat there.

What Changed

Capable servers use the existing agent launch executor and saved agent-session identity for existing folder workspaces, existing worktrees, and new top-level worktrees. Initial task delivery, mail, questions, status, output, stop, release, and recovery follow that identity. A lost reply after an accepted launch is reconciled through its saved dispatch rather than creating another worker.

The coordinator carries its preference in the existing optional nativeChatDefault launch field, using the existing client launch-mode capability alongside federation's agent-session capability. The receiving host passes it to the shared executor and retains its own provider, workspace, and admission checks. Older peers keep their existing terminal contract, and the receipt reports the terminal surface and the coordinator's preferred mode honestly.

New worktrees use the same launch-input mapping as local workers, so setup and configured terminals see the promised chat before the workspace is published. If chat creation fails after workspace creation, the existing recovery-shell path remains available. Definite start failures use the shared chat-close operation: confirmed cleanup removes the chat from saved residual resources, while an unproven close restores the tab and retains the resource entry. Uncertain delivery preserves the session for recovery.

Why

The caller supplies launch intent and the execution host owns admission, session identity, and replay. Reusing Orca's existing paired-launch preference field and shared worker executor removes the terminal assumption without a separate WSL preference policy, provider wrapper, or orchestration store. Intended compatibility difference: older peers retain terminal execution because their existing contract cannot represent structured workers. Intended existing-chat behavior: a chat worker runs every configured terminal command alongside its chat; a terminal worker occupies the first configured terminal and skips that terminal command. Failed-start cleanup also uses the same corrected shared close path for local workers.

No WSL mover modules were changed. Existing WSL-host availability gates still apply. This PR uses the existing connected-host and visible-work path; it adds no wake demand for a stopped WSL host without visible work. Temporary follow-up: worker-start wake demand uses #28972's existing connection-demand mechanism; current refusals tell the user to open a host project or reconnect the host in Settings → Remote Orca Servers.

Linked Issue

Internal WSL native-chat plan, PR 11; builds on #27746.

Visual Proof

Required Windows/WSL Electron comparison and screenshots are pending with the coordinator. This changes the worker surface selected by existing orchestration commands, including setup and configured-terminal behavior.

Testing

  • Automated contracts cover capable and older peers, opposing coordinator/receiver chat preferences, saved session identity, a lost accepted reply, and failure compensation including residual resources.
  • Current head e3239a9cdd05a6e84585de862ac6537e3fa95675: PR Checks 38811447122 completed successfully and all substantive jobs passed, but PR checks passed was skipped by the workflow success fast path. The strict aggregate-success readiness condition remains unmet.
  • Exact-head Windows/WSL Electron comparison and screenshots are queued with the coordinator; SSH receiver regression was not run because the available host rejected the key.

Live Windows/WSL testing on the earlier head be102df471f recorded 10 passes across structured Claude/Codex workers, same-host workers, existing/new workspaces, initial prompt/mail/question/reply/status, stop/release, lost-reply reconciliation, failed setup, old-peer terminal receipts, and stopped-host refusal. That run reached structured workers only after manually enabling chat in the guest profile; this follow-up removes that requirement, so the coordinator-preference scenario needs a fresh run with the guest default left off. The run also found a separate host-restart pairing failure that makes saved dispatches unavailable; that issue is being fixed in a separate PR and is unchanged here.

Validation used CI and the staged-file pre-commit hook; no standalone local lint, typecheck, test or build ran. The first follow-up CI attempt identified only a file-length violation, corrected by moving unchanged protocol-version selection beside its existing capability constants.

Review

Full independent review covered caller preference ownership, execution-host admission, SSH and folder workspaces, mixed-version negotiation, saved-identity reconciliation, setup and cleanup evidence. Two confirmed review findings were repaired through the shared launch and close mechanisms. The inherited resource-recording gap remains owned by #20805; deterministic task-title metadata parity and a partial-capability concern remain deferred. Final production review found no new issues; later fixture-only corrections were checked against their CI failures without changing the original assertions. All substantive current-head CI jobs pass, but the aggregate was deliberately skipped. Windows/WSL screenshots and SSH evidence remain required before readiness; the review status comment records the exact limits.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No provider-specific launch wrapper or new stream opcode. Remote loss of contact remains unverifiable.

Checklist

  • Focused on cross-server worker sessions
  • Explained the problem, user-facing change, mechanism, and approach
  • No new interface components
  • Self-reviewed correctness and ownership
  • Considered cross-platform, SSH, folder workspaces, and compatibility
  • Exact-head full CI and Windows re-check complete

@brennanb2025

brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Starting a worker on another Orca server ignored the coordinator's chat preference and opened a terminal. Launch and cleanup assumed a terminal worker, which also caused an extra shell during setup and could hide a chat when failed-start cleanup could not close it. This PR lets a capable server own a chat worker while older peers keep terminal execution.

Two review findings are fixed at e3239a9cdd05a6e84585de862ac6537e3fa95675:

  • New worktrees declare the incoming chat through the same workspace path as local workers. Setup and configured terminal tabs are preserved without an incidental plain shell, and the existing recovery shell remains available if chat creation fails.
  • Failed-start cleanup uses normal chat close and rollback. When that operation cannot finish, chat access and the record of created resources are retained; completed cleanup removes the chat from that record.

A fresh second review verified both repairs and main integration with no new findings. Later test-only corrections brought existing partial session-host fixtures up to the shared close contract, including released ownership and observed exit; original assertions and production behavior are unchanged. The final seven-area readiness audit found no new proven issue and ran from /Users/brennanbenson/orca/orca-internal/eng/skills/readiness-checklist/SKILL.md and its companions, with counsel skipped.

Deferred: a pre-existing error after worktree creation can omit that worktree from the error report (#20805); remote chats do not look up the coordinator's task title directly and can generate a title instead; and a compatibility concern involving partial advertised support has no identified affected released version. Stopped-host wake demand remains temporary under #28972. Intended existing-chat behavior: all configured terminal commands run alongside chat, while a terminal agent occupies the first configured terminal and skips its command.

PR Checks 38811447122 completed successfully for e3239a9cdd05a6e84585de862ac6537e3fa95675. All five unit-test shards, static analysis/typecheck, cross-version wire compatibility, relay integration, Linux/Windows packaging and test-selection evidence passed. The workflow's PR checks passed aggregate was skipped by its intentional success fast path; that is not an aggregate success result. No failed job remains, and CI was not rerun without a change.

Not ready to merge: the required aggregate-success condition is unmet because the aggregate was skipped; exact-head Windows/WSL Electron comparison, fault-path checks and screenshots also remain with the coordinator. Earlier Windows results apply to an older head. SSH regression was not run because the available host rejected the key. The final snapshot is mergeable with merge state CLEAN and no unresolved review threads. The PR remains in draft; no final runtime pass is claimed.

@OrcaWin

OrcaWin commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Windows QA for head e3239a9 (Windows high spec, real signed-in Claude Code 2.1.302 inside a throwaway WSL2 distro, Codex driving the UI over CDP)

  • D1 forced setup failure PASS: the project's setup was set to finish before the agent starts and the setup script exited with an error. Starting a worker on the WSL host failed at the setup wait step. Only the new worktree and the setup terminal were listed as leftovers, with no chat or agent session (the receipt and the host's own record agree). Note: with the default start-immediately setting, the setup failed but the worker started anyway and succeeded, so no failed start happened.
  • D2 older host PASS: with the distro running the older server, the receipt reported mode terminal, preferred structured, reason remote_execution_host ("Started a terminal agent worker through the older federation contract."). The real Claude worker wrote D2=2310 and finished as succeeded.
  • D3 stop then release FAIL: a structured worker on the current host stopped correctly (process stopped), but releasing it was refused. It is still retained with reason identity_unproven, and the host still lists the worker's session as a leftover. This is the same result as the batch-2 run.

Setup failed on the WSL host (only the setup terminal, no chat):
28975-D1b-3-setup-failed.png

Older-host worker running as a terminal agent and finishing:
28975-D2-6-worker.png

This branch has not been deployed

No deployments
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