Repository navigation
fix(orchestration): worker-start launches the configured agent CLI, not the raw agent id - #12148
Conversation
…t id worker-start passed the Orca agent id straight to the shell as the worker terminal command. That only worked for agents whose id matches their launch command; `--agent cursor` ran `cursor`, which on Windows resolves to Cursor IDE's cursor.cmd and opened the desktop app, leaving a blank shell that timed out at agent_readiness. The same gap hit continue/aug/kiro/qwen-code and the other agents whose CLI binary differs from their id. Add TerminalCreateOptions.startupAgent so a caller can name the agent outright. createTerminal then builds the launch through the TUI agent config (command, default args/env, preflight trust) instead of sniffing the command string, and this also covers repo-less folder workspaces, which previously skipped resolution entirely. Fixes #11926
Greptile SummaryThis PR fixes a Windows-specific bug where
Confidence Score: 5/5Safe to merge. The change is narrowly scoped to how agent ids are translated to launch commands, both existing code paths are covered by updated and new tests, and the fix is directly verified at the spawn level. The root cause was a missing id-to-command translation step that the new Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/main/runtime/orca-runtime.ts | Adds startupAgent to TerminalCreateOptions and extends resolveAgentTerminalCreateOptions to resolve an agent id to its configured CLI launch, with conflict detection, disabled-agent guard, and explicit error on unresolvable plan; also fixes folder workspace isRemote derivation. |
| src/main/runtime/rpc/methods/orchestration-worker-topology.ts | Switches createExistingWorktreeWorkerTerminal from command: args.agent to startupAgent: args.agent, routing the agent id through the runtime's launch resolver instead of passing it as a raw shell command. |
| src/main/runtime/rpc/methods/orchestration-federation.ts | Same one-line change as the topology file: the federated attach path now uses startupAgent instead of command when creating the worker terminal for an existing worktree. |
| src/main/runtime/orca-runtime.test.ts | Adds eight new tests covering: correct CLI resolution for cursor, Windows cmd.exe quoting, platform-aware launcher name (claude-agent-teams), agentCmdOverrides honoring, selector-less rejection, folder workspace coverage, conflicting-options rejection, and disabled-agent rejection. |
| src/main/runtime/rpc/methods/orchestration-federation-agent-launch.test.ts | New test file verifying the federated federationAttachStart handler calls createTerminal with startupAgent (not command) and that the worker reaches ready state end-to-end. |
| src/main/runtime/rpc/methods/orchestration.test.ts | Updates existing workerStart assertion from command: 'codex' to startupAgent: 'codex' and adds a new regression test asserting cursor never appears as a raw shell command. |
Reviews (5): Last reviewed commit: "fix(orchestration): reject a startupAgen..." | Re-trigger Greptile
|
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:
📝 WalkthroughWalkthroughThe runtime now accepts 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1a86bf35-3f60-4bd3-b4ed-fe4d721ba9da
📒 Files selected for processing (5)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/orchestration-federation.tssrc/main/runtime/rpc/methods/orchestration-worker-topology.tssrc/main/runtime/rpc/methods/orchestration.test.ts
…olve The guard ordering let a caller that set startupAgent together with a caller-supplied launch (env/launchConfig/launchAgent/startupCommandDelivery/ claudeAgentTeamsSourceCommand), a raw command, a resume session, or that hit an unavailable store, fall through with an unresolved command and spawn a bare shell — the exact silent timeout at agent_readiness that startupAgent exists to prevent. No current caller does this, so it was latent rather than live. Those combinations now throw instead. A raw `command` counts as a contradiction because it would be silently overwritten by the built launch, and `resumeProviderSession` because it survives to spawn and would pair resume identity with a freshly built fresh-launch command. The non-startupAgent path is unchanged: verified bit-for-bit over all 256 combinations of the eight guard inputs. Also covers the repo-less folder-workspace branch with a test, which the new isRemote fallback made reachable for the first time.
Three gaps found in adversarial review of the previous two commits: - The federated worker terminal create had zero coverage. Added a test that drives orchestration.federationAttachStart to that call site; verified it is not vacuous by reverting the call site and watching it fail. - The Windows assertion was platform-insensitive: `cursor` has no launchCmdByPlatform and the prefix regex would have passed on any OS. It now asserts the full cmd.exe-quoted command. - No agent whose launcher name varies by platform was covered. Added a matrix over claude-agent-teams (orca.cmd / orca-ide / orca claude-teams), the only agent with launchCmdByPlatform, which proves resolution is platform-aware. Also extended the conflict table to all six caller-supplied-launch operands rather than the four that happened to differ.
…ared default
The exact-string assertion inherited `--yolo` from the shared
YOLO_TUI_AGENT_ARGS map, so an unrelated change to cursor's default args would
break a test that exists to check cmd.exe quoting. Pin the arg in the test
instead.
Verified the assertion is genuinely platform-sensitive: flipping setPlatform to
darwin fails it on the quote style ('--force' vs "--force").
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/rpc/methods/orchestration-federation-agent-launch.test.ts (1)
6-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReduce this comment to one concise line.
Keep the Windows Cursor regression context and issue reference. Remove the step-by-step explanation.
Suggested revision
-// Why: a federated worker terminal is created from an agent id. Passing that id -// as a shell command launched Cursor's desktop app instead of `cursor-agent` -// (issue `#11926`), so the remote path must resolve through the TUI agent config -// exactly like the local one. +// Resolve federated agent IDs through `startupAgent` to avoid Cursor Desktop on Windows (`#11926`).As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2f3b0b12-2865-4720-8501-950f5e372343
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/rpc/methods/orchestration-federation-agent-launch.test.ts
Anyone who worked around this bug by pointing agentCmdOverrides.cursor at their own cursor-agent path must keep that override once the id resolves properly. Verified it survives: `cursor-agent --beta '--force'`. Also trims the conflict-guard comment to the repo's brevity rule; no logic change.
…lector Two findings from adversarial review of the previous commits: - createTerminal resolves the launch against a workspace, so with no selector `startupAgent` was silently dropped and the terminal came up as a bare shell — the failure this option exists to prevent. Now rejected up front, before any window or PTY work. Not reachable from either current call site, so this closes a future-caller trap rather than a live bug. - The federated worker test asserted only on the createTerminal spy, so it stayed green while the handler actually returned state:"failed"/stable_pane_required: the pane getters were never stubbed. It now stubs them and asserts state:"ready", so it covers every stage rather than just terminal_create. Re-verified it still fails when the call site is reverted to `command:`.
…nt matrix Upstream stablyai#12148 added a platform matrix asserting win32 resolves to 'orca.cmd claude-teams'. This change deliberately bypasses the Orca CLI wrapper on Windows — Electron-as-node has no TTY stdin, so the wrapper cannot run the Claude TUI — and launches 'claude --teammate-mode auto' directly. Update the win32 expectation to the actual launch command. Co-Authored-By: Claude Opus 5 <[email protected]>
…ot the raw agent id (stablyai#12148) Worker-start passed the Orca agent id straight to the shell as the worker terminal command, so `--agent cursor` ran `cursor` — which on Windows resolves to Cursor IDE's cursor.cmd and opened the desktop app, leaving a blank shell that timed out at agent_readiness. The same gap hit every agent whose CLI binary differs from its id (continue/aug/kiro/qwen-code/mistral-vibe/antigravity/trae/mimo-code/hermes/command-code/claude-agent-teams). Adds TerminalCreateOptions.startupAgent so callers name the agent outright; createTerminal then builds the launch from the TUI agent config (command, agentCmdOverrides, default args/env, preflight trust) instead of sniffing the command string. Also covers repo-less folder workspaces, which previously skipped resolution entirely, and fails loudly instead of spawning a bare shell when an explicit agent cannot resolve. Fixes stablyai#11926
Fixes #11926
Problem
On Windows,
orca orchestration worker-start --worktree current --agent cursoropened the Cursor desktop app instead of the Cursor Agent CLI, left a blank PowerShell session, and failed atagent_readinesswithtimeout.The worker terminal was created by passing the Orca agent id straight through as a shell command:
createTerminaltries to recover the agent from that string viaresolveBareAgentLaunchCommand, but that matches against launch commands, not ids.cursor's launch command iscursor-agent, so nothing matched, the string fell through as user-authored shell, and Windows PATH resolvedcursor→cursor.cmd→ the IDE.It worked for
claude/codex/geminionly because their id happens to equal their launch command. The same gap hit every agent where they differ:cursor→cursor-agent,continue→cn,aug→auggie,kiro→kiro-cli chat --tui,qwen-code→qwen,mistral-vibe→vibe,antigravity→agy,trae→traecli,mimo-code→mimo,hermes→hermes --tui,command-code→command-code --trust,claude-agent-teams→orca claude-teams.Fix
Added
TerminalCreateOptions.startupAgentso a caller that already knows the agent names it outright instead of encoding it as a command string.resolveAgentTerminalCreateOptionsthen builds the launch from the TUI agent config — resolved command,agentCmdOverrides, default args/env, and preflight trust (cursorneeds its.workspace-trustedmarker or the first-launch menu swallows the dispatch preamble).Both orchestration worker-start terminal creates use it: the local path (
orchestration-worker-topology.ts) and the federated one (orchestration-federation.ts).Two side benefits:
repo: null, so the old!workspace.repoguard skipped agent resolution entirely and spawned the bare string.agent_readiness— the exact symptom in the report. That covers a disabled agent, an unbuildable launch plan, a missing workspace selector, and a caller that contradicts itself by also supplyingenv/launchConfig/launchAgent/startupCommandDelivery/claudeAgentTeamsSourceCommand/command/resumeProviderSession.New-worktree worker-start (
--worktree new-child/new-top-level) was already correct; it goes throughcreateManagedWorktree({ startupAgent }).Verification
Reproduced first —
createTerminal(path, { command: 'cursor' })spawned the literalcursor.The non-
startupAgentpath is provably unchanged. The guard was restructured, so I enumerated all 256 combinations of its eight inputs: zero divergences from the original.isRemoteis likewise unchanged there, sincerepois guaranteed truthy on that path.No regressions. Full
src/mainis 167 failures on this branch and 167 on a clean baseline — identical. Those are pre-existing Windows path/symlink/fsync assumptions in untouched areas (orca-runtime-files,ai-vault,node-markdown-document-discovery), verified by stashing.Tests are not tautological — verified by mutation, not assumption. Reverting the local call site fails 3 tests; neutering the resolver fails 3; reverting the federated call site fails its test. Each restored and re-confirmed.
New coverage:
cursor-agentwith configured args/env,launchAgent, and trust marked before spawn.cmd.exe) quoting, asserted exactly — confirmed platform-sensitive by flipping todarwin, which fails on quote style.claude-agent-teams, the only agent withlaunchCmdByPlatform(orca.cmd/orca-ide/orca claude-teams).agentCmdOverrideshonored, so anyone who set an override as a workaround keeps it.state: 'ready', not just the spy.Checks:
tscclean (node/cli/web); oxlint code-quality native + type-aware clean; max-lines ratchet and reliability gates pass; PR CI green.Not verified by hand: I don't have the Cursor Agent CLI installed, so the end-to-end desktop-vs-CLI launch is covered by spawn-level assertions rather than a live run.
Out of scope
Two pre-existing issues surfaced during review and deliberately left alone, as neither is caused by this change:
detectUnsupportedRuntimesis never enforced, so--agent claude-agent-teamsbuilds a launch on Windows despite win32 being marked unsupported. Shared withworktree create --agent.agent-catalog.tsxshowsdetectCmdin the settings override placeholder, so editing from it drops required flags (kiro-clivskiro-cli chat --tui).