Skip to content

feat(cli): set the title of one terminal pane - #30485

Merged
nwparker merged 3 commits into
mainfrom
nwparker/pane-title-cli
Oct 19, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/pane-title-cli

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​450 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​448
Prod 30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​230 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​221

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, and terminal rename could only name the whole tab. terminal rename behaves as before.

How it works:

  • The host looks up the pane behind the handle, gets its saved pane id, and sends the desktop window a "name this pane" message (ui:setPaneTitle). A handle that is stale or unknown is refused, and no other pane is touched.
  • In the window, a pane that is on screen takes the title through the same local setter the right-click Rename uses. A pane that is not on screen (parked) gets the title written into the saved layout, which it reads the next time it opens.
  • In builds where main owns the layout (the dark ORCA_LAYOUT_OWNER=main path), 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 reusing terminal 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

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New tests:

  • CLI: an explicit title or an empty title reaches terminal.setPaneTitle; a missing --title is 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".
  • Runtime: the saved pane id is used and the title is trimmed or cleared, without a tab rename; stale handles are refused; a desktop without the new hook is refused; a failed send to the window is an RPC error, not a success.
  • Window: the message is sent only to a live window, and a disposed frame is reported once.
  • Renderer: a pane on screen gets set and clear for its own pane id only; a stale pane id or another tab is ignored; parked panes get set and clear in the saved layout and siblings are untouched; unchanged titles send nothing.

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

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

Notes

  • Remote wire compatibility: terminal.setPaneTitle is 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.
  • SSH and headless: the command needs a running Orca desktop on the host. A host without one (orca-ide --serve) refuses it plainly. The follow-up PR covers client renames reaching that kind of host.
  • Success means the window was sent the message. It does not wait for the renderer to confirm.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

nwparker and others added 2 commits October 18, 2026 18:52
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]>
@coderabbitai

coderabbitai Bot commented Oct 19, 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: 47686a95-19b0-48a0-93be-582e70088ec2
📥 Commits

Reviewing files that changed from the base of the PR and between 1d1e5a7 and 55abbdd.

📒 Files selected for processing: 2
  • src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.test.ts
  • src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.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

The change adds orca terminal set-pane-title with a required --title value. An empty string clears the pane title. The runtime resolves the terminal handle to a pane, sends the pane’s durable leaf ID through desktop IPC, and the renderer updates that pane’s layout title. The change also adds command help, output formatting, tests, and CLI examples.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to 55abb

Pane titles set on some restored terminals can disappear after a reload. Fix main-owned persistence for those terminals before merging unless that limitation is explicitly accepted.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 33 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding a CLI command to set the title of one terminal pane.
Description check Passed The description covers the required sections, user-facing behavior, implementation approach, rationale, linked issue, visual proof, testing, compatibility notes, review, and checklist. Manual testing …
Linked Issues check Passed Issue #22750 has coding requirements. The CLI adds terminal set-pane-title with a required title and supports an empty title. Runtime resolution sends the durable leafId, not a numeric pane ID, an…
Out of Scope Changes check Passed The changes stay within issue #22750. CLI registration, RPC contracts, window and preload routing, renderer persistence, layout-owner handling, help text, documentation, and focused tests directly sup…
Full details: Description check

Explanation

The description covers the required sections, user-facing behavior, implementation approach, rationale, linked issue, visual proof, testing, compatibility notes, review, and checklist. Manual testing is unchecked, but automated coverage and local validation are documented adequately.

Full details: Linked Issues check

Explanation

Issue #22750 has coding requirements. The CLI adds terminal set-pane-title with a required title and supports an empty title. Runtime resolution sends the durable leafId, not a numeric pane ID, and does not call tab rename. The renderer validates the addressed tab and leaf, updates titlesByLeafId, preserves sibling titles, and supports clearing and parked panes. Main-owned layouts route through the layout owner. The reported tests cover CLI validation, stale handles, notification errors, persistence, identity reuse, sibling isolation, and mounted and parked panes.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #22750. CLI registration, RPC contracts, window and preload routing, renderer persistence, layout-owner handling, help text, documentation, and focused tests directly support single-pane title setting and clearing. No unrelated product change is demonstrated.

  • 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 091f04d3-17a6-45c2-be69-25dda05c5928
📥 Commits

Reviewing files that changed from the base of the PR and between bf86650 and 1d1e5a7.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 36
  • docs/site/content/docs/cli/reference.mdx
  • skill-guides/orca-cli.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/format.ts
  • src/cli/handler-group-manifest.ts
  • src/cli/handlers/terminal-set-pane-title.test.ts
  • src/cli/handlers/terminal.ts
  • src/cli/help.ts
  • src/cli/root-help-text-primary.ts
  • src/cli/specs/core.ts
  • src/cli/specs/terminal-set-pane-title.ts
  • src/cli/terminal-format.ts
  • src/main/runtime/rpc/methods/terminal-manifest-characterization.test.ts
  • src/main/runtime/rpc/methods/terminal/terminal-query-methods.ts
  • src/main/runtime/runtime-notifier-contract.ts
  • src/main/runtime/runtime-terminal-set-pane-title.test.ts
  • src/main/runtime/workspaces/workspace-removal-target.ts
  • src/main/window/runtime-window-lifecycle.ts
  • src/main/window/runtime-window-pane-title-notification.test.ts
  • src/preload/api/ui-bridge-terminal-and-session-tabs.ts
  • src/preload/api/ui-command-event-api.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-lifecycle-types.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-mount-events-layout-owner.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-mount-events.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-set-title-event.test.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle-stage.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-mount-lifecycle.ts
  • src/renderer/src/constants/terminal.ts
  • src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.test.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/web/preload-api/web-ui-api.ts
  • src/shared/rpc-contract/terminal-unary-params.ts
  • src/shared/runtime-terminal-contracts.ts
  • src/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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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/store

Repository: 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 -240

Repository: 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 -240

Repository: 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
+  )

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.

[Feature]: let the CLI set the title of a single terminal pane

1 participant