Skip to content

fix(runtime): keep WSL workspaces open after host recovery - #29106

Closed
brennanb2025 wants to merge 12 commits into
mainfrom
brennanb2025/wslchat-recovery-workspace
Closed

brennanb2025 wants to merge 12 commits into
mainfrom
brennanb2025/wslchat-recovery-workspace

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #29042.

ELI5

Stopping a WSL distro while its chat was open cleared the selected workspace and tabs when the host recovered. Orca treated a changed connection pairing as a replacement machine. This change keeps open work only when the recovering host has the same current Windows distro registration and guest key; importing a copy under the same name must retire the old host even if the copied guest still has its key.

What Changed

The connection carries the registration ID observed during deployment through the existing saved deployment record into the catalog. Registration changes trigger the existing revision and retirement machinery even when pairing credentials stay unchanged. Unknown current registration cannot reuse the enrollment ID as continuity proof. Ordinary same-registration/key pairing rotations use the existing same-host path, preserving selection and tabs.

Neil-owned modules in scope: wsl-orcad-connection.ts, wsl-host-connection-record.ts, wsl-orcad-deploy.ts, wsl-distro-registry-id.ts, wsl-host-service.ts, and wsl-host-e2e-fake-connector.ts. No mover internals or #29042 grant-resolution behavior is changed. No new saved field, protocol operation, UI, setting or gate is introduced.

Why

Workspace identity survives transport loss. Reusing host continuity fixes the destructive decision before state is deleted. Intended differences: a managed WSL installation requires current Windows registration plus guest key; if current registration cannot be verified, it cannot continue the old host. Explicit removal keeps the existing host-retirement path. Full folder tab/selection cleanup still requires Windows QA; source review found a pre-existing gap after folder catalog removal. Racing Send admission remains a separate follow-up.

Linked Issue

Live Windows QA finding F2 for #29005: terminating the disposable distro cleared the workspace on recovery in both trials.

Visual Proof

Pending coordinator Windows hidden-renderer QA: ordinary restart keeps selection/tabs, copied-key re-import retires old ownership, and explicit removal still clears; repeat with a folder workspace. No screenshots claimed yet.

Testing

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

The existing WSL same-host test now asserts the exact revision continuation. One real manager/service-to-catalog regression covers a changed current registration with unchanged guest key/pairing, failed identity publication and retry through the numeric request fence, and checks census completion, ready feedback and status notices separately from fresh unknown observations. The registry test covers clearing a prior deployment’s cached registration.

No local commands using pnpm, lint, typecheck, tests, install, build or apps were run on the shared Mac. Ordinary commits used no bypass flags; this worktree lacks installed dependencies and Husky wrappers. The full PR workflow passed on 7f2c19b9d36: static analysis/typecheck, all five unit shards, relay integration, and Linux/Windows package checks, including aggregate PR checks passed. All six touched test files appear in the saved execution manifest. The separate WSL lane failed before Orca tests during the systemd distro’s first boot (HCS_E_TERMINATED); live coordinator Windows QA remains required.

Review

The original patch was rejected because it compared the saved enrollment registration before and after reconnect; copied guest keys could incorrectly continue a replacement registration. Fresh independent architecture and source review adopted the observed-registration design and found a further status-only publication issue. The correction marks private callbacks by their source, so only connection observations change identity; unchanged unknown observations still require verification publication. The production correction and final real-service regression passed independent source verification. No tests were executed by reviewers. The readiness-checklist skill is unavailable, so the review records a manual readiness audit instead. This draft is not ready to merge: Windows QA/screenshots and the separate WSL lane failure remain outstanding.

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

A failed final deployment write after a bridge endpoint move closes the connection; explicit Connect may be needed to repair that partial saved state. The files are not a power-loss transaction. SSH uses its existing registration/key mechanism. Folder workspaces share the same host retention/retirement path. Mixed-version peers keep the existing saved field and wire contracts.

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)

@brennanb2025
brennanb2025 changed the base branch from main to brennanb2025/wslchat-stable-client-identity October 15, 2026 09:56
@brennanb2025
brennanb2025 force-pushed the brennanb2025/wslchat-recovery-workspace branch from 29b0af3 to 4f91493 Compare October 15, 2026 10:06
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Stopping a WSL distribution could clear the selected workspace and tabs because recovery treated a changed connection pairing as a replacement machine. This change retains open work only when the current Windows registration and authenticated guest key identify the same installation, and retires old ownership after a same-name re-import even with a copied guest key.

Independent review led to fixes for observed-registration loss and status notices replaying unknown identity; final source verification found no open proven blocking issue. The full PR workflow passed on 7f2c19b9d36, including static analysis/typecheck, all five unit shards, relay integration, Linux/Windows packaging and the required aggregate. The readiness-checklist skill was unavailable, so a manual readiness audit was recorded instead.

This remains a draft. Windows restart/re-import/removal QA and screenshots are pending, including the pre-existing folder tab/selection concern; the separate WSL CI lane failed before Orca tests during the systemd distro's first boot. Unknown-registration retirement remains the agreed conservative behavior, and failed final port publication can require explicit Connect. Racing Send remains separate. This is not ready to merge.

@OrcaWin

OrcaWin commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Windows QA for head 7f2c19b (Windows high spec, real signed-in Claude Code 2.1.302 inside a throwaway WSL2 distro, Codex driving the UI over CDP)

Selection and tabs kept after the desktop restart:
29106-C3-e-workspace.png

Chat still answering after both moves:
29106-C4-2-chat.png

Terminal still working after the in-distro port moved:
29106-C4-3-terminal.png

@brennanb2025
brennanb2025 changed the base branch from brennanb2025/wslchat-stable-client-identity to main October 20, 2026 01:30
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.

2 participants