Repository navigation
feat(cli): set the title of one terminal pane - #30485
Conversation
Adds `orca terminal set-pane-title --terminal <handle> --title <text>`; `--title ""` clears it. The runtime resolves the live handle to its saved leaf and asks the desktop window to name that pane through a new optional notifier hook (`ui:setPaneTitle`). Mounted panes apply it through the same local setter the GUI uses; parked panes get it in the saved layout their next mount reads. The tab's own name is never touched. Rebuilt on current main from #24755. Co-authored-by: stevelliu <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
091f04d3-17a6-45c2-be69-25dda05c5928
⛔ Files ignored due to path filters: 1
src/shared/rpc-contract/rpc-params-catalog.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing: 36
docs/site/content/docs/cli/reference.mdxskill-guides/orca-cli.mdsrc/cli/bundled-skill-guides.tssrc/cli/format.tssrc/cli/handler-group-manifest.tssrc/cli/handlers/terminal-set-pane-title.test.tssrc/cli/handlers/terminal.tssrc/cli/help.tssrc/cli/root-help-text-primary.tssrc/cli/specs/core.tssrc/cli/specs/terminal-set-pane-title.tssrc/cli/terminal-format.tssrc/main/runtime/rpc/methods/terminal-manifest-characterization.test.tssrc/main/runtime/rpc/methods/terminal/terminal-query-methods.tssrc/main/runtime/runtime-notifier-contract.tssrc/main/runtime/runtime-terminal-set-pane-title.test.tssrc/main/runtime/workspaces/workspace-removal-target.tssrc/main/window/runtime-window-lifecycle.tssrc/main/window/runtime-window-pane-title-notification.test.tssrc/preload/api/ui-bridge-terminal-and-session-tabs.tssrc/preload/api/ui-command-event-api.tssrc/renderer/src/components/terminal-pane/terminal-pane-lifecycle-types.tssrc/renderer/src/components/terminal-pane/terminal-pane-mount-events-layout-owner.test.tssrc/renderer/src/components/terminal-pane/terminal-pane-mount-events.tssrc/renderer/src/components/terminal-pane/terminal-pane-set-title-event.test.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle-stage.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-mount-lifecycle.tssrc/renderer/src/constants/terminal.tssrc/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.test.tssrc/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.tssrc/renderer/src/hooks/ipc-events/terminal-ui-routing-ipc-bridge.tssrc/renderer/src/web/preload-api/web-ui-api.tssrc/shared/rpc-contract/terminal-unary-params.tssrc/shared/runtime-terminal-contracts.tssrc/shared/runtime-types.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.
| return | ||
| } | ||
| const show = (): void => showRuntimePaneTitle(tabId, leafId, normalizedTitle) | ||
| const worktreeId = findTerminalTabWorktreeId(store.tabsByWorktree, tabId) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect terminal ownership and the main-owned layout write path.
rg -n -C 5 'findTerminalTabWorktreeId|unifiedTabsByWorktree|sendLayoutCommandToOwner|setTabLayout' src/renderer/src/components/native-chat/native-chat-file-link.ts src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts src/renderer/src/hooks/ipc-events/terminal-ui-routing-ipc-bridge.ts src/renderer/src/runtime src/renderer/src/storeRepository: stablyai/orca
Length of output: 45663
🏁 Script executed:
set -eu
printf '%s\n' '--- bridge ---'
nl -ba src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts | sed -n '1,110p'
printf '%s\n' '--- ownership helper ---'
nl -ba src/renderer/src/components/native-chat/native-chat-file-link.ts | sed -n '1,105p'
printf '%s\n' '--- layout owner command ---'
nl -ba src/renderer/src/runtime/layout-owner-command.ts | sed -n '1,220p'
printf '%s\n' '--- setTabLayout declarations and implementations ---'
rg -n -F --glob '*.ts' -e 'setTabLayout' src/renderer/src | head -80
printf '%s\n' '--- unified-only terminal evidence ---'
rg -n -C 5 --glob '*.ts' -e 'hydrated terminal can exist only as a unified tab' -e 'tabsByWorktree.*unifiedTabsByWorktree' -e 'unifiedTabsByWorktree.*tabsByWorktree' -e 'contentType === '\''terminal'\''' src/renderer/src/store src/renderer/src/hooks src/renderer/src/components | head -240Repository: stablyai/orca
Length of output: 41344
🏁 Script executed:
set -eu
printf '%s\n' '--- bridge ---'
nl -ba src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts | sed -n '1,110p'
printf '%s\n' '--- ownership helper ---'
nl -ba src/renderer/src/components/native-chat/native-chat-file-link.ts | sed -n '1,105p'
printf '%s\n' '--- layout owner command ---'
nl -ba src/renderer/src/runtime/layout-owner-command.ts | sed -n '1,220p'
printf '%s\n' '--- setTabLayout declarations and implementations ---'
rg -n -F --glob '*.ts' -- 'setTabLayout' src/renderer/src | head -80
printf '%s\n' '--- unified-only terminal evidence ---'
rg -n -C 5 --glob '*.ts' -e 'hydrated terminal can exist only as a unified tab' -e 'contentType === '\''terminal'\''' src/renderer/src/store src/renderer/src/hooks src/renderer/src/components | head -240Repository: stablyai/orca
Length of output: 41110
🏁 Script executed:
set -eu
printf '%s\n' '--- concrete setTabLayout declarations ---'
rg -n -F --glob '*.ts' -e 'setTabLayout:' -e 'setTabLayout =' -e 'setTabLayout(' src/renderer/src/store src/renderer/src/runtime src/renderer/src/hooks | head -160
printf '%s\n' '--- layout apply send ---'
rg -n -F --glob '*.ts' -e 'function sendLayoutApply' -e 'const sendLayoutApply' -e 'export function sendLayoutApply' -e 'sendLayoutApply' src/renderer/src/runtime src/renderer/src/store src/renderer/src/hooks | head -160
printf '%s\n' '--- terminal slice outlines ---'
rg --files src/renderer/src/store | rg 'terminal.*(slice|layout)|layout.*(slice|store)|store'Repository: stablyai/orca
Length of output: 40660
🏁 Script executed:
set -eu
printf '%s\n' '--- concrete setTabLayout declarations ---'
rg -n -F --glob '*.ts' -e 'setTabLayout:' -e 'setTabLayout =' -e 'setTabLayout(' src/renderer/src/store src/renderer/src/runtime src/renderer/src/hooks | head -160
printf '%s\n' '--- layout apply send ---'
rg -n -F --glob '*.ts' -e 'function sendLayoutApply' -e 'const sendLayoutApply' -e 'export function sendLayoutApply' -e 'sendLayoutApply' src/renderer/src/runtime src/renderer/src/store src/renderer/src/hooks | head -160
printf '%s\n' '--- terminal slice files ---'
rg --files src/renderer/src/store | rg 'terminal.*(slice|layout)|layout.*(slice|store)|store'Repository: stablyai/orca
Length of output: 40731
🏁 Script executed:
set -eu
printf '%s\n' '--- terminal layout state ---'
nl -ba src/renderer/src/store/terminals/terminal-layout-state.ts | sed -n '1,125p'
printf '%s\n' '--- layout apply send ---'
nl -ba src/renderer/src/runtime/layout-apply-send.ts | sed -n '180,345p'Repository: stablyai/orca
Length of output: 12303
Resolve terminal ownership from both tab collections.
A hydrated terminal can exist only in unifiedTabsByWorktree, without a legacy tabsByWorktree row. In that state, findTerminalTabWorktreeId returns null, so the main-owned branch skips renamePane. The fallback updates only renderer state through setTabLayout; main-owned persistence uses sendLayoutApply, so the title can be lost across reloads.
Match unified terminal tabs by entityId or id before using the local fallback.
Suggested fix
export function findTerminalTabWorktreeId(
tabsByWorktree: NativeChatFileLinkState['tabsByWorktree'],
- terminalTabId: string
+ terminalTabId: string,
+ unifiedTabsByWorktree: NativeChatFileLinkState['unifiedTabsByWorktree']
): string | null {
for (const [worktreeId, tabs] of Object.entries(tabsByWorktree)) {
// Why: tabsByWorktree stores TerminalTab records; unified tabs carry
// entityId, but the terminal owner lookup must use the backing tab id.
if (tabs.some((tab) => tab.id === terminalTabId)) {
return worktreeId
}
}
+ for (const [worktreeId, tabs] of Object.entries(unifiedTabsByWorktree ?? {})) {
+ if (
+ tabs.some(
+ (tab) =>
+ tab.contentType === 'terminal' &&
+ (tab.entityId === terminalTabId || tab.id === terminalTabId)
+ )
+ ) {
+ return worktreeId
+ }
+ }
return null
}- const worktreeId = findTerminalTabWorktreeId(store.tabsByWorktree, tabId)
+ const worktreeId = findTerminalTabWorktreeId(
+ store.tabsByWorktree,
+ tabId,
+ store.unifiedTabsByWorktree
+ )
ELI5
A split terminal can now have one of its panes named from the command line, for example
REVIEWER. Naming one pane leaves the other panes and the tab's name alone.What Changed
Adds
orca terminal set-pane-title --terminal <handle> --title "REVIEWER".--title ""clears that pane back to its automatic title. Before this, the CLI had no such command, andterminal renamecould only name the whole tab.terminal renamebehaves as before.How it works:
ui:setPaneTitle). A handle that is stale or unknown is refused, and no other pane is touched.ORCA_LAYOUT_OWNER=mainpath), the window sends the rename to main first, the same way the GUI's Rename does, so the title is saved there too.Why
Agents can label side-by-side panes without someone clicking in the GUI, and without depending on an agent's ever-changing status title. The command reuses the saved pane identity and the existing per-pane title in the layout (
titlesByLeafId), so CLI titles and GUI titles are one and the same and survive reloads. Adding a second title store, or reusingterminal rename, would have renamed the whole tab or let the two drift apart.This rebuilds #24755 on current main. That branch was about 2,400 commits behind and conflicted in 16 files, so the change was re-applied by hand on a fresh branch. The co-author credit from the contributor's original plumbing (#22751) is kept.
Linked Issue
Fixes #22750
Visual Proof
N/A for this PR on its own: the window-side behaviour is the same Rename action users already see. The follow-up PR, which builds on this one for #30329 and #30386, has the live two-instance check.
Testing
New tests:
terminal.setPaneTitle; a missing--titleis refused before any call; an older host's "unknown method" is passed on rather than falling back to a tab rename; help text says "one pane".I ran the full "static analysis and typecheck" job locally (lint, all ratchets, typecheck, generated RPC catalog, bundled guides), plus the test folders around the changed files.
Review
Codex review (gpt-6.1-sol, high). The first pass found that in main-owned layout builds, the window would show the title without main saving it. That is fixed: the window now goes through main first, as the GUI's Rename does. The second pass came back clean.
Agent skill upstream boundary
Notes
terminal.setPaneTitleis a new RPC method. An older host answers "unknown method", and the CLI reports that error as it is. The notifier hook and the preload listener are optional, so an older preload that lingers during a reload is fine. No stream opcode was added.orca-ide --serve) refuses it plainly. The follow-up PR covers client renames reaching that kind of host.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)