Skip to content

fix(cli): negotiate agent launches with paired runtimes - #32029

Merged
nwparker merged 2 commits into
mainfrom
nwparker/paired-cli-agent-launch
Oct 23, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/paired-cli-agent-launch

Conversation

@nwparker

@nwparker nwparker commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​104 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​103
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13

ELI5

What was broken: If you ran orca agent launch or orca worktree create --agent ... from your laptop against a paired remote Orca (--environment <name>), it failed straight away with agent_launch_replay_unsupported and no agent started. Running the same command on the host itself worked.

Why: When the CLI connects to a paired host it sends a list of what it understands. The host only lets callers that say "I understand agent.launch.v2" start agents through the new launch method. The local socket CLI is exempt from that check. The paired CLI never sent that entry, so the host refused it.

What changes for you: The paired CLI now sends agent.launch.v2, so remote agent launches work again. You get the same result you'd get running the command on the host.

What Changed

  • src/cli/runtime/websocket-transport.ts: both CLI WebSocket request paths (plain and status-preflight) send agent.launch.v2 through the shared transport's existing per-caller capability argument. A single CLI_CLIENT_CAPABILITIES constant keeps the two paths in sync.
  • tests/e2e/paired-cli-agent-launch.unit.test.ts: starts a real runtime RPC server with runtime-scope pairing and encrypted WebSocket, using the real launch handlers and the durable launch ledger. It covers agent.launch and agent.launchReplay on both request paths, for existing worktrees, new git worktrees and new folder workspaces. Replaying an operation returns the saved result and does not start a second agent.

Verification

Real paired host (omarchy, Linux, --environment omarchy, host advertises agent.launch.replay-required.v1):

