Skip to content

fix(native-chat): resolve WSL Codex transcripts so Chat UI renders responses - #12473

Merged
OrcaWin merged 2 commits into
mainfrom
fix/wsl-codex-chat-transcript-path
Aug 8, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
fix/wsl-codex-chat-transcript-path

Conversation

@nwparker

@nwparker nwparker commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex reports a guest Linux transcript path. On a Windows host existsSync resolved it against the current drive (C:\home\...) and discarded it, and the id-based fallback only searched host roots. resolveSessionFilePath returned null forever while the watcher reported watching: true, leaving Chat UI permanently empty.

Fix

Translate the guest path to its host-readable UNC twin, classifying before any existsSync probe on win32 so the C:\home false positive cannot fire. Adapted from #10639 with one required correction: it uses the async cached WSL seams (listWslDistrosAsync / getWslHomeAsync) rather than the execFileSync ones, which would stall the Electron main thread for up to 5s per tick of the resolve-poll loop on a cold distro.

Verification

  • pnpm typecheck clean on this branch
  • This branch's own tests pass; the new cases fail before the change and pass after
  • Split out of the original combined branch; the union of all 12 split branches was diffed back against it to prove nothing was lost

Fixes #10326

Made with Orca 🐋

…sponses

Codex reports a guest Linux transcript path. On a Windows host `existsSync` resolved it against the current drive (`C:\home\...`) and discarded it, and the id-based fallback only searched host roots. `resolveSessionFilePath` returned null forever while the watcher reported `watching: true`, leaving Chat UI permanently empty.

Translate the guest path to its host-readable UNC twin, classifying **before** any `existsSync` probe on win32 so the `C:\home` false positive cannot fire. Adapted from #10639 with one required correction: it uses the **async cached** WSL seams (`listWslDistrosAsync` / `getWslHomeAsync`) rather than the `execFileSync` ones, which would stall the Electron main thread for up to 5s per tick of the resolve-poll loop on a cold distro.

Fixes #10326

Co-authored-by: Orca <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds Windows WSL transcript-path translation with cached distro-home discovery and Codex session-root enumeration. Session resolution converts hook-reported Linux paths and searches WSL roots after configured roots fail. Transcript watching translates explicit WSL paths before installation, retries unresolved paths on a slower cadence, and memoizes successful translations. Tests cover path classification, caching, distro selection, session fallback, polling, exact-path installation, and non-Windows behavior.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug and fix, but it omits required Screenshots, AI Review Report, Security Audit, and Notes sections and does not provide the testing checklist. Add all required template sections, mark Screenshots as “No visual change” if applicable, complete the testing checklist, and summarize AI review and security audit findings.
Docstring Coverage ⚠️ Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: resolving WSL Codex transcripts so the Chat UI can render responses.
Linked Issues check ✅ Passed The changes address issue #10326 by translating WSL transcript paths, resolving session files, and maintaining watcher recovery so Chat UI can display responses.
Out of Scope Changes check ✅ Passed The implementation and tests remain focused on WSL transcript translation, session resolution, watcher behavior, and related caching.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@nwparker

nwparker commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Proof — run against real WSL2 from the Windows host

The whole bug is that Codex reports a guest Linux path and the Windows main process cannot read it. So the proof is to put a real Codex-shaped transcript in the distro and probe it from Windows exactly the two ways the code does — before the fix, and after.

Executed on win-old (Windows 11, WSL2 Ubuntu 26.04). Fixture written inside the distro at the managed Codex sessions path:

GUEST : /root/.local/share/orca/codex-runtime-home/home/sessions/2026/08/04/rollout-proofsession.jsonl
  Test-Path    -> False
  resolves to  -> C:\root\.local\share\orca\codex-runtime-home\home\sessions\2026\08\04\rollout-proofsession.jsonl

UNC   : \\wsl.localhost\Ubuntu\root\.local\share\orca\codex-runtime-home\home\sessions\2026\08\04\rollout-proofsession.jsonl
  Test-Path    -> True
  content      -> {"type":"message","role":"assistant","text":"ORCA_PROOF_ASSISTANT_REPLY"}

Both halves of the fix are visible here:

  1. Why Chat UI stayed empty forever. The bare guest path is False from Windows — resolveSessionFilePath returned null on every poll tick while the watcher happily reported watching: true.
  2. Why the probe had to be reordered. Look at what the guest path resolves to: C:\root\.... Windows silently rebases a leading / onto the current drive. On a machine that happens to have such a tree, the old code would not merely fail — it would bind Chat to the wrong file. That is why the fix classifies the path as guest-absolute before any existsSync, rather than probing first and falling back.
  3. Why the translation is correct. The UNC twin resolves and the assistant message is readable byte-for-byte — which is what now reaches the Chat panel.

