Skip to content

fix(wsl-mover): the move gate reads terminals a relaunched window has not reopened - #32923

Closed
nwparker wants to merge 3 commits into
nwparker/wsl-move-open-pane-fixesfrom
nwparker/wsl-mover-relaunch-gate
Closed

nwparker wants to merge 3 commits into
nwparker/wsl-move-open-pane-fixesfrom
nwparker/wsl-mover-relaunch-gate

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​186 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​186
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8

ELI5

After Orca restarted, the "move this project into WSL" check said "can't check" for every open WSL terminal, so no move could ever start after a restart. Now the check asks the terminal background service directly, so idle terminals pass and busy ones still block.

What Changed

Before: after an app relaunch, every live WSL bridge terminal read unverifiable in the move preview, and it stayed that way across re-checks. Idle shells, finished background jobs and killed jobs all looked the same (awin verify-6, item 5).

After: idle terminals pass and busy ones still block, exactly as before the relaunch.

Mechanism: the app keeps a list of the terminals it has spawned or reopened, and checks that list before inspecting a terminal. A relaunched window doesn't reopen terminals in projects it hasn't shown yet. Those terminals keep running in the terminal daemon, and the runtime still lists them for the move. The pre-check read them as "gone", though, so the inspection gave up with terminal_gone, which counts as unverifiable. The move gate now passes a new opt-in includeUnattached inspection option. That option skips the pre-check and asks the daemon, which still refuses a session that has really ended. No other caller passes it, so close-tab warnings, polling and adoption are unchanged and pay nothing extra.

Also adds a test (no product change) for verify-6 item 5d, the "idle agent stuck at agent-working" report. The test replays the stub agent's hook events through the real hook server and the gate: once Stop arrives, the gate reads ready. The stuck reading came from the test stub, which sent SessionStart at launch. Orca treats SessionStart as the start of a turn, so a stub that never got a prompt read as working. The stub has since been fixed.

Why

  • Making hasPty count every session the daemon still runs would also change adoption cleanup and the renderer's reattach decisions. An opt-in confined to the move gate keeps the change behind the WSL-mover gate.
  • Relying on the in-distro check alone (fix(wsl-mover): no silent stale window after Use on this computer again; log open-pane gaps #32828's 3547d37) works only when Windows can't see a pane at all. This change fixes why the host couldn't see it, so the host's own answer is real again.
  • A suspected cause was that the relaunched app loses the pane key. A two-launch e2e on macOS found the runtime still holds the original pane key in that case. 308557f covers the other paths where it does not.

Linked Issue

Internal (WSL-via-orcad tracker, D1b-10 verify-6). Stacked on #32828.

Visual Proof

N/A: no UI change. The gate verdict changes for panes that were reported as "can't check".

Testing

  • Reproduced on macOS with a two-launch e2e (not committed, because it uses the renderer inspection path, which deliberately keeps the old behaviour). After the relaunch, an idle pane in an unopened project inspected as {verdict:'unverifiable', reason:'terminal_gone'}.

  • src/main/daemon/daemon-relaunch-unattached-inspection.test.ts uses a real daemon server and a fresh adapter as the relaunched app. It checks:

    • the gate gets a real answer (this fails on the old code);
    • other callers still see "gone";
    • an ended session reads unverifiable;
    • an unreachable daemon reads unverifiable, never exited.
  • src/main/persistence/moving-wsl-projects/wsl-move-gate-stub-agent-hooks.test.ts.

  • pnpm tc:node; the moving-wsl-projects tests pass.

  • Not yet run on Windows; that's the next awin verify build.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Notes

The behaviour is gated: the option is used only by the WSL move gate, which sits behind ORCA_INTERNAL_WSL_HOSTS. Not tested over SSH; remote terminals never reach this gate.

@nwparker
nwparker marked this pull request as ready for review October 23, 2026 20:55
@nwparker
nwparker force-pushed the nwparker/wsl-mover-relaunch-gate branch from 4c17bcf to 8687736 Compare October 23, 2026 21:08
nwparker and others added 3 commits October 23, 2026 14:25
… reopened

After an app relaunch, every live WSL bridge pane read "cannot check" and blocked every
move (awin verify-6, item 5). Root cause: the daemon adapter's hasPty only knows sessions
this app process spawned or reattached. A pane the relaunched window had not reopened is
still running in the daemon and listed by the runtime, but the inspection pre-check read
hasPty=false as terminal_gone, so the probe was unverifiable. Reproduced on macOS with a
two-launch e2e: an idle pane in an unopened workspace inspected as
{verdict:'unverifiable', reason:'terminal_gone'} after the relaunch. The same run showed the
runtime still holds the pane's original paneKey, so the paneKey theory is refuted.

The gate now passes includeUnattached, which skips that pre-check and asks the daemon,
which still refuses a session it no longer runs. Other callers keep the old behaviour.

Co-Authored-By: Claude <[email protected]>
…p arrives

awin verify-6 item 5d was inconclusive: p4's stub agent answered, but the preview stayed
"agent-working". Replaying the D1b-10 stub's hook payloads through the real hook server and
the gate's fact collection shows Stop settles the pane to done and the gate reads ready, so
the Stop path is not at fault. The run's screenshot (ev/p4-agent2.png) shows the likely cause:
the harness launched the stub twice in p4, and one instance sat at its prompt having fired
only SessionStart. The stub fires SessionStart at launch, which Orca's Codex normalizer treats
as a turn start, so a stub never given a prompt reads as working. No product change.

Co-Authored-By: Claude <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor Author

Contained in the dark landing PR #34059 (its head commit is an ancestor of the landing branch). Closing in favour of it; branch kept.

@nwparker nwparker closed this Oct 26, 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.

1 participant