Repository navigation
fix(worktrees): a phone or CLI create puts the agent in the first orca.yaml default tab, as the desktop does - #26106
Conversation
… tab, as the window does With orca.yaml default tabs, the window's create starts the agent in the first default tab: that tab takes the template's title and color, and the template's command does not run beside the agent. The host's create started the agent in its own untitled tab and then created every default tab, the first one running its command too, so the workspace had one tab more than the window's create. Now the agent's tab takes the first template's place.
…keeps the agent's status The host's create titled the agent's tab by renaming the terminal, which writes the pane's own title stamped to outrank every title the agent sets later. On a headless host the phone reads status from those titles, so the agent tab showed the template title forever and lost its working/idle status. The window's create only sets the tab's custom title. The host now titles the tab the same way: the window gets the tab's custom title (not counted as a user rename), and a headless host saves it on the tab and shows it on the phone until the agent titles itself. The pane's title is left to the agent. The host also finds a terminal's tab itself from its handle, so the create over SSH, which never passed the tab, colors the agent's tab too. Every default tab is dressed by the same step, so the other tabs' titles are now kept on a headless host as well, and a failed title no longer skips the color.
… window adopts its handle The host found a provisioned terminal's tab only through the runtime's own pty record. Once the window's graph sync adopts the handle, that lookup misses, and the default tab's title and color would be dropped with only a log line. No create reaches it today (the tab is dressed before the window's first graph sync), but any wait added before provisioning would. It now falls back to the window's leaf, as renaming a terminal already does. Tests: the restart case now saves the title to a real session and rebuilds the phone's tabs from it; a create through createManagedWorktree with an agent and default tabs spawns the agent and the second template only and titles the agent's tab "Dev" without counting it as a user rename.
Use a runtime subclass for the protected launch scope and provisioning host, a typed store and notifier, and typed mocks in place of casts, so the changed-code quality gate passes.
Review summaryThe problem. In a repo whose The user-facing change. A phone or CLI create (local or SSH) with an agent in such a repo now matches the desktop: the agent is in the first default tab titled like that template, the template's command doesn't run, and there's no extra tab. On the desktop tab strip the title stays after the agent sets its own terminal title; on the phone the tab shows the template's title until the agent sets one, which is how the phone already labels desktop-created tabs. Creates without an agent or without default tabs are unchanged. Fixed during review.
Deferred.
Verified.
Not verified. The phone UI itself, SSH and Windows hosts, and a host with no window were not exercised live; they are covered by tests only. I couldn't open the uploaded screenshots myself (the links need a GitHub login), so I relied on the QA driver's tab dumps and report. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (11)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughDefault-tab provisioning can apply the first template’s title and color to an existing startup terminal, skip that template’s command, and create terminals for later templates. The host resolves terminal handles to tabs and persists titles in headless session snapshots. Host-applied title updates are forwarded through the UI rename path without recording a user interaction. Tests cover local and SSH-backed runtimes, provisioning failures, and worktree startup. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The agent’s first default tab has no identified merge-blocking issue. Normal checks can proceed. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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 |
ELI5
A repo can list "default tabs" in its
orca.yaml, for example a Dev tab that runspnpm devand a Tests tab. When you create a workspace with an agent on the desktop, the agent starts in the first of those tabs: that tab takes the template's title, and the template's own command doesn't run (the agent is running there instead).When the same kind of workspace was created from the phone or the CLI (through the host), the agent got its own extra untitled tab, and then every default tab was created too, the first one running its command. So the workspace had one tab more than the desktop's, and the first template's command (for example a second
pnpm dev) ran next to the agent.This PR makes the host lay the tabs out the way the desktop does.
What Changed
The problem.
worktree-default-terminal-tabs.ts): tab 1 holds the agent, takes the template's title (as the tab's own title) and color, and skips the template's command.createManagedWorktree) starts the agent's terminal first, thenprovisionWorktreeTerminalscreated a terminal for every default-tab template. A phone or CLI create in a repo with default tabs and an agent therefore got:User-facing change.
orca.yamldefault tabs and an agent now puts the agent in the first default tab, titled like that template, as on the desktop. The first template's command no longer runs, and there's no extra tab.The mechanism.
Known gap (unchanged from main)
orca serve), the color is applied and the phone shows it. Follow-up: add the tab-color message before desktop creates move onto this host path.Why
Linked Issue
Part of the new-workspace launch unification (parity fixes before the desktop composer moves onto
agent.launch).Visual Proof
CLI create with an agent (stub) in a repo whose
orca.yamlhasDev(runsecho DEV-RAN) andTestsdefault tabs, desktop window open, macOS.Testing
New
orca-runtime-default-tab-agent-status.test.ts(real runtime, real terminal creation and phone status projection):runtime-worktree-terminal-provisioning.test.ts(new): the agent's tab takes the first template, only the rest are created; without an agent every template is created; a failed title still applies the color and creates the remaining tabs.worktree-setup-and-startup-part-03.spec.ts: a full host create with an agent and two default tabs makes exactly two terminals (the agent andpnpm test;pnpm devnever runs) and titles the agent's tab "Dev" without recording a user action.orca-runtime.test.ts(1323 passed, 1 skipped),tc:node,tc:web, oxlint and oxfmt.Manual QA (an automated driver on a macOS dev build, desktop window open, CLI creates against a test repo): main vs this PR, with and without an agent; screenshots above. Not exercised live: phone UI, SSH and Windows hosts, and a host with no window (covered by the tests above).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Notes
orca.yaml, unaffected.Author: @BrennanKB5