Skip to content

fix(runtime): stop paired desktops republishing mirrored editor tabs - #33259

Merged
nwparker merged 2 commits into
mainfrom
nwparker/editor-mirror-echo
Oct 24, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/editor-mirror-echo

Conversation

@nwparker

@nwparker nwparker commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​280 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​278
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12

ELI5

When two Orca desktops pair with each other, each one shows the other's open editor tabs. Before this change, a desktop also announced the tabs it was only showing for its peer as if it had opened them itself. The original desktop took those back and treated its own tab as the peer's. Now a desktop only announces tabs it really opened.

Based on #25877 by BearMett. The core fix is theirs; they are credited as co-author on both commits.

What Changed

Before: desktops A and B are paired in both directions, and A opens src/index.ts. B mirrors it, then lists it in B's own session inventory. A applies B's copy, and A's own tab ends up attributed to B (executionHostId: runtime:<B>).

After: B still shows A's tab, but never lists it. A keeps its own tab, and closing it on A closes it on B with nothing coming back.

Mechanism:

  • isMobilePublishableOpenFile skips rows marked mirroredFromRuntimeSession. Received host tabs already carried that marker, but publishing ignored it. The marker is now part of the open-files sync projection, so a change to it republishes. (fix(runtime): stop paired hosts from echoing mirrored editor tabs #25877)
  • The marker is saved with the session when it is true. It is accepted by the load schema and the layout disk-field table, and restored on hydrate, so a relaunched client does not republish its restored mirrors before the host's first snapshot. (fix(runtime): stop paired hosts from echoing mirrored editor tabs #25877)
  • New: a host frame that hasn't been published yet (publicationEpoch: 'none') no longer culls mirrored editor files. Once restored mirrors keep their marker, that frame would delete a restored dirty mirror and its hot-exit draft. This follows the existing rule in host-session-snapshot-authority.ts: an unpublished frame proves nothing, so it must not drive a cull.
  • New: the windowless host publication (buildHeadlessMobileSessionEditorTabs) skips persisted mirrored rows too. Without this, the echo would come back when no window is open.

Why

The receiving desktop already marks exactly which rows came from a peer, so filtering on that marker is precise. Inferring "mirrored" from runtimeEnvironmentId would hide files a host really owns, such as SSH-owned files or files opened through the focused-environment path.

No wire field, frame or opcode is added. Receivers already treat a missing tab as closed, and a host that has only mirrored tabs already publishes tabs: [].

Mixed versions:

  • New peer, old receiver: the receiver just stops getting the echo.
  • Old peer, new receiver: the old peer still echoes. That direction is unchanged and not fixed here.
  • Downgrade: the persisted-session schema is non-strict, so an old build drops the extra field.
  • Sessions written by old builds: restored rows have no marker. They get re-marked when the host's next snapshot names them.

Linked Issue

Fixes #27984

Visual Proof

N/A. Nothing new is drawn on screen; the change is in which tabs a paired desktop publishes. Hidden-window e2e evidence is under Testing.

Testing

  • Reproduced on origin/main (ceec67b8ec82) with the contributor's hidden reciprocal two-desktop spec, run with ORCA_BACKGROUND_LAUNCH=1 and isolated profiles:
    • B's session.tabs.listAll lists A's src/index.ts as B's own tab.
    • With that check skipped, A's own unified tab is re-attributed to runtime:<B>.
  • With this change: the reciprocal spec and the quit/relaunch restart spec both pass. The restart spec covers persisted marker, legacy unmarked row, and close finality. Also passing: paired-mobile-desktop-mirror.spec.ts (2 tests) and paired-mobile-desktop-mirror-files-git-review.spec.ts.
  • Unit tests (each fails on main):
    • mirrored-editor-tab-republication.test.ts: no republish; a local file in the same worktree still publishes; the tabless fallback path; resync when only the marker changes.
    • mirrored-editor-tab-persistence.test.ts: the marker survives save, load and hydrate, and is not republished. A restored dirty mirror survives an unpublished frame and is culled by a real empty one.
    • mobile-session-editor-projection.test.ts: the headless projection skips mirrored rows.
  • Static job: the full pr.yml static job passes locally (lint, format, anti-slop, code-quality plugins, type-aware, changed-code quality, typecheck:ci, ratchets, runner check, localization).
  • Import graph: the 261 test files that import the changed modules pass.
  • Cross-version: daemon-protocol crossing and launcher ratchet pass, as do the session-tabs and web-session cross-version wire suites. The full cross-version suite hit shared release-cache lock contention and timeouts on a loaded machine, so CI covers the rest.

Not kept from #25877, for test-cost reasons:

  • the two e2e specs and their five helpers (about 1.4k lines, soak-heavy);
  • the 575-line release-checkout cross-version suite;
  • the pr-code-change-scope routing change.

They were run locally as verification.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Codex (pinned base ceec67b8ec82): round 1 found the unpublished-frame draft loss (P1), fixed in the second commit; round 2 is clean. An independent Opus review found the headless-publication gap (P2), now fixed; round 2 reports no P0–P2.

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

  • Not fixed: an old peer still echoes mirrored tabs to a new host.
  • Known limitations:
    • A mirror restored from an environment that has since been unpaired stays marked and unpublished.
    • A dirty mirror still closes without a prompt when its host really closes the tab. That is pre-existing behaviour for live mirrors.
  • Not verified live: SSH, WSL and Windows. The change is platform-neutral renderer/session logic.
  • Folder workspaces are covered by the reciprocal spec: a host folder file is mirrored and not echoed.

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 and others added 2 commits October 24, 2026 13:23
When two desktops pair both ways, B mirrored A's editor tabs and then
published them in its own session inventory as if B had opened them. A
then applied B's copy, which took over A's own tab.

isMobilePublishableOpenFile now skips rows marked
mirroredFromRuntimeSession, the marker is part of the open-files sync
projection so a flip republishes, and the marker is saved with the
session and restored so a relaunched client does not republish its
restored mirrors before the host's first snapshot.

Based on #25877 by BearMett.

Co-authored-by: BearMett <[email protected]>
…t of headless publication

A restored mirror now carries its marker, so an unpublished host frame
must not cull it (and its recovered draft). The windowless publication
skips persisted mirrored rows for the same reason the window does.

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

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: fb5e1d50-8bd0-4ebe-a76e-97aec78bf60c
Commits

Reviewing files that changed from the base of the PR and between c90d0f9 and 1788af5.

Files selected for processing: 15
  • src/main/runtime/mobile-session-editor-projection.test.ts
  • src/main/runtime/mobile-session-editor-projection.ts
  • src/renderer/src/lib/workspace-session.ts
  • src/renderer/src/runtime/sync-runtime-graph-projection-hot-path.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/mirrored-editor-tab-persistence.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/mirrored-editor-tab-republication.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/mobile-session-surfaces.ts
  • src/renderer/src/runtime/sync-runtime-graph/sync-projections.ts
  • src/renderer/src/runtime/web-session-tabs-sync-editor-tabs.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-preparation-browser.ts
  • src/renderer/src/store/slices/editor/actions/hydrated-editor-session-state.ts
  • src/shared/workspace-layout/workspace-layout-disk-fields.ts
  • src/shared/workspace-layout/workspace-layout-fact-locations.test.ts
  • src/shared/workspace-session-editor-schema.ts
  • src/shared/workspace-session-state-types.ts
  • 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.

@nwparker
nwparker merged commit 917899b into main Oct 24, 2026
52 checks passed
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]: Paired desktops republish mirrored editor tabs, including after restart

1 participant