Skip to content

fix(codex): never scan a WSL history source over 9P from background lanes (E9) - #35677

Merged
nwparker merged 3 commits into
mainfrom
nwparker/codex-history-skip-wsl-sources
Oct 29, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/codex-history-skip-wsl-sources

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​66 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​63
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16

ELI5

You can tell Orca to read your Codex history from a custom folder ("Codex history source"). If that folder is inside a WSL distro (a \\wsl.localhost\… path), several background tasks on the Windows side scanned it directly. Reading a distro's files from Windows starts the distro if it's stopped. Orca must never do that in the background (E9), and links made across that boundary don't resume in Codex anyway. Those background tasks now leave such a folder alone. The WSL launch path, which only runs when you start Codex in that distro, already handles it properly.

What Changed

Every background lane that reads the history source home now uses one shared predicate, isHostHistorySourceInWsl() (protected, in runtime-home-service-managed-home.ts). It's true when resolveHostCodexSessionSourceHome is a \\wsl path. Its users:

  • Per-account lane (getSelfContainedSessionBridgeSourceHomes, runtime-home-service-managed-home.ts): a WSL source home is left out of the sources. The managed mirror and sibling accounts still bridge.
  • Shared-mirror lane (startSystemCodexSessionBridgeInBackground call in runtime-home-service-launch.ts): starts no bridge when the source home is a WSL path.
  • System-default history migration and backfill:
    • isHostSystemDefaultSessionMigrationEligible() returns false, so the scheduler never scans the source.
    • invalidateBackfillAfterManagedSystemDefaultLaunch returns null.
    • prepareHostSystemDefaultSessionMigrationPass returns false without marking the backfill pending.
  • The ~/.codex lane from feat(codex): history follows you into ~/.codex on system default, with a per-host opt-out (#24511) #34981 now uses the same predicate instead of its own parseWslUncPath check.

Ordinary custom source folders (any non-WSL path) behave exactly as before.

Why

These lanes run in the background: at launch preparation, on a schedule and after account switches. A \\wsl.localhost read from Windows goes over 9P and boots a stopped distro, which E9 forbids for background work. The distro's own history is bridged by the WSL lane inside the distro, only when Codex launches there. Skipping is safer than trying to "check if running first": the WSL lane already owns those homes, and a check-then-read would still race a stop.

  • Flag-off: N/A. Not WSL-gated; it applies wherever someone sets a \\wsl Codex history source on Windows.
  • User risk: low. Windows users who pointed the Codex history source at a WSL path no longer get that distro's history linked into Orca's Windows-side Codex homes, or migrated by the background scan. They get it through the WSL lane when launching Codex in that distro. Nothing is deleted, and non-WSL sources are unchanged.

Linked Issue

N/A. Follow-up to #34981 (e9-reviewer's UNC-source item).

Visual Proof

N/A. Background behavior only.

Testing

runtime-home-history-sharing-opt-out.test.ts:

  • the per-account lane never passes the \\wsl.localhost\… source home in its sources;
  • the shared-mirror lane starts no bridge for it;
  • the shared-mirror lane still bridges from an ordinary custom source;
  • migration eligibility is false for a WSL source and true for an ordinary one;
  • preparing a migration pass writes no backfill marker for a WSL source and does for an ordinary one. It fails without the gate.

The two lane tests fail without the change.

Suites and checks:

  • src/main/codex-accounts, src/main/codex and main-process-account-services pass.
  • The two runtime-home-catalog-account-key cases time out under full-suite load on this machine, and also on main. Run alone, they pass both here and on main.
  • pnpm tc and pnpm run typecheck:ci pass. So do oxlint, the anti-slop lint, the ast-grep gates, check:process-host-imports and check:code-quality:changed.

AI Disclosure

Review

Agent history and E9: e9-reviewer and d3-gate-audit.

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

Only \\wsl source paths change. macOS, Linux, SSH hosts and non-WSL Windows sources are unaffected.

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)

@coderabbitai

coderabbitai Bot commented Oct 29, 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 7 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: b94df44a-e7d3-46c8-a67b-0757aa9d84bb
Commits

Reviewing files that changed from the base of the PR and between 074fc36 and 3591099.

Files selected for processing: 3
  • src/main/codex-accounts/runtime-home-history-sharing-opt-out.test.ts
  • src/main/codex-accounts/runtime-home-service-launch.ts
  • src/main/codex-accounts/runtime-home-service-managed-home.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.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were established.

Summary

Background Codex history work now skips custom sources inside WSL.

  • Host background history work skips a Codex source inside WSL.

Reviews (2) · Last reviewed commit: "fix(codex): one WSL-source predicate for..." · Reviewed by Greptile

…unt and shared-mirror lanes

When codexSessionSourceHome points inside a distro (\\wsl.localhost\…), the
per-account lane used it as a history source and the shared-mirror lane scanned
it, both through 9P from the Windows side, which boots a stopped distro (E9) and
yields links codex resume ignores. Both now leave such a source out; the WSL
lane, which runs only at launch, owns those homes. Ordinary custom sources are
unchanged.
…e home

The host system-default session migration (backfill and index heal) also read
resolveHostCodexSessionSourceHome as its sessions root; a \\wsl.localhost
source would be scanned over 9P and boot a stopped distro (E9). Such a source
now makes the migration ineligible, sharing one check with the mirror lane.
…ackfill prep from it

Every lane that reads the host history source now uses one protected predicate,
isHostHistorySourceInWsl(): the per-account, shared-mirror and ~/.codex lanes,
migration eligibility, backfill invalidation after a managed system-default
launch, and preparing a migration pass, which now returns false without marking
the backfill pending.
@nwparker
nwparker force-pushed the nwparker/codex-history-skip-wsl-sources branch from 52a0972 to 3591099 Compare October 29, 2026 04:46
@nwparker
nwparker merged commit 46e291b into main Oct 29, 2026
41 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