Repository navigation
fix(codex): index a new WSL account home before bridging history into it (carries #23843) - #33630
Conversation
The WSL history bridge hardlinked every conversation into a new managed account home before Codex had opened it, so Codex's first open had to index all of it and every other Codex on that home gave up after 30s. Apply the native ordering from #22971 inside the distro: Codex brings the home's index to complete first, history is linked after, and the shared thread/read loop indexes it newest first. Windows cannot read the guest's Codex sqlite over 9p, so a marker per linked rollout records the pending indexing work and dies once thread/read settles it.
…not a Codex thread The launch bridge counted only Codex-shaped marker names against the script's pendingFiles total, so a single rollout-*.jsonl without a thread id made the count mismatch on every launch and skipped the home's whole index heal. Count every listed marker for the completeness check and index the parseable ones.
…read id thread/read can never settle such a marker, so it was listed on every launch with nothing to remove it.
|
No actionable comments were generated in the recent review.
|
Carries #23843 by @brennanb2025. It's rebased onto current
main, and the three original commits are kept with their authorship. The rebase only resolved comment-only conflicts left by the repo-wide comment cleanup. The code is unchanged from #23843.ELI5
Codex keeps an index of past conversations. When Orca sets up a new Codex account for a WSL project, it links all your old conversations into that account's folder before Codex has ever opened it. The first Codex to open the folder then has to index everything at once. Every other Codex on that account waits 30s and then gives up. With this change, Orca lets Codex open the empty folder first, then links the history, then has Codex index it in the background, newest first. That's the same order #22971 already uses for non-WSL accounts.
Root cause (upstream refs)
complete. A process that doesn't own the backfill gives up after 30s withtimed out waiting for state db backfill ... (status: running). Seecodex-rs/rollout/src/state_db.rs:36(STARTUP_BACKFILL_WAIT_TIMEOUT = 30s) andwait_for_backfill_gate,state_db.rs:132-181(openai/codex @ 970111f6cb)./resume.wsl-codex-session-bridge.ts) still linked first. Windows can't read the guest's SQLite over\\wsl.localhost, so the PR records pending work as one marker file per linked rollout. The markers feed fix(codex): index a new account home before bridging history into it #22971's sharedhealPendingCodexAccountThreads/readCodexThreadsForIndexHealloop through the distro's owncodex app-server.What changed
See #23843 for the full design. In short:
codex app-serveronce per account home per Orca run (buildWslHealInvocation), andinitializeacts as the readiness signal. If Codex can't start, nothing is linked on that launch.<home>/.orca-index-pending/<rollout>for each newly linked rollout. It prints the pending markers newest first.Verification (real Windows + WSL, win-lowspec: 8 cores / 16 GB, Ubuntu WSL2, Codex 0.164.0 pinned in a temp dir)
This drove the real
startWslCodexSessionBridgeInBackgroundfrom Windows Node (realwsl.exe, real in-distro script, real guestcodex app-server). The source was 20,000 synthetic rollouts in a temp history folder, and each run used a fresh UNC managed home under/tmp. A side probe timedinitializefor a "chat" Codex plus a second Codex started 2s later on the same home.main(9654684):timed out waiting for state db backfill at …/managed after 30s (status: running).completewith 3,563 threads and stayed there after all 20,000 were linked. The other 16,437 conversations were never indexed.This branch:
complete/0. The chat Codex initialized in 2.4s and the second Codex in 0.8s.2026-08-05…2026-08-25). The simulated quit stopped cleanly, and indexed plus markers added up to exactly 20,000.pnpm teston the codex and codex-accounts suites (70 files / 521 tests) passes.pnpm tc:nodeandcheck:code-quality:changedare clean.~/.codexconfig/auth hashes and the WSL~/.codex/config.tomlhash were the same before and after.Trade-offs vs main
codex app-serverstart per WSL account per Orca run, before linking./resumefills in newest first.main. The guest keeps linking and writing markers, and indexing then starts on the next launch.Risk
Medium-low. The change is WSL-only, runs in the background, and no launch waits on it. It reuses #22971's indexing loop. Compatible with held #33578, which runs WSL bridges for several sources one at a time: indexing state is per target home, and the markers dir is shared.
Refs #20669. Supersedes #23843.
Co-authored-by: Brennan Benson 79079362+brennanb2025@users.noreply.github.com