Skip to content

fix(runtime): show terminal renames on paired desktops when no host pane holds the terminal - #41882

Closed
LDH1103 wants to merge 3 commits into
stablyai:mainfrom
LDH1103:fix/terminal-rename-paired-clients
Closed

LDH1103 wants to merge 3 commits into
stablyai:mainfrom
LDH1103:fix/terminal-rename-paired-clients

Conversation

@LDH1103

@LDH1103 LDH1103 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you rename a terminal on a computer that another Orca is paired to, the paired Orca learns the new name from a list the host keeps. If the host's own window was open but wasn't showing that terminal, the host saved the name but never updated that list, so the paired Orca kept the old name.

What Changed

Before: orca terminal rename on the host succeeded and orca terminal list showed the name, but a paired desktop's tab kept its old title.
After: the paired desktop's tab shows the new name, and renaming to null clears it there too.

Mechanism: renameTerminal updates customTitle on the host's mobile session snapshot only in its no-window branch. This PR does the same in the branch where a window exists but none of its panes holds the terminal, which is the branch orphaned terminals take. The publication code moved into a private publishManualTerminalTitle shared by both branches. applyHeadlessSessionTabPropsToSnapshot takes a new optional keepPublicationEpoch; the new call passes it, so the window's snapshot keeps its epoch and only snapshotVersion goes up.

Why

Paired desktops already take the host's customTitle over their own (#29975); the row just never got the name in this case.

Why keep the epoch: the no-window path stamps a headless: epoch, which makes later merges preserve terminals broadly. On a snapshot the window published, that could bring back tabs the window had closed. A content-only change keeps the epoch and bumps the version, as session-window-graph.ts does for graph-only changes.

Alternative considered: apply the rename in the host window. The window has no tab owning the terminal, so setTabCustomTitle returns early; giving it one means adopting the terminal into the window's graph, a much larger change than publishing a field the client already reads.

Linked Issue

Fixes #41881

Visual Proof

N/A: the change is which title a paired desktop's tab shows, and the test asserts the published customTitle. I did not record the two-PC setup.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

One runtime test has a window publish a snapshot with the terminal's row while no window pane holds the terminal, subscribes as a paired desktop, renames it, and asserts the published row carries the name, the snapshot keeps the window's epoch, and its version goes up. Removing the new publication fails on the missing name; dropping keepPublicationEpoch fails with a headless: epoch.

Ran on Windows: the rename retention test file (7 tests, all pass), pnpm check:changed --base=upstream/main (24 of 25 checks pass, typecheck and changed-code quality included), and pnpm test:changed (1806 pass, 38 fail). Every failure is in a file that never calls renameTerminal or the changed snapshot helper: Windows temp-folder cleanup (EPERM/EBUSY), spawn git ENOENT, a missing v1.4.222 tag, and git worktree removal or real-checkout cases.

Not done: a check on a built app with a real paired desktop.

Risk

The riskiest part is publishing from the window-present branch. The row is updated only if it already exists; if a later window publication rebuilds it without customTitle, paired desktops keep their last known name, as they do today for older hosts. Older paired desktops that ignore customTitle are unaffected. Nothing is written to saved data beyond what the rename already saved. Back out with a plain revert.

Level: Low

AI Disclosure

LDH1103 used Claude Code (Claude Opus 5.5) for investigation, implementation, tests, and this description, and directed the work and approved opening this PR.

Review

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

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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 (typecheck and the related tests ran locally; CI covers the rest)

…ane holds the terminal

When the host window was running but none of its panes held the terminal,
renameTerminal saved the name and told the window, but never updated the
mobile session snapshot row. Paired desktops read customTitle from that row,
so they kept the old title.

Publish the name in that branch too, keeping the window's publication epoch
so a content-only change cannot resurrect tabs the window closed.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Manual terminal renames now update the headless session snapshot when no window pane holds the terminal. The update preserves the existing publication epoch in this case. Title normalization and fallback-title restoration use a shared helper. Tests check title retention after PTY replacement and runtime restart, and check the published snapshot title, epoch, and version.

Severity of issue fixed: Medium

Merge Risk: Low · up to 1cebf

