Repository navigation
fix(terminal): report the host's saved pane names in terminal.list, and make clearing the last one stick - #30433
Conversation
…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]>
📝 Walkthrough
Priority: ⬇️ Low 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:
b8713d11-766f-47f5-bebb-843641443137
📒 Files selected for processing: 9
src/cli/terminal-format.tssrc/cli/terminal-list-host-scope-format.test.tssrc/main/runtime/orca-runtime-tests/headless-pane-title-terminal-list.spec.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.tssrc/main/runtime/terminal/query/pty-terminal-summary.tssrc/renderer/src/components/terminal-pane/terminal-layout-gesture-persist.test.tsxsrc/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.tssrc/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.
| const clearedEveryTitle = | ||
| !layout.titlesByLeafId && | ||
| [...currentLeafIds].some((leafId) => removedTitleLeafIds.has(leafId)) | ||
| remotePaneLayoutPusherRef.current?.push({ | ||
| worktreeId, | ||
| tabId, | ||
| layout: clearedEveryTitle ? { ...layout, titlesByLeafId: {} } : layout, |
There was a problem hiding this comment.
🗄️ 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.
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 listnever 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
titlesByLeafIdin the tab's saved layout) and passes it on to the other clients.orca terminal list,terminal showand theterminal.listRPC never read that saved name, so they kept showing the terminal's own title.After
terminal.list,terminal.show) carry a new optionalpaneTitlefield, read from the host's saved layout. Text output fromorca terminal listprints it in place of the terminal title, andterminal showadds apaneTitle:line.titleitself is unchanged.titlesByLeafId: {}), which the host saves as cleared.Mechanism
src/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.ts: onegetSavedPaneTitle(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 callssetTabCustomTitle(tabId). On a headless host it saves and publishes the tab'scustomTitle, 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 aCo-authored-bytrailer.Why a new field instead of changing
title:titlefeeds 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
paneTitleis optional. Old CLIs and clients ignore it. A new CLI talking to an old host falls back totitle.{}needs no wire change. Old hosts already acceptz.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 (
updateMobileSessionPaneLayoutreturns 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 forterminal 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 listtext 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 viaorca-runtime.test.ts). On a headless host, a client pane rename shows interminal.listandterminal.show. Clearing with{}drops it. The terminaltitledoes not change. The first case fails on main.terminal-layout-gesture-persist.test.tsx: clearing the last remote pane title pushestitlesByLeafId: {}. Fails on main, where the field is absent.terminal-list-host-scope-format.test.ts: CLI list printspaneTitle, and falls back totitle.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
--servehost with a web client.Review
Codex review (gpt-6.1-sol, high): no findings.
Agent skill upstream boundary
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)