Repository navigation
fix(agents): route WSL OMP hooks to the Windows listener (#7565) - #7641
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis change adds a WSL-aware fallback to the generated Pi agent status hook sender. If loopback 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/pi/agent-status-extension-source.ts (1)
164-188: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoffCorrectness looks solid; consider that
spawnSyncblocks the event loop.The argument list, JSON content-type, and
--data-binary@-`` faithfully reproduce the nativefetchpayload and reuse the same `X-Orca-Agent-Hook-Token` contract, and passing the token as a discrete argv element (no shell) avoids injection.One consideration:
spawnSyncruns synchronously inside the asyncpost(). In a sustained WSL failure state, the fallback fires on every hook event (status hooks fire multiple times per turn), each blocking the pi process for up to--connect-timeout/--max-timebefore returning. If the Windows loopback is reachable this is fast, but in a partial-failure scenario it can stall the TUI. An asyncspawn(promisified) would keep the event loop responsive. Optional given the bounded timeouts and fail-open intent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e3a1d2bc-e500-4fe8-a1de-89e094f76df1
📒 Files selected for processing (2)
src/main/pi/agent-status-extension-source.test.tssrc/main/pi/agent-status-extension-source.ts
|
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! |
The fallback ran spawnSync inside the pi/omp process on every hook event whenever the loopback fetch failed — which on WSL-NAT is every event — blocking the TUI's event loop for the full curl round-trip. Delivery is fire-and-forget, so use async spawn with the payload fed via stdin and errors swallowed (the bridge stays best-effort). Also: - Add --noproxy 127.0.0.1 so a proxy env var in the WSL shell cannot route the token and payload off-box (matches the shell hook scripts). - Memoize the WSL evidence and curl.exe probes — process-lifetime constants; the per-event failure path must not re-read /proc or stat /mnt/c each time. - Restore the fail-open why-comment the bridge displaced and document why delivery must not block. Tests updated to pin the async spawn shape (stdin payload, stdio config, error listeners) plus a probe-once memoization test. Co-authored-by: Orca <help@stably.ai>
Windows validation showed --connect-timeout 0.5 dropping 3/3 events to a healthy listener while the machine was under load (dev app + WSL hydration running); the same posts succeeded at 3s. The tight bounds were sized for the old blocking spawnSync path where every millisecond held the pi event loop — the spawn is now detached, so the timeouts bound a background curl process, not the TUI. Raise to --connect-timeout 3 / --max-time 10 so loaded Windows+WSL machines stop dropping status events. Co-authored-by: Orca <help@stably.ai>
Clean auto-merge, no conflicts. Brought in from main: - daemon boot hardening: fail builds/CI when terminal daemon can't start; plain-node-entry-guard + verify-packaged-daemon-entry (electron require leaked into daemon-entry chunk, #7844/#7849) - perf(windows): relax whole-process-table scans for terminals with no agent evidence (#7607) — foreground-scan-cadence - fix(agents): route WSL OMP hooks to the Windows listener (#7565/#7641) - fix: recover fresh local terminal spawns from a deleted saved cwd (#7847) - native-chat: upload composer attachments over SSH (#7832) - mobile: keyboard dismiss control; agent-tab launch fix - new GitHub issue draft persistence (#7778) Perf-branch structure preserved (clean auto-merge; no restructured terminal files conflicted). Gates: typecheck 0 errors; terminal-pane + ipc/pty + daemon + pane-manager suites 4497 passed / 14 skipped / 0 failed. Co-authored-by: Orca <help@stably.ai>
…) (stablyai#7641) Co-authored-by: Orca <help@stably.ai> Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Summary
Route the bundled WSL OMP status extension through Windows
curl.exeafter nativefetchfails, so loaded WSL OMP agents can reach the Windows loopback hook listener. The primaryfetchpath stays in place,/hook/omprouting stays unchanged, andsrc/main/pty/wsl-orca-env.tsis untouched.Closes #7565.
Related issue: #7377.
Testing
pnpm exec vitest run --config config/vitest.config.ts src/main/pi/agent-status-extension-source.test.tspnpm exec vitest run --config config/vitest.config.ts src/main/pty/wsl-orca-env.test.tspnpm run typecheck:nodeAI Review Report
fetchtransport.curl.exefallback after the current POST fails, so the bridge does not duplicate successful deliveries.Security Audit
/mnt/c/Windows/System32/curl.exeexists.WSLENValone does not enable the bridge.X-Orca-Agent-Hook-Token, and the listener stays on Windows loopback.fetchfails, when curl is missing, or when the bridge exits nonzero.Notes