Repository navigation
fix(cli): start agents through agent.launch so they follow the Chat UI setting - #27638
brennanb2025 wants to merge 7 commits into
Conversation
…I setting worktree create --agent now goes through the host's shared agent launch instead of the terminal-only worktree.create startup agent, and a new agent launch command starts an agent in an existing worktree. Both take --model/--effort, checked by the rule worker-start already uses, now in shared. Older hosts keep the startup-terminal path. Skill guides name these as the way to start an agent.
|
Before: starting an agent from the CLI opened a terminal even when Chat UI was enabled. After: hidden-renderer QA shows the same CLI launch opening a Codex Chat tab with Chat UI enabled, and a terminal tab with Chat UI disabled. The launch used Visual proof: |
|
Starting an agent through the Orca CLI could open a terminal even when the user's new-agent setting called for Chat UI. The custom-model handoff guide led the caller through User-facing result: Review status: The loop fixed the original prompt, retry, presentation, setup, and folder-selection defects, then fixed the regressions those changes exposed. A final empty Verified: The final post-merge focused run passed 1,435 tests (one skipped), and GitHub CI passed static analysis/typecheck, all five Node test shards, changed end-to-end tests, wire compatibility, native smoke on macOS/Ubuntu/Windows, and macOS/Windows packages. On an isolated macOS arm64 host, hidden Electron/CDP QA of the compiled CLI observed a structured launch with its first prompt journaled when Chat UI was on, then a terminal launch with its prompt handed to the terminal when it was off. Attached screenshots show the rendered tabs and sidebar state. Limits and follow-up: The remote QA run did not render-test new-worktree creation, focus/background feedback, or a valid retry after a lost reply; targeted CLI/host tests cover those paths. Linux, Windows, and SSH UI flows were not manually exercised. Local |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to Agent launch is mergeable with follow-up, but the CLI test may fail during cleanup on Windows, and one help example may lead users to bypass the Chat UI setting. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
54327208-1574-439c-bc66-a1553a46b20f
📒 Files selected for processing (52)
config/scripts/vitest-sqlite-runtime-files.mjsskill-guides/orca-cli.mdskill-guides/orchestration.mdskill-guides/orchestration/references/low-level-topology.mdsrc/cli/agent-launch-recovery.tssrc/cli/agent-launch-request.tssrc/cli/agent-launch-test-fixtures.tssrc/cli/agent-workspace-selector.tssrc/cli/bundled-skill-guides.tssrc/cli/handler-group-manifest.tssrc/cli/handlers/agent-launch.tssrc/cli/handlers/worktree-create-agent-launch.tssrc/cli/handlers/worktree-lineage-summary.tssrc/cli/handlers/worktree-setup-decision-recovery.tssrc/cli/handlers/worktree.tssrc/cli/index-agent-launch.test.tssrc/cli/index-worktree-create-agent.test.tssrc/cli/index.test.tssrc/cli/index.tssrc/cli/root-help-text-primary.tssrc/cli/root-help-text-secondary.tssrc/cli/specs/agent-launch.tssrc/cli/specs/core.tssrc/cli/specs/index.tssrc/main/runtime/orca-runtime-create-terminal-dependencies.tssrc/main/runtime/orca-runtime-create-terminal.tssrc/main/runtime/orca-runtime-tests/terminal-creation-and-readiness-part-12.spec.tssrc/main/runtime/rpc/methods/agent-launch-caller-selection.test.tssrc/main/runtime/rpc/methods/agent-launch-failure-code.tssrc/main/runtime/rpc/methods/agent-launch-instant-tab.test.tssrc/main/runtime/rpc/methods/agent-launch-surfaces.tssrc/main/runtime/rpc/methods/agent-launch-tab-publication.tssrc/main/runtime/rpc/methods/agent-launch.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-launch-preferences.tssrc/main/runtime/runtime-local-worktree-create.test.tssrc/main/runtime/runtime-local-worktree-create.tssrc/main/runtime/runtime-notifier-contract.tssrc/main/runtime/runtime-rpc-long-poll-transport.test.tssrc/main/runtime/runtime-rpc/runtime-rpc-long-poll.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/worktree-create-setup-choice-refusal.tssrc/main/window/runtime-window-lifecycle.tssrc/preload/api/ui-bridge-terminal-and-session-tabs.tssrc/preload/api/ui-command-event-api.tssrc/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.tssrc/renderer/src/lib/agent-launch-tab-presentation.tssrc/renderer/src/lib/agent-launch-tab-publication.tssrc/renderer/src/lib/worktree-creation-backend-startup-focus.test.tssrc/shared/agent-launch-model-preferences.tssrc/shared/agent-launch-runtime-capability.tstests/e2e/agent-launch-cli.unit.test.tstests/e2e/agent-launch-setup-choice.unit.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| ' Start agents with `worktree create --agent` (new checkout) or `agent launch` (existing', | ||
| ' worktree). Both open a chat or a terminal per your Chat UI setting, and take --model/--effort.', | ||
| ' orca agent launch --agent codex --model gpt-6-astra --effort high', |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update the remaining terminal create --command "codex" example.
The new guidance at Lines 119-121 tells users to start agents with agent launch or worktree create --agent. The unchanged example at Line 174 still shows orca terminal create --worktree active --command "codex". That example contradicts the new guidance and bypasses the Chat UI setting. src/cli/specs/core.ts already changed its terminal create examples to pnpm dev. Make this example consistent.
Proposed fix (Line 174)
- ' $ orca terminal create --worktree active --command "codex"',
+ ' $ orca agent launch --agent codex --worktree active',| examples: [ | ||
| 'orca agent launch --agent codex --json', | ||
| 'orca agent launch --agent codex --model gpt-6-astra --effort high --prompt "Write the design doc" --json', | ||
| 'orca agent launch --agent claude --worktree path:/projects/myapp --focus' | ||
| ] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Check whether gpt-6-astra and the 'high' effort are known to the Codex launch catalog.
rg -n "gpt-6-astra" --type=ts -g '!**/*.test.ts' | head -20
rg -nP "unknownModelOptions" --type=ts -C5 src/shared | head -80Repository: stablyai/orca
Length of output: 40876
Use a model and effort pair accepted by CLI validation.
gpt-6-astra is not listed in the Codex launch catalog. Unknown Codex models use unknownModelOptions, which provides only the ultra effort. Therefore, this documented command can fail with does not support effort high.
Update the example to use a catalog-supported model and effort, or add gpt-6-astra with high support to the Codex catalog.
| afterEach(async () => { | ||
| setAgentLaunchRecordStore(null) | ||
| vi.restoreAllMocks() | ||
| await rm(directory, { recursive: true, force: true }) | ||
| }) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Close the journal database before removing the test directory.
beforeEach opens a SQLite-backed store through openTestAgentSessionRecordStore(directory). afterEach never calls closeTestJournalHostDatabase(directory). As a result, every test leaves an open database handle, and the directory is removed while that handle is still open. On Windows, rm of a directory with an open SQLite file fails, so this hook can make the suite flaky. The sibling tests/e2e/agent-launch-setup-choice.unit.test.ts already closes the database in its afterEach.
Proposed fix
+import { closeTestJournalHostDatabase } from '../../src/main/native-chat/agent-session-journal/journal-host-database-test-support'
...
afterEach(async () => {
setAgentLaunchRecordStore(null)
+ closeTestJournalHostDatabase(directory)
vi.restoreAllMocks()
await rm(directory, { recursive: true, force: true })
})

