Repository navigation
Conversation
worker-start passes createTerminal command as the agent id (e.g. antigravity). Bare-command resolution only matched launch binaries (agy), so those workers skipped Settings defaults, launchAgent, and ORCA_AGENT_LAUNCH_TOKEN. Accept enabled TuiAgent ids as bare launches.
📝 WalkthroughWalkthroughThe runtime now recognizes enabled bare TUI agent identifiers during command resolution. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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: 8efb6d30-a794-4870-aa3d-8a75086fdfc1
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
| // Why: orchestration worker-start passes command: <agent id>; antigravity's | ||
| // binary is `agy`, so matching only launchCmd left this path as a raw shell | ||
| // string without launchAgent / launch token. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Reduce this comment to one line.
Keep only the non-obvious reason for the test. The three-line explanation exceeds the TypeScript comment guideline.
As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
Greptile SummaryFixes
Confidence Score: 4/5Safe to merge; the change is small and well-contained, touching only the agent-ID resolution path before any command is actually executed. The core logic is correct — Files Needing Attention: src/main/runtime/orca-runtime.ts — specifically the ordering of the new early-return relative to the cmdOverride loop.
|
| Filename | Overview |
|---|---|
| src/main/runtime/orca-runtime.ts | Adds an early-return in resolveBareAgentLaunchCommand to match bare TuiAgent IDs before the existing launch-binary loop; correctly gates on isTuiAgentEnabled and defers override/platform logic to buildAgentStartupPlan |
| src/main/runtime/orca-runtime.test.ts | Adds three targeted tests: bare antigravity id resolves to agy + launch metadata, bare cursor id resolves to cursor-agent, and disabled bare antigravity id stays a raw command |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["worker-start --agent id\ne.g. antigravity, cursor"] --> B["resolveBareAgentLaunchCommand"]
B --> C{"isTuiAgent\ncommand"}
C -- No --> E{"Loop: command matches\nlaunchCmd or cmdOverride?"}
C -- Yes --> D{"isTuiAgentEnabled\ncommand, disabled"}
D -- No --> E
D -- Yes --> F["Return TuiAgent id\nNEW PATH"]
E -- Match --> G["Return TuiAgent id\nexisting path"]
E -- No match --> H["Return null\nraw shell command"]
F --> I["buildAgentStartupPlan\nresolves launchCmd + overrides\nagentDefaultArgs + env"]
G --> I
I --> J["createTerminal\ncommand = real binary\nlaunchAgent = agent id\nORCA_AGENT_LAUNCH_TOKEN set"]
H --> K["createTerminal\ncommand = raw string\nno launch metadata"]
Reviews (1): Last reviewed commit: "fix(orchestration): resolve bare agent i..." | Re-trigger Greptile
| if (isTuiAgent(command) && isTuiAgentEnabled(command, args.settings.disabledTuiAgents)) { | ||
| return command | ||
| } |
There was a problem hiding this comment.
Early-return bypasses cmdOverride-as-command matching
The new isTuiAgent check runs before the existing loop that also compares command against each agent's agentCmdOverrides entry. If an operator has ever set agentCmdOverrides['someAgent'] = 'antigravity' (using another agent's bare ID as a custom launch path for that agent), command = 'antigravity' would previously resolve to 'someAgent' via the override branch, but now resolves to 'antigravity' via this early return. In practice this configuration pattern is unlikely (and arguably nonsensical), but the priority shift is undocumented and could surprise anyone who relied on it.
| expect(spawnCall?.env?.ORCA_AGENT_LAUNCH_TOKEN).toBeUndefined() | ||
| }) | ||
|
|
||
| it('resolves bare agent ids whose launch binary differs from the id', async () => { | ||
| const spawn = vi.fn().mockResolvedValue({ id: 'pty-bg' }) | ||
| const runtimeStore = { | ||
| ...store, | ||
| getSettings: () => ({ | ||
| ...store.getSettings(), | ||
| disabledTuiAgents: [], | ||
| agentCmdOverrides: {}, | ||
| agentDefaultArgs: { antigravity: '--dangerously-skip-permissions' }, | ||
| agentDefaultEnv: {} | ||
| }) | ||
| } | ||
| const runtime = new OrcaRuntimeService(runtimeStore) | ||
| runtime.setPtyController({ | ||
| spawn, | ||
| write: () => true, | ||
| kill: () => true, | ||
| getForegroundProcess: async () => null | ||
| }) | ||
|
|
||
| // Why: orchestration worker-start passes command: <agent id>; antigravity's | ||
| // binary is `agy`, so matching only launchCmd left this path as a raw shell | ||
| // string without launchAgent / launch token. | ||
| await runtime.createTerminal(`path:${TEST_WORKTREE_PATH}`, { | ||
| command: 'antigravity', | ||
| title: 'worker' | ||
| }) | ||
|
|
||
| const spawnCall = spawn.mock.calls[0]?.[0] as | ||
| | { command?: string; env?: Record<string, string>; launchAgent?: string } | ||
| | undefined | ||
| expect(spawnCall?.command).toBe("agy '--dangerously-skip-permissions'") | ||
| expect(spawnCall?.launchAgent).toBe('antigravity') | ||
| expect(spawnCall?.env?.ORCA_AGENT_LAUNCH_TOKEN).toMatch(UUID_RE) | ||
| }) | ||
|
|
||
| it('resolves bare cursor agent ids to the cursor-agent launch binary', async () => { | ||
| const spawn = vi.fn().mockResolvedValue({ id: 'pty-bg' }) | ||
| const runtimeStore = { | ||
| ...store, | ||
| getSettings: () => ({ | ||
| ...store.getSettings(), | ||
| disabledTuiAgents: [], | ||
| agentCmdOverrides: {}, | ||
| agentDefaultArgs: { cursor: '--yolo' }, | ||
| agentDefaultEnv: {} | ||
| }) | ||
| } | ||
| const runtime = new OrcaRuntimeService(runtimeStore) | ||
| runtime.setPtyController({ | ||
| spawn, | ||
| write: () => true, | ||
| kill: () => true, | ||
| getForegroundProcess: async () => null | ||
| }) | ||
|
|
||
| await runtime.createTerminal(`path:${TEST_WORKTREE_PATH}`, { | ||
| command: 'cursor', | ||
| title: 'worker' | ||
| }) | ||
|
|
||
| const spawnCall = spawn.mock.calls[0]?.[0] as | ||
| | { command?: string; launchAgent?: string; env?: Record<string, string> } | ||
| | undefined | ||
| expect(spawnCall?.command).toBe("cursor-agent '--yolo'") | ||
| expect(spawnCall?.launchAgent).toBe('cursor') | ||
| expect(spawnCall?.env?.ORCA_AGENT_LAUNCH_TOKEN).toMatch(UUID_RE) | ||
| }) | ||
|
|
||
| it('keeps disabled bare agent id terminal creates unchanged', async () => { | ||
| const spawn = vi.fn().mockResolvedValue({ id: 'pty-bg' }) | ||
| const runtimeStore = { | ||
| ...store, | ||
| getSettings: () => ({ | ||
| ...store.getSettings(), | ||
| disabledTuiAgents: ['antigravity' as const], | ||
| agentCmdOverrides: {}, | ||
| agentDefaultArgs: { antigravity: '--dangerously-skip-permissions' }, | ||
| agentDefaultEnv: {} | ||
| }) | ||
| } | ||
| const runtime = new OrcaRuntimeService(runtimeStore) | ||
| runtime.setPtyController({ | ||
| spawn, | ||
| write: () => true, | ||
| kill: () => true, | ||
| getForegroundProcess: async () => null | ||
| }) | ||
|
|
||
| await runtime.createTerminal(`path:${TEST_WORKTREE_PATH}`, { | ||
| command: 'antigravity' | ||
| }) | ||
|
|
||
| const spawnCall = spawn.mock.calls[0]?.[0] as | ||
| | { command?: string; env?: Record<string, string>; launchAgent?: string } | ||
| | undefined | ||
| expect(spawnCall?.command).toBe('antigravity') | ||
| expect(spawnCall?.launchAgent).toBeUndefined() | ||
| expect(spawnCall?.env?.ORCA_AGENT_LAUNCH_TOKEN).toBeUndefined() | ||
| }) | ||
|
|
||
| it('sends Settings agent defaults through renderer-backed bare agent terminal creates', async () => { | ||
| const runtimeStore = { | ||
| ...store, |
There was a problem hiding this comment.
No test for multi-token
launchCmd agents resolved via bare ID
The fix unblocks several agents beyond antigravity and cursor — notably kiro (launchCmd: 'kiro-cli chat --tui'), aug (auggie), and command-code (command-code --trust). These are the cases where the old binary-match loop was most broken (multi-token launchCmd made it even harder to accidentally pass the right string via worker-start). A test confirming that command: 'kiro' produces kiro-cli chat --tui ... would close the obvious regression vector for those agents and document the intended behaviour for reviewers of future kiro/aug config changes.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Thanks @octu0 for the careful report, tests, and investigation of the launch-token/default-args gap. I rechecked this against current Measured topology: current Merged #12148 ( A current-main reproduction showing |
Summary
orca orchestration worker-start --agent <id>creates a worker terminal withcommandset to the agent id (e.g.antigravity,cursor). Bare-agent resolution only matched launch binaries (agy,cursor-agent), so agents whose id ≠ binary were treated as raw shell commands:launchAgent/launchConfigORCA_AGENT_LAUNCH_TOKEN(weaker hook attribution)agent_readinesstimeouts andruntime_unavailableraces (especially Antigravity)This change accepts an enabled bare
TuiAgentid inresolveBareAgentLaunchCommand, so worker-start/federation launches resolve the real launch command the same way as the agent picker (e.g.antigravity→agy --dangerously-skip-permissionswith launch metadata).Agents where id already equals the binary (
claude,codex, …) are unchanged. Disabled agents still run as raw commands (same as before for disabled bare binaries).Current workaround (pre-fix / still useful locally)
Until this lands, operators often paper over the missing
antigravityPATH entry with a wrapper, because worker-start literally execs the stringantigravityinstead ofagy:(write to /usr/local/bin/antigravity)
What that workaround does and does not fix:
worker-start --agent antigravityfinds a command on PATHagy)agydirectly)buildAgentStartupPlanlaunchAgent+ORCA_AGENT_LAUNCH_TOKEN(hooks)So the wrapper is a local PATH shim, not a substitute for proper agent-id resolution. After this fix,
worker-start --agent antigravityshould not need/usr/local/bin/antigravity. The wrapper can remain for manualorca terminal create --command antigravityif someone still types the id as a shell command.Screenshots
No visual change
Testing
pnpm lint— passedpnpm typecheck— passedpnpm test— 43520 passed, 81 skipped; 2 failed unrelated to this PR (see Notes)pnpm build— passedNew coverage in
orca-runtime.test.ts:antigravityid →agy+ YOLO args +launchAgent+ launch tokencursorid →cursor-agent+ YOLO args + launch metadataantigravityid stays a rawantigravitycommand (no agent wrapping)Targeted:
pnpm exec vitest run src/main/runtime/orca-runtime.test.ts -t "bare agent"→ 9 passedAI Review Report
Reviewed the change for orchestration worker-start / federation terminal create paths.
Main risks checked
buildAgentStartupPlan/ shell helpers. No shortcut, label, or path changes.getTuiAgentLaunchCommand(..., { isRemote })and the same Settings defaults path as other bare agent creates; remote Windows shell quoting behavior unchanged.antigravity→agy,cursor→cursor-agent, and the same class forkiro,aug, etc.). Agents with id === binary keep matching via the existing launchCmd loop. Multi-token commands (codex exec …) still fail bare match and stay raw shell.isTuiAgentcheck on bare creates only; no hot-path render/PTY work.TuiAgentids; does not broaden arbitrary command execution. Disabled agents are not auto-wrapped.Flagged / verified
command: args.agent(id string); fixing resolution is the minimal durable fix vs. only changing the worker topology call site.buildAgentStartupPlan({ agent })and was not broken; this aligns the bare-command path with that behavior./usr/local/bin/antigravityworkaround only papered over PATH lookup and does not attach launch metadata — documented above for reviewers who have seen that shim in the wild.Security Audit
agentfield instead of overloadingcommand, but that is a larger API change and not required once id resolution works.Notes
src/relay/agent-exec-handler.test.ts(2 tests) failed because the host shell already exportsGIT_CONFIG_COUNT=2/GIT_CONFIG_KEY_*, so the handler ends up withGIT_CONFIG_COUNT=4while the test expects2. Not touched by this PR; re-run those tests in a clean env (unsetGIT_CONFIG_*) to confirm green. Full suite otherwise: 4074 files passed.