Repository navigation
fix(terminal): client pane names reach a desktop host's window, and open panes follow the host's - #30496
Conversation
20b25fd to
40ad7eb
Compare
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · 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:
43e52a2b-6c22-4287-83c7-1a5f73a67fe5
📒 Files selected for processing: 11
src/main/runtime/runtime-desktop-pane-title-forwarding.test.tssrc/main/runtime/session-tabs/desktop-pane-title-forwarding.tssrc/main/runtime/session-tabs/headless-terminal-tab-close.tssrc/renderer/src/components/terminal-pane/use-host-pane-title-sync.test.tssrc/renderer/src/components/terminal-pane/use-host-pane-title-sync.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-controller.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.tssrc/renderer/src/runtime/pending-pane-title-renames.test.tssrc/renderer/src/runtime/pending-pane-title-renames.tssrc/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.tstests/e2e/paired-pane-title-desktop-host.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| export function notePendingPaneTitleRename(args: { | ||
| leafId: string | ||
| title: string | null | ||
| layout: TerminalLayoutSnapshot | undefined | ||
| }): void { | ||
| const ptyIds = Object.values(args.layout?.ptyIdsByLeafId ?? {}) | ||
| if (ptyIds.some((ptyId) => isRemoteRuntimePtyId(ptyId))) { | ||
| pendingTitleByLeafId.set(args.leafId, args.title) | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,150p' src/renderer/src/runtime/pending-pane-title-renames.ts
sed -n '1,120p' src/main/runtime/session-tabs/desktop-pane-title-forwarding.ts
sed -n '215,285p' src/main/runtime/session-tabs/headless-terminal-tab-close.ts
rg -n 'isSyntheticSinglePaneTitle|sanitizeTerminalLayoutPaneTitles|withPendingPaneTitleRenames|notePendingPaneTitleRename' src/main src/renderer/srcRepository: stablyai/orca
Length of output: 11705
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- sanitization ---'
nl -ba src/shared/terminal-pane-title-sanitization.ts
printf '%s\n' '--- rename persistence ---'
nl -ba src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts | sed -n '190,310p'
printf '%s\n' '--- host snapshot title sync ---'
nl -ba src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts | sed -n '150,245p'
printf '%s\n' '--- pending tests ---'
nl -ba src/renderer/src/runtime/pending-pane-title-renames.test.ts
printf '%s\n' '--- title sync callers ---'
rg -n -F --glob '*.ts' -e 'parentLayoutSource' -e 'titlesByLeafId' -e 'withPendingPaneTitleRenames' src/renderer/src/runtime/web-session-tabs-sync src/renderer/src/runtime | head -200Repository: stablyai/orca
Length of output: 21144
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- rename hook context ---'
nl -ba src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts | sed -n '1,190p'
printf '%s\n' '--- pane title forwarding and notifier bindings ---'
rg -n -F --glob '*.ts' -e 'setPaneTitle' -e 'renamePane' -e 'updateMobileSessionPaneLayout' src/main src/renderer/src | head -240
printf '%s\n' '--- pending map lifecycle references ---'
rg -n -F --glob '*.ts' -e 'pendingTitleByLeafId' -e 'deletePane' -e 'removedTitleLeafIdsRef' -e 'leafIds' src/renderer/src/runtime/pending-pane-title-renames.ts src/renderer/src/components/terminal-pane src/renderer/src/runtime/web-session-tabs-sync | head -240
printf '%s\n' '--- current branch diff for relevant files ---'
git diff --unified=30 df0c44571bb3ba8df750ace3092002b4c1fca3f9..40ad7ebc205e7e26c54fd790e047f0d4d0bec8b4 -- src/renderer/src/runtime/pending-pane-title-renames.ts src/main/runtime/session-tabs/desktop-pane-title-forwarding.ts src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.tsRepository: stablyai/orca
Length of output: 42038
Bound pending pane-title renames without releasing them on the first snapshot.
A single-pane title equal to the tab label is recorded before forwarding, then removed by both desktop and headless sanitization. withPendingPaneTitleRenames runs after snapshot sanitization and restores the pending title. A host that does not echo the rename has the same result. The title can remain visible and can reappear as a pane title after a split.
Clear pending state when the title is not forwarded, when the host echoes it, or when the leaf closes. Add a bounded timeout only as a fallback. Do not release the entry on the first snapshot after sending: that snapshot can be stale, and a successful send is not a host acknowledgement. Preserve pending clears; only non-null synthetic single-pane titles should be skipped.
…pen panes follow the host's - A host with its own desktop window ignored client pane-layout writes, so a client's pane rename never reached the window. updateMobileSessionPaneLayout now passes the client's pane names to the window one pane at a time through the set-pane-title path, and still leaves the window's geometry and the tab's name alone. A single pane named after its own tab is dropped, not forwarded. - Open panes on a client only read host pane names when they mounted. They now follow the host's published titlesByLeafId live. A local rename is held until the host echoes it, so a snapshot taken before the host saw it cannot undo it. No wire change: hosts already publish titlesByLeafId, and old peers keep their current behaviour.
…echoed, and fail a dropped window delivery
…s window, and local rename holds are bounded - A client push now names the panes it renamed (optional `renamedLeafIds`), and the host forwards only those. A resent title map, which older clients and every divider drag send, can no longer revert or clear a name set on the host. Older hosts strip the field. Older clients send none, so their renames stay local as they do today. - A held local rename now gives way to a newer host name, a failed push, or a 15s expiry, and expired holds are pruned. A host that never echoes (an older desktop host, or a single-pane name dropped as the tab's own) can no longer hide host titles forever.
…arlier echo cannot undo a newer rename
40ad7eb to
d509465
Compare
ELI5
When you name one pane of a split terminal from the web or from another computer, the computer running the terminals now shows that name too. When the host renames a pane, panes you already have open show the new name right away, with no reload.
What Changed
Builds on #30485 (the CLI command that names one pane), which has to merge first.
Before:
updateMobileSessionPaneLayoutreturned early), so the name lived only on the client and was gone after a reload.After:
renamedLeafIdsfield. The host still leaves the window's geometry alone. It passes only those panes' names to the window, using feat(cli): set the title of one terminal pane #30485's "name this pane" message, and the window applies each one through the same setter as the right-click Rename. Rules:titlesByLeafId). This applies only to host-owned tabs; a window's own local tabs are unaffected. A rename the user makes on the client is held over host snapshots so an older snapshot can't briefly undo it. The hold ends when any of these happens:Expired holds are pruned. Applying a host name writes nothing back to the host.
Why
Pane names and tab names stay separate, as they are in #30433. A pane name never goes through
terminal.renameor the tab's custom title.For gap 1, the window has to stay the owner of its layout. Writing the client's layout into main directly would be overwritten by the window and could fight it. A per-pane message to the window keeps a single owner and reuses one path that is already tested.
For gap 2, the client already receives the host's pane names in every session snapshot; only the open pane ignored them. Reading them there needs no new wire field or opcode. The "hold until echoed" rule handles the one race this adds.
Linked Issue
Fixes #30329
Fixes #30386
Visual Proof
Live check with two isolated, hidden instances: an Orca desktop host and a separate paired Orca desktop client, each with its own throwaway profile. Screenshots are attached to the e2e run (see Testing).
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
src/main/runtime/runtime-desktop-pane-title-forwarding.test.ts: on a host with a desktop window, a client's pane names reach the window as set and clear, with no tab rename and no write to main's saved layout. Omitted titles send nothing. A single pane named after its tab is not forwarded. The first case fails on main.src/renderer/src/components/terminal-pane/use-host-pane-title-sync.test.ts: an open pane picks up a host set and a host clear; local tabs are ignored; a local rename survives a stale snapshot until the host echoes it; panes the host does not hold yet are left alone.tests/e2e/paired-pane-title-desktop-host.spec.ts(live, macOS): a desktop host and a separate paired desktop client, both hidden (ORCA_BACKGROUND_LAUNCH=1, electron-headless project, throwaway profiles). The client names its open pane through the real right-click Set Title menu, and the host window then shows that name while the tab name stays the same. Next the host names the pane through its own menu, and the client's already-open pane shows the new name with no reopen. On feat(cli): set the title of one terminal pane #30485 alone (no fix) the same spec fails at the first step with "the host window never showed the client's pane name"; with this PR it passes (five runs, the last on the final head). The second step depends on the first, so its failing state on main is covered only by the unit test above.I ran the full "static analysis and typecheck" job locally, plus the test folders around the changed files.
Review
Codex review (gpt-6.1-sol, high), repeated until clean; the final head is clean. Fixed findings, from Codex and from the coordinator's Opus review:
renamedLeafIds.Design check
After several review rounds, I compared this design with how established editors keep terminal titles in sync between a client and a remote host. They send a rename as its own explicit, per-terminal operation, kept separate from layout state. A manual rename takes priority over titles the running program sets. Where several people view one session, the view follows a single owner rather than merging edits. This PR follows the explicit-operation model: only the panes listed in
renamedLeafIdscount as renames. The one alternative is a separate rename request instead of a field on the layout push. It would not remove the short hold, because host snapshots carry no revision number, and it would need a capability check for older hosts. So I kept the field.Agent skill upstream boundary
Notes
renamedLeafIdsrequest field. Older hosts drop fields they don't know, and older clients never send it, so their renames stay on the client as they do today. Hosts have publishedtitlesByLeafIdsince mid-2026.orca-ide --serve) still save the client's full title map, as they did before this PR. On those hosts, a stale map sent with a divider drag can still overwrite a newer name.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)