Superseded by two focused PRs
This combined PR has been split into #27794: launch an agent in an existing workspace and #27796: make
worktree create --agentfollow the Chat UI setting. Both have passed CI. Review and merge #27794 first; #27796 is based on it and can then be retargeted tomain. This PR is kept for its review history and visual proof.ELI5
Starting an agent through the Orca CLI opened a terminal even when the user's setting said new agents should open as chats. This happened during a custom-model worktree handoff because the documented CLI path launched a terminal command directly. The CLI now starts agents through the same host launch route used by the app, so Chat UI on opens a chat when supported; Chat UI off opens a terminal.
What Changed
orca worktree create --agent ...now follows the user's new-agent setting. Neworca agent launch --agent ...does the same in an existing worktree or folder workspace. Both accept--modeland--effortwhere the chosen agent supports them.--retry-launchso the same operation can be checked without starting another agent. An explicitly empty retry ID is rejected.orca-cliand orchestration guides describe the setting-aware commands.orca terminal createremains an explicit terminal command.Why
The original worktree-create API promises a terminal handle, so changing that API would break older clients. The host already owns the chat-versus-terminal decision in
agent.launch. Routing CLI starts through it also keeps prompt delivery, remote execution, and model selection in one launch path. The CLI uses the existing terminal-only create path only when talking to an older host, and it refuses options that older path cannot honor.The separate timeout observed while creating a terminal in the original handoff remains outside this change and needs its own trace.
Linked Issue
Linear STA-10160 (custom-model handoffs bypass the Chat UI preference).
Visual Proof
Chat UI on: Codex Chat tab and model badge · Chat UI off: additional terminal tab. Both screenshots are attached to this PR. They show the rendered tab and sidebar state; the first-prompt result was checked through the compiled CLI and host response.
Testing
On an isolated macOS arm64 host, rebuilt the Electron app and CLI, then used Playwright through Chrome DevTools Protocol on a hidden renderer. With Chat UI on, the compiled CLI reported a structured launch and a journaled first prompt; with it off, it reported a terminal launch and a prompt handed to that terminal. The matching tabs rendered. No visible window or desktop input was used.
After removing duplicate test cases, the four changed suites passed: 41 tests. The earlier full review run passed 1,435 tests with one skipped; remote QA targeted suites passed 55. Review-specific tests cover replay after lost replies, prompts, setup refusal, folder selection, background/focus presentation, and older-host behavior.
GitHub CI passed, including static analysis and typecheck, all five Node test shards, changed end-to-end tests, cross-version wire compatibility, native smoke on macOS/Ubuntu/Windows, and macOS/Windows packages.
Local
orca-ci-checks: 25/26 passed, including typechecks. Its native code-quality audit rejected five import-cycle warnings in mobile files that are byte-identical to the mergedmainrevision; this PR does not change those files. GitHub static analysis passed.New-worktree launch was not exercised in rendered UI because the remote QA worktree could not safely create a nested checkout. Rendered focus/background feedback and a valid retry after a lost reply were not separately exercised in the app; targeted host/CLI tests cover them. Linux, Windows, and SSH UI flows were not manually run.
I manually tested these changes in a hidden macOS Electron renderer
Automated tests added/updated
Review
Five initial PR defects, five defects introduced by review fixes, and one final retry-ID defect were fixed and independently re-reviewed. The final architecture check kept the shared host launch route, and the readiness review found no remaining proven P0–P2 issue. The PR is ready for maintainer review.
Agent skill upstream boundary
Notes
Checklist