Skip to content

fix(cli): honor Chat UI setting for worktree agent creation - #27796

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/worktree-create-agent-setting-split
Oct 12, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/worktree-create-agent-setting-split

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

orca worktree create --agent codex always opened the new agent in a terminal, even when Chat UI was enabled. The command used worktree creation's startup-terminal path, which never consults that setting. It now opens a structured chat when the execution host supports one and the user's setting chooses it; otherwise it opens a terminal and reports why.

What Changed

  • The CLI sends worktree creation and agent startup through the host's existing agent-launch path. A first prompt, chosen model or effort, setup choice, and background or focused presentation travel with that launch.
  • Older hosts keep the previous startup-terminal path. A host missing a capability needed for safe prompted launch or local presentation also uses that path; unsupported model, effort, and replay requests are refused before creating anything.
  • A lost launch reply can be checked with --retry-launch using the same operation ID, without creating a second worktree or sending the prompt twice. The command still reports setup refusals and parentage warnings.
  • CLI help and the bundled CLI skill describe the command and its result.

Why

worktree.create promises a startup terminal handle to existing clients. Changing its answer to a chat would break that contract. The host's agent-launch path already chooses chat or terminal from the execution host's setting and handles first-prompt delivery, so the CLI uses that path for agent-backed creates. Worktree creation without --agent stays on the existing path.

Linked Issue

Part 2 of STA-10160, for custom-model handoffs that bypassed the Chat UI preference. The existing-workspace command landed in #27794; this PR covers creation of a new worktree.

Visual Proof

Exact new-worktree flow on the pushed commit, in a hidden macOS Electron renderer with real agents:

Chat UI enabled Chat UI disabled
Setting on · Structured Codex chat with first prompt and response Setting off · Claude terminal with first prompt and response

Testing

  • M4Air macOS: built the branch CLI and launched the branch app in an isolated background profile. worktree create --agent codex --prompt ... opened a structured chat with Chat UI on; worktree create --agent claude --prompt ... opened a terminal with it off. The rendered views showed the agents' exact requested replies. Both QA child worktrees were clean and removed.

  • Focused local tests after rebasing: 135 passed across seven CLI, launch, setup, and transport files. Remote QA also ran 56 focused tests.

  • Local orca-ci-checks: 23 of 24 checks passed, including the native typecheck. Its Bun CI typecheck could not start because this machine has Bun 1.3.14, which lacks the bun check command expected by the repository's Bun 1.4.3 setup. GitHub CI passed its static analysis and typecheck. One unchanged Claude sign-in test failed on the first attempt after reporting an unexpected test link, consistent with a partial read of its directly written fixture. It passed on the failed-job rerun, and the full PR Checks run succeeded.

  • Linux, Windows, WSL, and SSH UI flows were not manually exercised for this PR.

  • I manually tested this exact new-worktree CLI flow in Electron

  • Automated tests added/updated

Review

Review found and fixed two regressions: a mixed-version host could reject a create it used to support, and the new route could hide a parent-context warning. A second review and a post-rebase review found no new issue. The readiness pass found no proven security, compatibility, performance, or cross-platform defect in the final diff.

Agent skill upstream boundary

  • Not applicable; this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The command's --model and --effort flags support the custom-model handoff in STA-10160. Hosts that cannot honor either option refuse it before worktree creation. An older host without the new launch capabilities keeps terminal startup. The separate terminal creation timeout observed in the original handoff remains outside this PR.

Checklist

  • The PR covers the new-worktree half of the handoff issue
  • The user-facing before and after, mechanism, and alternative are explained
  • Exact-flow visual proof is attached
  • Correctness, security, performance, remote, and compatibility were reviewed
  • GitHub CI passed

@brennanb2025
brennanb2025 force-pushed the brennanb2025/worktree-create-agent-setting-split branch 2 times, most recently from e806c62 to cd44086 Compare October 12, 2026 08:20
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/agent-launch-command-split to main October 12, 2026 08:20
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f433624-604e-4627-981a-79b8d872bbde

📥 Commits

Reviewing files that changed from the base of the PR and between 45fd65e and cd44086.


