Files
orca/src/main/native-chat
915050f30a fix(native-chat): resolve WSL Codex transcripts so Chat UI renders responses (#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 #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 <help@stably.ai>

* 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 <help@stably.ai>
Co-authored-by: OrcaWin <alpha-eng@stably.ai>
2026-08-08 03:50:21 -07:00
..