Renaming a terminal when no desktop pane holds it now updates the paired desktop's tab title. One variant remains: if the terminal is still tracked as a detached leaf, the rename may still not reach the paired desktop. This is narrow and recoverable, so it is acceptable to merge with follow-up.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: renames of terminals are now shown on paired desktops when no host pane holds the terminal. It uses the fix(runtime) convention and matches the snapshot publication ch…
Description check Passed The description follows the repository template. It has ELI5, What Changed (before/after and mechanism), Why (with alternative considered), a linked issue (Fixes #41881), Visual Proof marked N/A with …
Linked Issues check Passed [#41881] requires a paired desktop to show a host terminal's new name when the host window runs but no pane holds the terminal. At the reviewed head, renameTerminal in runtime-terminal-names.ts ca…
Out of Scope Changes check Passed All changed areas connect to [#41881]. runtime-terminal-names.ts moves the existing publication code into the private publishManualTerminalTitle helper. Both branches use that helper, so the extra…
Full details: Title check

Explanation

The title names the main change: renames of terminals are now shown on paired desktops when no host pane holds the terminal. It uses the fix(runtime) convention and matches the snapshot publication change in the diff. It is 91 characters, slightly long but readable.

Full details: Description check

Explanation

The description follows the repository template. It has ELI5, What Changed (before/after and mechanism), Why (with alternative considered), a linked issue (Fixes #41881), Visual Proof marked N/A with a reason, Testing with checkboxes and platform details, Risk with level Low and a back-out path, AI Disclosure, and the checklist. Gaps: the template's unchecked lint/typecheck/test/build item is only partially met, the Review section is empty, and the manual testing box is unchecked. These are minor and do not affect the core content.

Full details: Linked Issues check

Explanation

[#41881] requires a paired desktop to show a host terminal's new name when the host window runs but no pane holds the terminal. At the reviewed head, renameTerminal in runtime-terminal-names.ts calls publishManualTerminalTitle in the branch where this.notifier?.renameTerminal exists and tabId is known. The helper passes customTitle (trimmed, or null) to applyHeadlessSessionTabPropsToSnapshot, which writes it to the matching terminal row of the host's mobile session snapshot. Paired desktops read that field (#29975). The new call passes keepPublicationEpoch: true. In headless-tab-properties.ts, the function keeps snapshot.publicationEpoch and increments snapshotVersion when that option is set. The null case also resets title through the same helper. The no-window branch still publishes as before. The rename-retention test file reports 7 passing tests, including a runtime test for the window-present branch. I did not run the tests. Limits: no built-app check with a real paired desktop was run, and the evidence covers the published snapshot, not the rendered tab. These limits do not show a missing requirement.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to [#41881]. runtime-terminal-names.ts moves the existing publication code into the private publishManualTerminalTitle helper. Both branches use that helper, so the extraction supports the new window-present publication. headless-tab-properties.ts adds the optional keepPublicationEpoch parameter that the new call uses. The test file adds the type import and the runtime test for the new branch. The incremental diff from the previous reviewed head could not be read because the diff metadata exceeded the inspection buffer. The whole-PR diff for runtime-terminal-names.ts was read and matches the described change. The whole-PR diff for headless-tab-properties.ts could not be read as a diff, but its file content at head matches the described change. No changed hunk touches unrelated behavior that I could establish.

  • 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

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

Nitpick comments: 1

src/main/runtime/terminal/title/orca-runtime-terminal-rename-retention.test.ts: 1

104-104: Trivial · Maintainability & Code Quality · Quick win

Add a window-origin snapshot regression case.

This test initializes the snapshot from a headless fixture. It does not establish a window-origin publicationEpoch. The title assertion could still pass if the rename incorrectly assigned a new headless: epoch.

Add a case with a window-origin snapshot. After the rename, assert that customTitle changes, publicationEpoch stays unchanged, and snapshotVersion increases. This covers the publication contract intended to prevent closed tabs from reappearing.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c6f5f437-62d4-4a8a-862a-ace6f013fe72
Commits

Reviewing files that changed from the base of the PR and between a0fc70d and b4eced4.

Files selected for processing: 3

  • src/main/runtime/session-tabs/headless-tab-properties.ts
  • src/main/runtime/terminal/title/orca-runtime-terminal-rename-retention.test.ts
  • src/main/runtime/terminal/title/runtime-terminal-names.ts

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

Main now delivers desktop session-tab frames after a microtask sender pass, so the paired-client rename test waits for the published title instead of reading it synchronously.

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Publish the snapshot title for a rename that matches a… · runtime-terminal-names.ts:29-32

src/main/runtime/terminal/title/runtime-terminal-names.ts:29-32
Minor · Functional Correctness · Quick win

Publish the snapshot title for a rename that matches a detached leaf.

renameTerminal returns at line 32 when this.leaves contains a leaf for the PTY. The mobile snapshot publication runs only after that loop, at lines 37-43. syncWindowGraph adds detached pre-allocated leaves to the leaf store when no window graph pane holds their PTY. For such a terminal, a rename returns early and does not publish customTitle to the mobile snapshot row. Paired desktops then keep the previous name, which is the reported symptom.

Require that a rename of a terminal with no window pane updates the snapshot row. This includes a terminal whose matching leaf is a detached pre-allocated leaf. Keep the notifier.renameTerminal call for panes that a window holds. The publication point must preserve that path's current behavior. The inspected source does not establish which condition distinguishes a detached leaf from a window-held leaf in this.leaves, so this comment does not prescribe a patch.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c9989f69-c0d0-4231-b61f-9c535d1dff64
Commits

Reviewing files that changed from the base of the PR and between 06689ea and 1cebfc8.

Files selected for processing: 3

  • src/main/runtime/session-tabs/layout/headless-tab-properties.ts
  • src/main/runtime/terminal/title/orca-runtime-terminal-rename-retention.test.ts
  • src/main/runtime/terminal/title/runtime-terminal-names.ts

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

@nwparker

Copy link
Copy Markdown
Contributor

Thanks for this. The underlying issue (#41881) has been fixed on main and is closed, so terminal renames now reach paired desktops. Closing as already fixed.

@nwparker nwparker closed this Nov 28, 2026
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.

[Bug]: Renaming a host terminal leaves the old name on a paired desktop when no host pane holds the terminal

2 participants