fix(agents): route WSL OMP hooks to the Windows listener (#7565)
Summary
Route the bundled WSL OMP status extension through Windows curl.exe after native fetch fails, so loaded WSL OMP agents can reach the Windows loopback hook listener. The primary fetch path stays in place, /hook/omp routing stays unchanged, and src/main/pty/wsl-orca-env.ts is untouched.
Closes #7565. Related issue: #7377.
Testing
- [x]
pnpm exec vitest run --config config/vitest.config.ts src/main/pi/agent-status-extension-source.test.ts - [x]
pnpm exec vitest run --config config/vitest.config.ts src/main/pty/wsl-orca-env.test.ts - [x]
pnpm run typecheck:node
AI Review Report
- Cross-platform behavior stays narrow: macOS, Linux, native Windows, and SSH relay paths keep using the existing
fetchtransport. - WSL only gets the Windows
curl.exefallback after the current POST fails, so the bridge does not duplicate successful deliveries. - The change stays inside the generated Pi/OMP status extension, so OMP extension loading and other PTY wiring remain owned by their existing targets.
- No visual change.
- Provider behavior stays neutral because the hook payload and listener contract are unchanged.
Security Audit
- The fallback only runs when WSL evidence is present and
/mnt/c/Windows/System32/curl.exeexists. WSLENValone does not enable the bridge.- The hook token still goes out in
X-Orca-Agent-Hook-Token, and the listener stays on Windows loopback. - Fail-open behavior remains intact when native
fetchfails, when curl is missing, or when the bridge exits nonzero.
Notes
- The change stays scoped to loaded Pi/OMP status-extension transport. OMP extension loading remains separate from this transport fix.
No actionable comments were generated in the recent review. đ
âšī¸ Recent review info
âī¸ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6a2c74f8-e438-45fd-b614-0f6e70017d67
đĨ Commits
Reviewing files that changed from the base of the PR and between a021319931afe2013d0d6d6e3d2f69d1caa6753c and 204fed6650c0ff43f9a28044dff8a1fd3252c086.
đ Files selected for processing (2)
src/main/pi/agent-status-extension-source.test.tssrc/main/pi/agent-status-extension-source.ts
đ§ Files skipped from review as they are similar to previous changes (2)
- src/main/pi/agent-status-extension-source.ts
- src/main/pi/agent-status-extension-source.test.ts
đ Walkthrough
Walkthrough
This change adds a WSL-aware fallback to the generated Pi agent status hook sender. If loopback fetch POSTs fail, the code now detects WSL, checks for /mnt/c/Windows/System32/curl.exe, and retries the same JSON payload through Windows curl.exe. A new Vitest suite exercises native fetch routing, curl fallback invocation, and fail-open behavior across WSL and non-WSL cases.
đĨ Pre-merge checks | â 5
â Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | â Passed | The title clearly describes the WSL OMP hook transport fix and matches the main change. |
| Description check | â Passed | The description covers summary, testing, review, security, and notes, but it omits a dedicated Screenshots section. |
| Linked Issues check | â Passed | The change matches #7565 by adding a WSL-only fallback that routes OMP status posts to Windows curl.exe when fetch fails. |
| Out of Scope Changes check | â Passed | The diff stays focused on the WSL OMP transport fix and its regression tests, with no clear unrelated feature work. |
| Docstring Coverage | â Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
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.
Comment @coderabbitai help to get the list of available commands.
This looks like the right narrow fix for the OMP/Pi status-extension transport. One cross-link so the broader WSL hook class does not get lost: #6907 appears to need a separate Codex-specific owner proof/fix.
In the same Windows desktop + WSL runtime setup, Codex had the same WSL -> Windows listener boundary problem, but through Orca's native Codex hook contract rather than the OMP/Pi generated status extension. The local workaround made Codex appear in the sidebar only after forwarding Codex hook events across that boundary.
So #7641 may close #7565 for OMP, but I do not think it covers Codex sidebar/status in #6907 unless there is another Codex hook transport path being fixed elsewhere.
Thanks for digging into this and for the fix â routing the fallback through Windows-side curl is the right call here, since it keeps the hook listener loopback-only. We're going to pick this up and apply a few adjustments on our side before landing it (async delivery instead of a blocking spawn per event, plus a couple of small hardening tweaks). Appreciate the thorough tests!