Skip to content

fix(layout-owner): a held pane keeps its terminal until Reopen; e2e seeding ignores a hook's git env - #51761

Merged
Jinwoo-H merged 4 commits into
layout-owner-v2from
fix/paired-held-pane-e2e
Nov 28, 2026
Merged

Jinwoo-H merged 4 commits into
layout-owner-v2from
fix/paired-held-pane-e2e

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca restarts next to a newer Orca build that may still be running a terminal, it should leave that terminal's pane on hold with a banner and a Reopen button. Under the new layout path, a paired desktop's routine tab activation could quietly start a fresh shell in that pane about two seconds later. The fresh shell replaced the held terminal while the newer build might still be running it, without the user clicking Reopen.

Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​110 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​108
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

Before / after

  • Before: paired-desktop-server-held-pane-reopen failed on fix(layout-owner): Send review notes waits for main's tab, trimmed rename, switch-on fixtures (A6-A8, D1) #51738, the B4 PR and the B1-B3 PR (both attempts each) and passed on layout-owner-v2 pushes. It wasn't lane config and it wasn't a flake: it was a race. The banner showed, then about 2s later the server bound the pane to a new term_… while the fake newer service was still alive. The test passed only when its Reopen click landed before that. Reproduced locally with a switch-on build, and the server-side trace confirms it.
  • After: the pane stays held (banner shown, no terminal, newer service untouched) until Reopen, then binds as before.

Mechanism

  1. The server's first automatic start of the restored pane tries to attach to its stored terminal. This build's terminal service says "session not found", because the terminal never ran in it.
  2. That "not found" counted as proof the terminal had ended, so the stored binding was retired. Then the fresh spawn (with the stored id) was correctly held by the router.
  3. With the binding gone, the next automatic activation started with no stored id. The router's hold only applies to restores of a stored id, so a fresh shell started.

Fix (daemon routing, next to the existing spawn hold): an attach-only lookup that finds nothing while a newer build's service may still run that restorable session now answers terminal_held_by_newer_daemon instead of "not found". Nothing retires the binding, every start stays held, and Reopen restores from it once the newer service is stopped. The predicate is the same one the router already uses for spawns.

The B4 PR's keep-for-swap would not have fixed this on its own: the spawn's failure path still releases the kept binding when the spawn is held.

Git env leak (shared checkout user.name=E2E Test / core.bare)

The e2e repo seeders (tests/{e2e,layout-owner-e2e}/global-setup.ts and host-split-and-sleep-journeys.ts) run git init / git config user.name "E2E Test" with cwd in a temp dir, but they inherit process.env. With GIT_DIR set (a git hook, git bisect run), those writes land in the outer checkout's .git/config: that's the user.name=E2E Test, and git init is the same class as the core.bare flip. Both Playwright configs now import the existing Vitest git-env scrub, renamed inherited-git-env-setup.ts because both runners use it now. The config loads first in the runner and in every worker, so seeding, specs and launched apps all get a clean env.

How it was tested

  • Switch-on e2e build (ORCA_LAYOUT_OWNER=main, marker checked). The spec now asserts the pane stays held for 5s after the banner shows.
    • Without the fix: fails deterministically (handle null becomes term_…).
    • With the fix: 6/6 local passes.
  • Ran the spec with GIT_DIR pointed at a scratch repo: the scratch repo's config stayed clean. The same git init/git config calls without the scrub wrote user.name = E2E Test into it.
  • tc:node, oxlint and oxfmt are clean on the touched files.

Visible changes

Under the new layout path, a pane held for a newer Orca build now keeps showing the existing "opened in a newer version" banner until the user clicks Reopen. Before, a fresh shell could silently replace it. The router change is shared, so it also applies with the switch off: a held local pane now keeps its stored terminal id instead of losing it just before the hold. The banner and Reopen flow there are unchanged. I didn't run a separate switch-off e2e check; the CI suites cover that path.

Census

New finding, no existing row: "held pane started fresh by an automatic activation (switch-on, paired)". It is fixed here. The spec had no expected-fail marker, so there's none to remove.

Performance

None, because the new check only runs when an attach to a stored terminal already failed with "not found". It reads an in-memory flag and does the history-presence check the spawn hold already does. The git-env scrub deletes a few env vars once per test process.

Risk

The riskiest part is the attach-only hold. If a newer build's service is wrongly considered present, restored panes stay held until Reopen instead of starting. That's the same condition and predicate the existing spawn hold uses, so it can't hold anything the spawn wouldn't already hold. A plain revert backs it out.

Level: Low

…eeding ignores a hook's git env

An attach-only lookup that finds nothing in this build's terminal service, while a newer
build's service may still run that restorable session, now answers held instead of not
found, so the pane's stored terminal is not retired and a later automatic activation cannot
start a fresh shell in its place. Playwright configs reuse the Vitest git-env scrub so repo
seeding never writes into the checkout a hook or bisect points GIT_DIR at.
…-test the attach-only hold

The spec now sends two automatic session.tabs.activate calls while the pane is held, so it
fails every run without the router fix instead of depending on the desktop's own timing.
attachOrHold gets a real-hold unit test: held for restorable unknown sessions, ended for no
history or a cleared hold, other outcomes unchanged.
@Jinwoo-H
Jinwoo-H merged commit 66222ad into layout-owner-v2 Nov 28, 2026
80 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.

1 participant