Command Installed CLI 1.4.238 (no fix) CLI built from this PR
orca agent launch --environment omarchy --worktree id:<phase3-smoke> --agent claude --prompt "Reply with exactly: PRREV32029 OK" agent_launch_replay_unsupported ok: true, terminal agent started, prompt handed-to-terminal, Claude replied PRREV32029 OK
Same command plus --retry-launch <operationId> n/a Returned the same handle. Still one terminal in the worktree, no second agent
orca worktree create --environment omarchy --repo id:<test repo> --name prrev-32029 --no-parent --agent claude --prompt ... (the issue's command) same refusal path Worktree created, agent started, Claude replied PRREV32029 WT OK

All scratch terminals and the prrev-32029 worktree were closed or removed afterwards.

Real Windows hosts (CLI on macOS, built from this PR, talking to paired Windows Orca):

Host Command Installed CLI 1.4.238 (no fix) CLI built from this PR
awin (Windows, Orca 1.4.237, advertises agent.launch.replay-required.v1) orca agent launch --environment awin --worktree id:<prrev-32029-win> --agent claude --surface terminal --prompt "Reply with exactly: PRREV32029 WIN OK" agent_launch_replay_unsupported ok: true, terminal agent, prompt handed-to-terminal, Claude replied PRREV32029 WIN OK
awin same plus --retry-launch <operationId> n/a Same handle back. The worktree still had only its default Git Bash tab plus the one agent
awin orca worktree create --environment awin ... --no-parent --agent claude --surface terminal --prompt ... n/a Worktree created, agent started, Claude replied PRREV32029 WT OK
win-lowspec (Windows, Orca 1.4.205, older, no agent.launch) orca worktree create --environment win-lowspec ... --agent claude --prompt ... n/a ok: true, used the old startupAgent path, returned agentTerminalHandle, and a PowerShell terminal ran claude (that machine's own Claude install is broken, which has nothing to do with this PR)
win-lowspec orca agent launch --environment win-lowspec ... incompatible_runtime "Update Orca on the execution host" Same incompatible_runtime message, so nothing regressed

On awin itself (Git Bash in a throwaway worktree on this PR's head 7fe6433b): pnpm test tests/e2e/paired-cli-agent-launch.unit.test.ts src/cli/runtime/websocket-transport.test.ts gives 20/20 passing on Windows. All throwaway worktrees and terminals on both Windows hosts were removed afterwards.

Mixed versions: status and worktree list from the PR CLI succeed against openclaw and m4air (new hosts) and win-lowspec (an older Windows host without agent.launch). Older hosts ignore the extra capability string, and the CLI keeps using worktree.create + startupAgent on hosts that don't advertise agent.launch.v2.

Automated: pnpm test tests/e2e/paired-cli-agent-launch.unit.test.ts src/cli/runtime/websocket-transport.test.ts gives 20/20 passing. With websocket-transport.ts reverted to main, all 12 integration cases fail with agent_launch_replay_unsupported. pnpm build:cli (CLI typecheck) passes, and oxlint/oxfmt are clean.

Risks / Tradeoffs

  • The host can now hand a paired CLI a structured chat outcome (outcome.kind: 'structured') when the host's Chat UI setting prefers chats for Claude or Codex. The local socket CLI already gets that, and the CLI prints the handle and receipt for either outcome. So this matches what you get on the host, not a new behaviour.
  • The paired CLI still does not advertise agent.launch.prompt-unconfirmed.v1 or agent.launch.tab-closed.v1. If a replay hits a host that stopped mid-delivery, or a tab the user closed, the paired CLI gets the conservative agent_session_operation_unknown instead of the more specific answer the local CLI gets. That fails safe, and it's left out of scope.
  • A paired CLI connecting now also triggers the host's launch-record warmup (noteAgentLaunchClientReady), the same as the desktop renderer does. It runs once and is cheap.
  • No host rules, RPC schemas, shared transport defaults or mobile code change.

Visual Proof

N/A: this is a headless CLI transport change with no UI. The terminal outputs above are the proof.

Related

Fixes #30800. Thanks to @marijnbakker2 for the issue, which pinpointed the missing client capability. No external contributor PRs exist for this.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a7268fd-1835-418e-8935-a183d1917403
📥 Commits

Reviewing files that changed from the base of the PR and between ca6ee1e and 7fe6433.

📒 Files selected for processing: 1
  • src/cli/runtime/websocket-transport.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The WebSocket transport now passes AGENT_LAUNCH_RUNTIME_CAPABILITY in standard and status-preflight requests. The authenticated capability-list test expects this capability. New paired CLI tests cover agent.launch and agent.launchReplay across three target types, with and without status preflight.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 7fe64

The paired CLI launch capability negotiation is implemented and covered across the relevant launch paths.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding capability negotiation for agent launches through paired runtimes.
Linked Issues check Passed Issue #30800 requires paired CLI agent launches to start in existing and newly created workspaces. The PR adds agent.launch.v2 through CLI_CLIENT_CAPABILITIES on both WebSocket request paths in `s…
Out of Scope Changes check Passed The changes are limited to CLI WebSocket capability negotiation, its transport expectation, and focused paired-CLI launch tests. These changes directly support issue #30800. No unrelated product area …
Description check Passed The description is detailed and covers the problem, user impact, implementation, linked issue, visual proof, verification results, risks, compatibility, and automated tests. It uses alternative headin…
Full details: Linked Issues check

Explanation

Issue #30800 requires paired CLI agent launches to start in existing and newly created workspaces. The PR adds agent.launch.v2 through CLI_CLIENT_CAPABILITIES on both WebSocket request paths in src/cli/runtime/websocket-transport.ts. The regression tests cover agent.launch and agent.launchReplay for existing worktrees, new git worktrees, and new folder workspaces. The tests also verify replay reuse without a second agent.

Full details: Out of Scope Changes check

Explanation

The changes are limited to CLI WebSocket capability negotiation, its transport expectation, and focused paired-CLI launch tests. These changes directly support issue #30800. No unrelated product area is changed.

Full details: Description check

Explanation

The description is detailed and covers the problem, user impact, implementation, linked issue, visual proof, verification results, risks, compatibility, and automated tests. It uses alternative headings such as “Verification” and “Related” instead of the template’s “Testing” and “Linked Issue” headings, and it omits the checklist, AI Disclosure, Review, Agent skill upstream boundary, and Notes sections. These omissions are non-critical because the required information is substantially present.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker
nwparker merged commit ab1563e into main Oct 23, 2026
39 checks passed
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.

CLI agent launch over a paired environment fails with agent_launch_replay_unsupported (1.4.230)

1 participant