Note

This is a mechanism proof on the real platform, not a GUI recording. Driving Codex-in-WSL through the Chat UI end to end needs a full Orca build plus a Codex login on that host; I have not done that. The renderer half (the transcript watcher feeding the Chat panel) rests on the unit tests in this PR, which include the no-main-thread-stall assertion for the async WSL seams.

Also worth stating plainly: the first time I ran this probe I got False for both paths and nearly reported the fix as ineffective. The fixture had silently failed to be created — my shell escaping broke across the PowerShell → wsl.exe → bash boundary. The numbers above are from a run where the file is verified present (-rw-r--r-- 1 root root 74 ... rollout-proofsession.jsonl).

Three follow-ups from review of the WSL Codex transcript fix:

- The UNC translation was retried on every fast resolve-poll tick (measured 10
  sync UNC stats per 100ms) because only a successful result was memoized. Gate
  the retry to the slow fallback cadence.
- A non-empty WSL home list was cached for the process lifetime, so a distro
  that was still booting during the first probe stayed excluded forever. Expire
  both branches; getWslHomeAsync caches successes, so a refresh only re-spawns
  wsl.exe for the distros that actually failed.
- codexSessionsDirs enumerated every distro's home eagerly, waking distros the
  user left stopped even for native-Windows panes. Make the WSL roots a lazy
  tier consulted only after the host's own Codex roots miss.

The resolve-poll suite became platform-dependent and only passed off Windows;
pin the platform and add explicit win32 coverage.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/native-chat/host-readable-transcript-path.ts (1)

161-162: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use path.win32.join for WSL UNC roots.

joinUnderWslHome constructs Windows separators directly. Use Node’s Windows path utility so this path construction does not depend on literal separators.

Proposed change
-import { isAbsolute } from 'node:path'
+import { isAbsolute, win32 } from 'node:path'
...
 function joinUnderWslHome(home: string, ...segments: string[]): string {
-  return `${home.replace(/[\\/]+$/, '')}\\${segments.join('\\')}`
+  return win32.join(home, ...segments)
 }

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b4d75b5-3b33-47b3-bb87-b698c9d0f3e2

📥 Commits

Reviewing files that changed from the base of the PR and between c498d2d and d6d99b6.

📒 Files selected for processing (7)
  • src/main/native-chat/host-readable-transcript-path.test.ts
  • src/main/native-chat/host-readable-transcript-path.ts
  • src/main/native-chat/session-file-resolver-wsl.test.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-watch-resolve-poll.test.ts
  • src/main/native-chat/transcript-watch-wsl-exact-path.test.ts
  • src/main/native-chat/transcript-watch.ts

@OrcaWin
OrcaWin merged commit 915050f into main Aug 8, 2026
45 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…sponses (stablyai#12473)

* fix(native-chat): resolve WSL Codex transcripts so Chat UI renders responses

Codex reports a guest Linux transcript path. On a Windows host `existsSync` resolved it against the current drive (`C:\home\...`) and discarded it, and the id-based fallback only searched host roots. `resolveSessionFilePath` returned null forever while the watcher reported `watching: true`, leaving Chat UI permanently empty.

Translate the guest path to its host-readable UNC twin, classifying **before** any `existsSync` probe on win32 so the `C:\home` false positive cannot fire. Adapted from stablyai#10639 with one required correction: it uses the **async cached** WSL seams (`listWslDistrosAsync` / `getWslHomeAsync`) rather than the `execFileSync` ones, which would stall the Electron main thread for up to 5s per tick of the resolve-poll loop on a cold distro.

Fixes stablyai#10326

Co-authored-by: Orca <[email protected]>

* fix(native-chat): stop the WSL transcript probe firing every poll tick

Three follow-ups from review of the WSL Codex transcript fix:

- The UNC translation was retried on every fast resolve-poll tick (measured 10
  sync UNC stats per 100ms) because only a successful result was memoized. Gate
  the retry to the slow fallback cadence.
- A non-empty WSL home list was cached for the process lifetime, so a distro
  that was still booting during the first probe stayed excluded forever. Expire
  both branches; getWslHomeAsync caches successes, so a refresh only re-spawns
  wsl.exe for the distros that actually failed.
- codexSessionsDirs enumerated every distro's home eagerly, waking distros the
  user left stopped even for native-Windows panes. Make the WSL roots a lazy
  tier consulted only after the host's own Codex roots miss.

The resolve-poll suite became platform-dependent and only passed off Windows;
pin the platform and add explicit win32 coverage.

---------

Co-authored-by: Orca <[email protected]>
Co-authored-by: OrcaWin <[email protected]>
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.

[Bug]: Chat UI does not show Codex responses for WSL projects and sometimes falls back to terminal view

2 participants