You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): negotiate agent launches with paired runtimes - #32029
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):
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.
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: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
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 checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly identifies the main change: adding capability negotiation for agent launches through paired runtimes.
Linked Issues check
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
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
What was broken: If you ran
orca agent launchororca worktree create --agent ...from your laptop against a paired remote Orca (--environment <name>), it failed straight away withagent_launch_replay_unsupportedand 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) sendagent.launch.v2through the shared transport's existing per-caller capability argument. A singleCLI_CLIENT_CAPABILITIESconstant 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 coversagent.launchandagent.launchReplayon 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 advertisesagent.launch.replay-required.v1):orca agent launch --environment omarchy --worktree id:<phase3-smoke> --agent claude --prompt "Reply with exactly: PRREV32029 OK"agent_launch_replay_unsupportedok: true, terminal agent started, prompthanded-to-terminal, Claude repliedPRREV32029 OK--retry-launch <operationId>orca worktree create --environment omarchy --repo id:<test repo> --name prrev-32029 --no-parent --agent claude --prompt ...(the issue's command)PRREV32029 WT OKAll scratch terminals and the
prrev-32029worktree were closed or removed afterwards.Real Windows hosts (CLI on macOS, built from this PR, talking to paired Windows Orca):
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_unsupportedok: true, terminal agent, prompthanded-to-terminal, Claude repliedPRREV32029 WIN OK--retry-launch <operationId>orca worktree create --environment awin ... --no-parent --agent claude --surface terminal --prompt ...PRREV32029 WT OKagent.launch)orca worktree create --environment win-lowspec ... --agent claude --prompt ...ok: true, used the oldstartupAgentpath, returnedagentTerminalHandle, and a PowerShell terminal ranclaude(that machine's own Claude install is broken, which has nothing to do with this PR)orca agent launch --environment win-lowspec ...incompatible_runtime"Update Orca on the execution host"incompatible_runtimemessage, so nothing regressedOn 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.tsgives 20/20 passing on Windows. All throwaway worktrees and terminals on both Windows hosts were removed afterwards.Mixed versions:
statusandworktree listfrom the PR CLI succeed against openclaw and m4air (new hosts) and win-lowspec (an older Windows host withoutagent.launch). Older hosts ignore the extra capability string, and the CLI keeps usingworktree.create+startupAgenton hosts that don't advertiseagent.launch.v2.Automated:
pnpm test tests/e2e/paired-cli-agent-launch.unit.test.ts src/cli/runtime/websocket-transport.test.tsgives 20/20 passing. Withwebsocket-transport.tsreverted tomain, all 12 integration cases fail withagent_launch_replay_unsupported.pnpm build:cli(CLI typecheck) passes, and oxlint/oxfmt are clean.Risks / Tradeoffs
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.agent.launch.prompt-unconfirmed.v1oragent.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 conservativeagent_session_operation_unknowninstead of the more specific answer the local CLI gets. That fails safe, and it's left out of scope.noteAgentLaunchClientReady), the same as the desktop renderer does. It runs once and is cheap.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.