Skip to content

fix(terminal): client pane names reach a desktop host's window, and open panes follow the host's - #30496

Merged
nwparker merged 8 commits into
mainfrom
nwparker/pane-title-live-sync
Oct 19, 2026
Merged

nwparker merged 8 commits into
mainfrom
nwparker/pane-title-live-sync

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​519 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​519
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​260 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​252

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:

  • On a host that runs its own Orca desktop window, a pane name set from a client never reached that window. The host deliberately ignored client pane-layout writes (updateMobileSessionPaneLayout returned early), so the name lived only on the client and was gone after a reload.
  • A pane that was already open on a client picked up host pane names only when it opened. A rename made on the host, or by the CLI, did not show until the pane was opened again.

After:

  1. Client to desktop host. When a client renames a pane, its layout push now says which panes it renamed, in a new optional renamedLeafIds field. 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:
    • A title map sent again with a divider drag, or by an older client, is never treated as a rename. So it cannot revert or erase a name someone set on the host.
    • A single pane whose "name" is just its tab's own name is ignored, neither set nor cleared.
    • If the window can't be reached, the call fails, and the client sends the rename again on its next push.
    • The tab's own name is never touched.
  2. Host to open client panes. An open pane on a client now follows the pane names the host publishes in its layout (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:
    • the host echoes the rename back;
    • the host publishes a newer name of its own (another client renamed the pane, for example);
    • 15 seconds pass;
    • or, after a rename back and forth, an earlier rename is echoed — that doesn't end it; the newest rename keeps being held.
      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.rename or 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:

  • A stale full title map, sent with a divider drag or by an older client, could revert or clear a name set on the desktop. Fixed by forwarding only the panes listed in renamedLeafIds.
  • A hold could last forever if the rename was superseded, failed, or was never echoed (for example by an older desktop host, or a single-pane name dropped as the tab's own). Fixed: the hold ends on a newer host name or after 15 seconds, and expired holds are pruned.
  • A failed push lost the rename. Fixed: the rename is queued again for the next push.
  • Renaming A then B could flash back to A when A's echo arrived. Fixed: the hold remembers the earlier renames still on their way.
  • A rename back to the title the last push carried was skipped by the "unchanged layout" check. Fixed: a rename always sends.
  • The client's own layout write counted as the host's echo. Fixed: the hold is applied where host snapshots enter the client's store.
  • A title for a tab that had never been shown was dropped. Fixed in feat(cli): set the title of one terminal pane #30485.
  • A failed send to the window was reported as success. Fixed: it now fails the call.

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 renamedLeafIds count 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

  • 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: the one addition is the optional renamedLeafIds request 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 published titlesByLeafId since mid-2026.
    • An older desktop host still ignores client pane names. The client keeps its local name, because the rename stays held until the host echoes it, so behaviour is the same as today.
    • An older client gets host names when a pane opens, as before.
  • Headless hosts (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.
  • Folder workspaces and SSH: nothing here depends on git, and the host keeps ownership of the layout.

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
nwparker changed the base branch from nwparker/pane-title-cli to main October 19, 2026 03:28
@nwparker
nwparker force-pushed the nwparker/pane-title-live-sync branch from 20b25fd to 40ad7eb Compare October 19, 2026 03:28
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a74f6ba-0d9a-4405-971d-34fcb1d4c64d
📥 Commits

Reviewing files that changed from the base of the PR and between d509465 and 7a4c7a5.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: 62c81de2-18e7-4ec7-90cc-1d9a193c3bb0
📥 Commits

Reviewing files that changed from the base of the PR and between 40ad7eb and d509465.

📒 Files selected for processing: 9
  • src/main/runtime/rpc/methods/session-tab-mutation-methods.ts
  • src/main/runtime/runtime-desktop-pane-title-forwarding.test.ts
  • src/main/runtime/session-tabs/headless-terminal-tab-close.ts
  • src/renderer/src/components/terminal-pane/remote-pane-layout-push.test.ts
  • src/renderer/src/components/terminal-pane/remote-pane-layout-push.ts
  • src/renderer/src/runtime/pending-pane-title-renames.test.ts
  • src/renderer/src/runtime/pending-pane-title-renames.ts
  • src/renderer/src/runtime/web-runtime-terminal-actions.ts
  • src/shared/rpc-contract/session-tabs-schemas-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The runtime forwards pane titles for renamed leaves to an authoritative desktop window. The renderer tracks pending title changes and includes their leaf IDs in layout updates. It applies host title changes to matching panes, including clears. Tests cover forwarding, retries, title reconciliation, and paired desktop synchronization.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d5094

Pane renames made on a client are forwarded to the desktop host window. Already-open client panes follow host title changes. Clearing a pane name is handled correctly. A client rename that the host never confirms stops masking host names within 15 seconds. No outstanding issue blocks merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning The desktop-window forwarding and open-client synchronization implement the UI behavior in [#30329] and [#30386]. The authoritative-window branch in updateMobileSessionPaneLayout only calls `notifie… For desktop-authoritative tabs, persist the pane title in the host-owned layout or route the rename through the host rename path. Ensure host reloads and host consumers, including terminal.list and session.tabs.listAll, expose the pane-…
Docstring Coverage Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 16 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Out of Scope Changes check Passed The production changes forward client pane renames to the authoritative desktop window, synchronize host names to open host-owned client panes, and retain pending renames until host acknowledgement or…
Title check Passed The title clearly identifies the two main changes: forwarding client pane names to the desktop host window and synchronizing names for already-open panes. It is slightly awkward because it ends with a…
Description check Passed The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issues, visual proof, testing, compatibility considerations, review find…
Full details: Out of Scope Changes check

Explanation

The production changes forward client pane renames to the authoritative desktop window, synchronize host names to open host-owned client panes, and retain pending renames until host acknowledgement or expiry. The tests cover these behaviors and the related retry and stale-snapshot cases. No unrelated production change is demonstrated.

Full details: Title check

Explanation

The title clearly identifies the two main changes: forwarding client pane names to the desktop host window and synchronizing names for already-open panes. It is slightly awkward because it ends with an incomplete possessive phrase, but it remains specific and related to the changeset.

Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issues, visual proof, testing, compatibility considerations, review findings, and checklist status.

Full details: Linked Issues check

Explanation

The desktop-window forwarding and open-client synchronization implement the UI behavior in [#30329] and [#30386]. The authoritative-window branch in updateMobileSessionPaneLayout only calls notifier.setPaneTitle for listed renames and then returns. It does not persist titlesByLeafId in the host layout. It also does not update host projections such as terminal.list or session.tabs.listAll. The PR tests explicitly preserve the saved layout, so a client rename remains unavailable to the host data consumers and can fail the reload and projection requirements in [#30329] and [#30386].

Resolution

For desktop-authoritative tabs, persist the pane title in the host-owned layout or route the rename through the host rename path. Ensure host reloads and host consumers, including terminal.list and session.tabs.listAll, expose the pane-level title without changing the tab title or pane geometry. Add automated coverage for these host-side results.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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: 43e52a2b-6c22-4287-83c7-1a5f73a67fe5
📥 Commits

Reviewing files that changed from the base of the PR and between df0c445 and 40ad7eb.

📒 Files selected for processing: 11
  • src/main/runtime/runtime-desktop-pane-title-forwarding.test.ts
  • src/main/runtime/session-tabs/desktop-pane-title-forwarding.ts
  • src/main/runtime/session-tabs/headless-terminal-tab-close.ts
  • src/renderer/src/components/terminal-pane/use-host-pane-title-sync.test.ts
  • src/renderer/src/components/terminal-pane/use-host-pane-title-sync.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-controller.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts
  • src/renderer/src/runtime/pending-pane-title-renames.test.ts
  • src/renderer/src/runtime/pending-pane-title-renames.ts
  • src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts
  • tests/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.

Comment on lines +9 to +18
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)
}
}

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.

🎯 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/src

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

Repository: 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.ts

Repository: 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.
…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.
@nwparker
nwparker force-pushed the nwparker/pane-title-live-sync branch from 40ad7eb to d509465 Compare October 19, 2026 04:31
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.

Persist pane-level terminal titles (titlesByLeafId) to the host Pane-level terminal rename in Orca Web is not synced to the host

1 participant