📒 Files selected for processing (30)
  • config/scripts/vitest-sqlite-runtime-files.mjs
  • skill-guides/orca-cli.md
  • skill-guides/orchestration.md
  • skill-guides/orchestration/references/low-level-topology.md
  • src/cli/agent-launch-recovery.ts
  • src/cli/agent-launch-request.ts
  • src/cli/agent-launch-test-fixtures.ts
  • src/cli/bundled-skill-guides.ts
  • src/cli/handlers/agent-launch.ts
  • src/cli/handlers/worktree-create-agent-launch.ts
  • src/cli/handlers/worktree-lineage-summary.ts
  • src/cli/handlers/worktree-setup-decision-recovery.ts
  • src/cli/handlers/worktree.ts
  • src/cli/index-agent-launch.test.ts
  • src/cli/index-worktree-create-agent.test.ts
  • src/cli/index.test.ts
  • src/cli/root-help-text-secondary.ts
  • src/cli/specs/core.ts
  • src/main/agent-launch/agent-launch-executor.ts
  • src/main/runtime/rpc/methods/agent-launch-failure-code.ts
  • src/main/runtime/rpc/methods/agent-launch-worktree-creation.ts
  • src/main/runtime/rpc/methods/agent-launch.test-fixture.ts
  • src/main/runtime/rpc/methods/agent-launch.test.ts
  • src/main/runtime/runtime-local-worktree-create.test.ts
  • src/main/runtime/runtime-local-worktree-create.ts
  • src/main/runtime/runtime-rpc-long-poll-transport.test.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-long-poll.ts
  • src/main/runtime/worktree-create-setup-choice-refusal.ts
  • tests/e2e/agent-launch-cli.unit.test.ts
  • tests/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; 1 remain after this review.



📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

worktree create now supports agent launches with prompt, model, effort, and retry options. The CLI routes supported hosts through the agent-launch flow and uses startup-agent worktree creation in specified fallback cases. Runtime changes classify setup-choice refusals, extend long polling for create-worktree launches, and combine worktree and lineage warnings. Tests cover CLI launch behavior, replay outcomes, setup refusals, and long-poll responses. CLI help and guides document the updated launch workflow.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to cd440

No confirmed issue prevents merging. Agent launches remain in the background unless a revealing option is selected.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 26 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: honoring the Chat UI setting when creating worktree agents.
Description check Passed The description is complete and focused. It explains the user-facing behavior, implementation, rationale, linked work, visual proof, testing, compatibility considerations, and checklist status.

Full details: Docstring Coverage

Explanation

Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 26 files. (3 skipped: 3 unsupported.)


  • Fix all pre-merge checks with AI
✨ 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.

@brennanb2025
brennanb2025 marked this pull request as draft October 12, 2026 08:33
@brennanb2025
brennanb2025 marked this pull request as ready for review October 12, 2026 08:33
@OrcaWin

OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

orca worktree create --agent used to open a terminal even when Chat UI was enabled, because worktree creation always used the startup-terminal path. Merged in #27796: the command now uses the existing agent-launch path, so a capable host opens structured chat when Chat UI is enabled and a terminal when it is disabled. Older hosts retain terminal startup.

Review: Fixed two issues before merge: mixed-version hosts with incomplete launch capabilities now use the legacy path, and parent-context warnings remain visible. Follow-up correctness and post-rebase reviews found no new issue. The separate terminal creation timeout from the original handoff remains outside this PR.

Validation on commit cd44086067566a967f45589ad127faa31fc37417: 135 focused local tests and 56 focused remote tests passed. In a background M4Air Electron app with a hidden renderer, the real worktree create --agent codex --prompt ... opened structured chat with Chat UI enabled and rendered the delivered prompt and QA_CODEX_READY; the real worktree create --agent claude --prompt ... opened a terminal with Chat UI disabled and rendered the delivered prompt and QA_CLAUDE_READY. Linux, Windows, WSL, and SSH UI flows were not manually exercised.

GitHub PR Checks passed, including static analysis, typecheck, five test shards, relay integration, cross-version compatibility, and macOS and Windows packaging. One unchanged Claude sign-in test failed on the first attempt after reporting an unexpected fixture link, then passed on the failed-job rerun. Local orca-ci-checks passed 23/24 checks; the remaining Bun CI typecheck could not start with this machine's older Bun, and passed in GitHub's configured environment.

Merged as 564693f1765e58bea9aee9cf642b96230411a8cd.

Chat UI enabled in Experimental settings

Enabled setting: rendered structured Codex chat with delivered prompt and response

Chat UI disabled in Experimental settings

Disabled setting: rendered Claude terminal with delivered prompt and response

@brennanb2025
brennanb2025 merged commit 564693f into main Oct 12, 2026
50 of 52 checks passed
hiphapis added a commit to hiphapis/orca that referenced this pull request Oct 15, 2026
Only src/cli/bundled-skill-guides.ts conflicted; it is generated, so it was
regenerated rather than hand-resolved. Upstream's guidance changes land around
this branch's edits without touching them: the circuit-breaker and retry-release
paragraphs in references/recovery-and-cleanup.md (stablyai#27795), and the orca-cli
launch-flag note in the kernel's role table (stablyai#27794, stablyai#27796).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011nnNsG3p4Do9eiyfXGr2rB
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.

2 participants