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

* fix(runtime): stop paired desktops republishing mirrored editor tabs

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 <agomdole@gmail.com>

* fix(runtime): keep restored mirrors through unpublished frames and out 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 <agomdole@gmail.com>

---------

Co-authored-by: BearMett <agomdole@gmail.com>
This commit is contained in:
Neil
2026-10-24 14:28:33 -07:00
committed by GitHub
co-authored by BearMett
parent 976fa11e81
commit 917899bf8d
15 changed files with 301 additions and 11 deletions
@@ -200,6 +200,7 @@ const FILE = {
language: own('file', 'language'),
isPreview: tab('isPreview'),
runtimeEnvironmentId: own('file', 'runtimeEnvironmentId'),
mirroredFromRuntimeSession: own('file', 'mirroredFromRuntimeSession'),
externalSshTargetId: own('file', 'externalSshTargetId'),
dirtyDraftContent: own('editorDraft', 'dirtyDraftContent'),
lastKnownDiskSignature: own('editorDraft', 'lastKnownDiskSignature'),
@@ -126,6 +126,7 @@ function populate(loaded: LoadedWorkspaceLayout): LoadedWorkspaceLayout {
fill(loaded, 'tab.terminal.forceHostRuntime', true)
fill(loaded, 'file.externalSshTargetId', 'box')
fill(loaded, 'file.runtimeEnvironmentId', 'env')
fill(loaded, 'file.mirroredFromRuntimeSession', true)
fill(loaded, 'file.readOnly', true)
fill(loaded, 'file.liveTail', true)
// A focused and an expanded pane that is not the first, so a fallback is visible.
@@ -10,6 +10,7 @@ export const persistedOpenFileSchema = z.object({
language: z.string(),
isPreview: z.boolean().optional(),
runtimeEnvironmentId: z.string().nullable().optional(),
mirroredFromRuntimeSession: z.literal(true).optional(),
externalSshTargetId: z.string().trim().min(1).optional(),
dirtyDraftContent: z.string().optional(),
lastKnownDiskSignature: z.string().optional(),
@@ -21,6 +21,7 @@ export type PersistedOpenFile = {
language: string
isPreview?: boolean
runtimeEnvironmentId?: string | null
mirroredFromRuntimeSession?: true
/** SSH target that owns an absolute path outside the worktree. */
externalSshTargetId?: string
/** Unsaved editor buffer captured for hot exit; presence restores the tab dirty. */