Skip to content

fix(terminal): report the host's saved pane names in terminal.list, and make clearing the last one stick - #30433

Merged
nwparker merged 1 commit into
mainfrom
nwparker/pane-title-host-sync
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/pane-title-host-sync

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​95 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​95
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25

ELI5

When you name a pane in a split terminal from Orca Web or a paired desktop, the host saves that name. But orca terminal list never showed it, and clearing the last pane name you had set did nothing on the host. Now the CLI shows the host's saved pane name, and clearing works.

What Changed

Before

  • A paired or web client renames a pane. The client sends the host its full list of pane names. The host saves it (titlesByLeafId in the tab's saved layout) and passes it on to the other clients.
  • orca terminal list, terminal show and the terminal.list RPC never read that saved name, so they kept showing the terminal's own title.
  • When you cleared the last pane name in a tab, the client sent no list at all. Every host reads a missing list as "unchanged", so it kept the old name and gave it back on the next reload.

After

  • Terminal summaries (terminal.list, terminal.show) carry a new optional paneTitle field, read from the host's saved layout. Text output from orca terminal list prints it in place of the terminal title, and terminal show adds a paneTitle: line. title itself is unchanged.
  • Clearing the last pane name sends an empty list (titlesByLeafId: {}), which the host saves as cleared.

Mechanism

  • src/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.ts: one getSavedPaneTitle(worktreeId, tabId, leafId) lookup, used by both the pane summary and the process-only summary (terminal/query/pty-terminal-summary.ts).
  • src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts: when the user has cleared a pane name and none are left, the remote layout push sends {}.

Why

The host's saved layout is already where every client's pane rename lands, and #30037 made the host's own record the single source of truth for tab names. This keeps pane names on the same model: the host's saved layout is the one record, and host readers report it.

Superseded approach (#30333, @wangshifeng): that PR sent each pane rename through terminal.rename. That method renames the whole tab. On a desktop it calls setTabCustomTitle(tabId). On a headless host it saves and publishes the tab's customTitle, which since #30037 every paired client adopts. So naming one pane of a split renamed the tab everywhere, including on the user's own desktop, because a local worktree routes to the local runtime. Clearing a pane name also wiped the tab's manual name. This PR keeps pane names and tab names separate. Thanks to @wangshifeng for the investigation and report. The commit carries a Co-authored-by trailer.

Why a new field instead of changing title: title feeds agent detection (resolvePaneAgentIdentityField) and the orchestration code that addresses terminals. Putting a user's label in place of the terminal's live title there would change agent identity and status for every reader.

Mixed versions

  • paneTitle is optional. Old CLIs and clients ignore it. A new CLI talking to an old host falls back to title.
  • {} needs no wire change. Old hosts already accept z.record(...) and store {} as written (...(args.titlesByLeafId ? { titlesByLeafId } : {})), so clearing works against old hosts too.

Not covered here (follow-up): a host that has its own desktop window (shared control) still drops pane-layout writes from clients on purpose (updateMobileSessionPaneLayout returns early while that window is open). Sending those names on to the window needs a main-to-window "set this pane's title" path. My open PR #24755 builds that path for terminal set-pane-title, so the forwarding belongs on top of it rather than as a second mechanism. Mounted panes also adopt host-published names only when they mount, not live.

Linked Issue

Related: #30329, #30386. Partly addresses both: headless hosts (orca-ide --serve) are covered; desktop-window hosts need the follow-up above.

Visual Proof

N/A: no layout change. orca terminal list text output now prints the pane name; the before/after is covered by tests.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • src/main/runtime/orca-runtime-tests/headless-pane-title-terminal-list.spec.ts (new, runs via orca-runtime.test.ts). On a headless host, a client pane rename shows in terminal.list and terminal.show. Clearing with {} drops it. The terminal title does not change. The first case fails on main.

  • terminal-layout-gesture-persist.test.tsx: clearing the last remote pane title pushes titlesByLeafId: {}. Fails on main, where the field is absent.

  • terminal-list-host-scope-format.test.ts: CLI list prints paneTitle, and falls back to title.

  • Ran locally: the files above, the neighbouring terminal-pane suites, all of src/cli, orca-runtime.test.ts, headless pane-layout tests, and the full "static analysis and typecheck" job steps (lint, type-aware lint, typecheck:ci, all ratchets).

  • Verified live: nothing. This was tested in unit and runtime tests only. I did not run a real --serve host with a web client.

Review

Codex review (gpt-6.1-sol, high): no findings.

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

Security: none (a read of the host's own saved layout). Cross-platform: no platform branches. SSH/remote: host-side read; works for any host type. Mobile: unchanged (mobile does not read titlesByLeafId). Performance: one map lookup per listed terminal.

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)

…ring the last one sticks

A client's pane rename already lands in the host's saved layout (titlesByLeafId),
but terminal.list/show never read it, and clearing a remote tab's last pane title
sent no titles at all, which every host reads as 'unchanged'.

- terminal summaries carry an optional paneTitle from the host's saved layout;
  the CLI list prints it ahead of the terminal title. Older hosts omit it.
- clearing the last pane title of a remote tab pushes titlesByLeafId: {}, which
  old and new hosts both persist as cleared.

Supersedes #30333, which renamed the whole tab via terminal.rename.

Co-authored-by: wangshifeng <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Remote layout updates now send an explicit empty titles map when the final pane title is cleared. Terminal summaries include a saved pane title when available. CLI list output prefers the pane title, and terminal-show output adds a pane-title line only when one is present.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to d4187

A client left open after clearing a pane name can erase a newer name saved by another client. Resolve the replay before merging unless that risk 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 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 9 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 two primary changes: reporting saved pane names and persisting removal of the last name.
Description check Passed The description is complete and closely follows the template. It explains the user impact, implementation, rationale, linked issues, testing, limitations, and compatibility considerations.
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.
  • 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: b8713d11-766f-47f5-bebb-843641443137
📥 Commits

Reviewing files that changed from the base of the PR and between bad74e1 and d418729.

📒 Files selected for processing: 9
  • src/cli/terminal-format.ts
  • src/cli/terminal-list-host-scope-format.test.ts
  • src/main/runtime/orca-runtime-tests/headless-pane-title-terminal-list.spec.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.ts
  • src/main/runtime/terminal/query/pty-terminal-summary.ts
  • src/renderer/src/components/terminal-pane/terminal-layout-gesture-persist.test.tsx
  • src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts
  • src/shared/runtime-terminal-contracts.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.

Comment on lines +134 to +140
const clearedEveryTitle =
!layout.titlesByLeafId &&
[...currentLeafIds].some((leafId) => removedTitleLeafIds.has(leafId))
remotePaneLayoutPusherRef.current?.push({
worktreeId,
tabId,
layout: clearedEveryTitle ? { ...layout, titlesByLeafId: {} } : layout,

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 | 🏗️ Heavy lift

Stop replaying a completed title removal.

After this push clears the last title, removedTitleLeafIdsRef still contains the leaf ID. If another client names that pane, a later layout push from this mounted client sends {} again and clears the newer name. Consume the removal marker after the host accepts the clear. Keep any retry state separate from subsequent layout snapshots.

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.

1 participant