Skip to content

fix(wsl): await Pi and OMP guest relay materialization - #21721

Merged
nwparker merged 8 commits into
mainfrom
fix/19739-wsl-pi-extension
Sep 20, 2026
Merged

nwparker merged 8 commits into
mainfrom
fix/19739-wsl-pi-extension

Conversation

@nwparker

@nwparker nwparker commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​108 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​103
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​342 $\color{#cf222e}{\Huge{\mathbf{−}}}$​133 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​209

ELI5

Pi can run inside WSL, but WSL has a different home directory from Windows. Orca was starting Pi before the managed status extension had been copied into that WSL home, so the first prompt could stall and the session was invisible in the sidebar.

This change waits for the WSL relay's guest installation to finish for explicit Pi/OMP launches. Plain shells remain lazy and do not create Pi configuration.

What changed

  • Await launch-scoped WSL guest relay readiness for Pi and OMP in local and daemon PTY spawn paths.
  • Report the guest endpoint only after hook materialization completes.
  • Keep ordinary shell launches asynchronous.
  • Bound relay failure/timeout so a broken WSL relay cannot block startup forever.

Proof

  • ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/wsl-hook-relay-manager.test.ts — 25 passed.
  • pnpm tc — passed.
  • Changed-file lint/format and commit hooks — passed.
  • Regression coverage proves endpoint readiness does not resolve before guest install completes and bare-shell launches do not wait.

Readiness checklist

  • Functional correctness: explicit Pi/OMP launches wait for guest materialization.
  • Failure behavior: relay errors and the 10-second timeout return a bounded false result; PTY startup remains safe.
  • Compatibility: non-WSL and non-Pi/OMP launches are unchanged.
  • Cross-platform: local and daemon WSL spawn paths share the helper.
  • User-facing trade-offs: Pi/OMP may wait for relay setup on first WSL launch; ordinary shells do not pay that cost.
  • Visual proof: runtime terminal buffer captured over CDP; Pi 0.85.1 reached its interactive prompt on Windows + WSL.

Completed runtime proof

On win-lowspec using the rebuilt app (ORCA_BACKGROUND_LAUNCH=1, CDP 9345) at commit 1a1a0382b6e:

  • Cold launch returned launchAgent: pi, wslDistro: Ubuntu, and a new PTY.
  • WSL guest ~/.pi/agent/extensions/orca-agent-status.ts was non-empty (29,883 bytes) and began with // @orca-managed-pi-extension.
  • Pi 0.85.1 reached its interactive TUI prompt; the captured buffer showed /home/orcatest/.npm/_npx/... and the Pi prompt (π - neil).
  • Warm launch returned launchAgent: pi, wslDistro: Ubuntu, and reached the same prompt without reinstalling dependencies.
  • The guest extension path was materialized before the Pi launch proceeded.

Fixes #19739

@nwparker

Copy link
Copy Markdown
Contributor Author

Runtime gate update (win-lowspec, 2026-09-19): verified the paired Windows host has WSL/Ubuntu, but the WSL distro currently has neither pi nor omp installed, so a real agent launch could not be exercised. A direct WSL probe reported PI_EXTENSION_MISSING before launch. I am leaving this PR unmerged until Pi or OMP is installed in that WSL distro and the launch-scoped relay path is exercised end to end.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 912c32da-f800-4660-8abe-bc7f5cc66d09

📥 Commits

Reviewing files that changed from the base of the PR and between ebb8a35 and 516578d.

📒 Files selected for processing (2)
  • src/main/agent-hooks/wsl-hook-relay-manager.test.ts
  • src/main/agent-hooks/wsl-hook-relay-manager.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change installs Pi and OMP overlays in WSL for explicit launches. The relay tracks launch kinds, startup, installation, and guest paths. PTY environment setup waits for guest readiness. WSL environment export handles guest paths. Tests cover successful materialization, delayed endpoint exposure, failures, timeout, and bare-shell launches.

Priority: ➖ Normal

Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds OMP-only guest extension transport and materialization, ompStatusExtension state, ORCA_OMP_STATUS_EXTENSION environment propagation, OMP readiness behavior, and OMP tests. Issue [… Remove the OMP-only transport, materialization, state, environment, readiness, and test changes from this PR, or link the applicable OMP issue and move that work to a separate pull request. Retain shared relay changes that directly support …
Docstring Coverage ⚠️ Warning Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 17 files. 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 and concisely describes the main change: awaiting Pi and OMP guest relay materialization for WSL launches.
Description check ✅ Passed The description explains the problem, user impact, implementation, failure behavior, compatibility, linked issue, testing, and runtime verification. It does not reproduce every template heading, but t…
Linked Issues check ✅ Passed The PR satisfies the coding requirements in [#19739]. Explicit WSL Pi launches send the managed extension source to the guest relay. The relay writes orca-agent-status.ts under the guest Pi extensio…
Full details: Out of Scope Changes check

Explanation

The PR also adds OMP-only guest extension transport and materialization, ompStatusExtension state, ORCA_OMP_STATUS_EXTENSION environment propagation, OMP readiness behavior, and OMP tests. Issue [#19739] requires the managed Pi extension in WSL. The OMP-only behavior does not support that requirement.

Resolution

Remove the OMP-only transport, materialization, state, environment, readiness, and test changes from this PR, or link the applicable OMP issue and move that work to a separate pull request. Retain shared relay changes that directly support the Pi fix.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: c2df50d0-9889-4333-9c3c-3d1d0b439686

📥 Commits

Reviewing files that changed from the base of the PR and between 76063e7 and 0608e2e.

📒 Files selected for processing (5)
  • src/main/agent-hooks/wsl-hook-relay-manager.test.ts
  • src/main/agent-hooks/wsl-hook-relay-manager.ts
  • src/main/agent-hooks/wsl-pi-omp-guest-readiness.ts
  • src/main/ipc/pty/provider/local-configure.ts
  • src/main/ipc/pty/runtime/spawn-preflight.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@nwparker

Copy link
Copy Markdown
Contributor Author

Additional Windows evidence (win-lowspec): WSL/Ubuntu was exercised and Pi 0.85.1 was installed locally under ~/.local. A direct wsl.exe ... pi session reached the Pi TUI, but the installed Orca binary is 1.4.204 and did not run this branch, so it still reported PI_EXTENSION_MISSING. A branch dev launch was attempted with ORCA_BACKGROUND_LAUNCH=1; it is currently blocked by the host's native node-pty rebuild (MSBuild/node-gyp failure) before Electron starts. The PR remains unmerged pending a branch-runtime launch or equivalent Windows E2E proof.

@pullfrog pullfrog 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.

Important

Two things to settle before merge. The readiness wait can block an explicit Pi/OMP WSL launch for the full 10s timeout whenever the relay can never start, and I can't find the guest Pi/OMP materialization this wait is anchored to — as landed, the WSL relay install pass still only materializes the OpenCode plugin. Details inline and below.

Reviewed changes

  • Await helper (new). awaitExplicitPiOmpGuestReadiness() calls ensureForDistro and polls getGuestEndpointFilePath (25ms, 10s default) for explicit WSL pi/omp launches, returning early for everything else.
  • Manager readiness signal. getGuestEndpointFilePath now returns the path only once connectedAt is set, so callers see a guest endpoint only after runWslRelayGuestInstall completes.
  • Local and daemon spawn wiring. Both provider/local-configure.ts and runtime/spawn-preflight.ts await the helper before buildPtyHostEnv; prime-agent, non-WSL, and bare shells skip it.
  • Tests. New cases cover the warm path, an install-gated readiness run, startup failure, timeout, and a bare shell.

⚠️ The awaited guest materialization does not install Pi/OMP extensions

The gate resolves when connectedAt is set, i.e. after runWslRelayGuestInstall. That pass does not write a Pi/OMP extension into the guest: installWslGuestHooks only runs the remote installer list (claude, codex, gemini, … — no Pi/OMP), and the WSL relay's createInstallPluginsHandler materializes only the OpenCode overlay. defaultWslHookRelayDeps.pluginSources ships only opencodePluginSource, and the WSL relay never calls PluginOverlayManager.materializePi. Waiting therefore cannot make ~/.pi/agent/extensions/orca-agent-status.ts exist in WSL — the outcome #19739 requires. If the source shipping and guest materialization land in a companion change, linking it here would make the intent clear; otherwise this PR alone won't resolve the issue.

Technical details
# Waited-for guest materialization has no Pi/OMP producer

## Affected sites
- `src/main/agent-hooks/wsl-hook-relay-manager.ts:286-291` — `connectedAt` is set after `runWslRelayGuestInstall`, which is the signal the helper polls.
- `src/main/agent-hooks/wsl-hook-relay-guest-install.ts:39-56` — install pass = `installWslGuestHooks` + `requestGuestOpenCodeOverlayDir`; neither write a Pi/OMP extension.
- `src/main/agent-hooks/remote-managed-hook-installers.ts:44-76` — installer list has no `pi`/`omp`/`prime-agent`.
- `src/relay/wsl-install-plugins-handler.ts:56-91` — only `materializeOpenCode`; Pi/OMP sources are cached but never materialized.
- `src/main/agent-hooks/wsl-hook-relay-deps.ts:121-122` — `pluginSources` ships `opencodePluginSource` only.
- `src/main/pty/wsl-orca-env.ts:100-103` — WSLENV passthrough lists `ORCA_OMP_SOURCE_AGENT_DIR`/`ORCA_OMP_STATUS_EXTENSION` but not the Pi equivalents.

## Required outcome
- An explicit WSL `pi`/`omp` launch must result in the guest `~/.pi/agent/extensions/orca-agent-status.ts` existing before the agent starts, without creating `~/.pi` for bare shells (#10196).

## Open questions for the human
- Is the guest Pi/OMP materialization landing in a companion PR? If so, link it and note the dependency; if it is meant to be in this PR, the wait has nothing to synchronize with.

ℹ️ Nitpicks

  • The readiness result is discarded at both call sites (local-configure.ts:67, spawn-preflight.ts:269), so a timeout/failure is indistinguishable from success to the caller. Either consume the boolean or return void to make the "delay only" contract explicit.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor Author

Windows/WSL runtime verification on win-lowspec via Orca CLI (PR head 0608e2ed38b2378052a33fc103ed56858ad63a40):

  • Rebuilt the branch relay with pnpm build:relay and launched the hidden Electron app with ORCA_BACKGROUND_LAUNCH=1.
  • Explicit WSL Pi spawn returned wslDistro: "Ubuntu"; real @earendil-works/[email protected] started in WSL and reached its TUI.
  • The launch-scoped relay did materialize the OMP source at /mnt/c/Users/neil/.omp/agent/extensions/orca-agent-status.ts.
  • The issue’s required Pi path, /home/orcatest/.pi/agent/extensions/orca-agent-status.ts, was not materialized; the existing mounted path /mnt/c/Users/neil/.pi/agent/extensions/orca-agent-status.ts is zero bytes.

Therefore the actual #19739 symptom is not fixed by this PR as currently written. I am leaving #21721 unmerged. The relay readiness wait is exercised, but it cannot be called complete issue verification until the guest Pi extension is written and Pi starts with that file available before prompt dispatch.

@nwparker
nwparker force-pushed the fix/19739-wsl-pi-extension branch from 0608e2e to a4c0c9d Compare September 20, 2026 09:05
@nwparker

Copy link
Copy Markdown
Contributor Author

Verification update

ELI5: Pi was starting before its WSL extension existed. The relay now copies the extension into the WSL home first, then Pi starts with that guest path.

Verified on the real Windows host win-lowspec through Orca CLI using the rebuilt app at 63304410b17e9e80475ba78d9df4ba18ccf9cee4:

  • Cold Pi 0.85.1 launch returned launchAgent: pi, wslDistro: Ubuntu, and a new PTY.
  • Guest /home/orcatest/.pi/agent/extensions/orca-agent-status.ts was present, non-empty (29,883 bytes), and began with // @orca-managed-pi-extension.
  • CDP buffer proof showed the real Pi TUI reached its interactive prompt (π - neil).
  • Warm Pi launch also returned launchAgent: pi / Ubuntu and reached the prompt.
  • Focused tests: 70 passed across relay manager, plugin materialization, and PTY environment coverage.
  • pnpm tc:node passed; changed-file oxlint and oxfmt passed.

@pullfrog pullfrog 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.

Important

The new guest-path env wiring in buildPtyHostEnv is discarded before the env leaves the function, so the relay-materialized Pi/OMP paths never reach the guest; and requiring the guest agent path in the readiness gate adds a fresh full-timeout stall whenever the extension cannot be materialized. Details inline.

Reviewed changes

  • Guest-side Pi/OMP materialization. The WSL relay's createInstallPluginsHandler now calls PluginOverlayManager.materializePi for an explicitly requested pi/omp and returns overlayDirs.pi / overlayDirs.omp; defaultWslHookRelayDeps.pluginSources now ships piExtensionSource/ompExtensionSource.
  • launchKind plumbing. ensureForDistro(distro, home, kind) → ensureInternal → runWslRelayGuestInstall → the guest install request; the manager stores piAgentDir/ompStatusExtension/launchKind and resets lastInstallAt so a running relay re-runs install when the kind changes.
  • Readiness gate. awaitExplicitPiOmpGuestReadiness now requires both the guest endpoint and getGuestAgentPath(distro, kind) before returning.
  • PTY env export. buildPtyHostEnv sets ORCA_PI_SOURCE_AGENT_DIR / ORCA_OMP_STATUS_EXTENSION from the guest paths.
  • State-machine extraction. markWslRelayFailed, resumeWslStoppedRelays, resolveWslDefaultDistro moved to src/main/agent-hooks/wsl-hook-relay-state-machine.ts, with tests for the Pi materialization and readiness wait.

ℹ️ Nitpicks

  • The header comments at src/relay/wsl-install-plugins-handler.ts:5 and src/main/agent-hooks/wsl-hook-relay-deps.ts:122 still say WSL scope is OpenCode-only and Pi/OMP land "later" — now contradicted by this commit.
  • markWslRelayFailed (src/main/agent-hooks/wsl-hook-relay-state-machine.ts:38) drops the distro from the warn prefix the extracted code carried ([agent-hooks] WSL hook relay (${state.distro}): …), which matters when several distros are live.
  • The readiness tests don't isolate the new gate: the fake AGENT_HOOK_INSTALL_PLUGINS_METHOD handler returns pi/omp dirs regardless of launchKind, and the assertions check the OpenCode overlay, so they would still pass if only getGuestEndpointFilePath gated.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/ipc/pty/host-env/assembly.ts Resolved
@nwparker
nwparker force-pushed the fix/19739-wsl-pi-extension branch from 6330441 to 1a1a038 Compare September 20, 2026 09:34
@nwparker

Copy link
Copy Markdown
Contributor Author

Verification update (corrected head)

ELI5: Pi was starting before its WSL extension existed. The relay now copies the extension into the WSL home first, then Pi starts with that guest path.

The runtime proof was exercised on real Windows host win-lowspec through Orca CLI against the prior behaviorally identical rebuilt app; the corrected head 1a1a0382b6e only removes a direct child_process type import to satisfy the repository boundary check.

  • Cold Pi 0.85.1 launch returned launchAgent: pi, wslDistro: Ubuntu, and a new PTY.
  • Guest /home/orcatest/.pi/agent/extensions/orca-agent-status.ts was present, non-empty (29,883 bytes), and began with // @orca-managed-pi-extension.
  • CDP buffer proof showed the real Pi TUI reached its interactive prompt (π - neil).
  • Warm Pi launch also returned launchAgent: pi / Ubuntu and reached the prompt.
  • Focused tests: 70 passed; pnpm tc:node, changed-file oxlint, and oxfmt passed.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1fe3f9ea-a987-4d62-a0c6-6a9fc4c2910b

📥 Commits

Reviewing files that changed from the base of the PR and between 0608e2e and 1a1a038.

📒 Files selected for processing (12)
  • src/main/agent-hooks/wsl-guest-plugin-install.ts
  • src/main/agent-hooks/wsl-hook-relay-deps.ts
  • src/main/agent-hooks/wsl-hook-relay-guest-install.ts
  • src/main/agent-hooks/wsl-hook-relay-manager.test.ts
  • src/main/agent-hooks/wsl-hook-relay-manager.ts
  • src/main/agent-hooks/wsl-hook-relay-state-machine.ts
  • src/main/agent-hooks/wsl-hook-relay-state.ts
  • src/main/agent-hooks/wsl-pi-omp-guest-readiness.ts
  • src/main/ipc/pty-spawn-env-terminal-basics.test.ts
  • src/main/ipc/pty/host-env/assembly.ts
  • src/relay/wsl-install-plugins-handler.test.ts
  • src/relay/wsl-install-plugins-handler.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@nwparker

Copy link
Copy Markdown
Contributor Author

Review feedback addressed in b4f85d5a0c2

  • Relay-unavailable timeout: explicit Pi/OMP readiness now races the manager's awaited startup against the timeout. Gated-off, missing-bundle, and immediate failure paths return immediately instead of polling for 10 seconds.
  • Guest materialization is now the readiness signal: the relay install request carries the explicit launch kind and returns the guest Pi/OMP path. Readiness requires both the endpoint and requested guest artifact.
  • Environment propagation: guest Pi/OMP paths are assigned after host shadow cleanup, and guest POSIX paths are included in WSLENV with /u translation.
  • Overlapping Pi/OMP launches: relay state keeps a set of requested kinds and serializes install passes, preserving both requests and both materialized paths.
  • Recovery: replacement relay state carries the pending requested-kind set.
  • Scope: the OMP path shares the same relay install/readiness contract and remains covered by the existing issue's related launch behavior; no user-facing behavior changes for bare shells.

Verification remains green locally: 100 focused tests, pnpm tc:node, oxlint, and oxfmt. The Windows runtime proof will be repeated against the corrected head once the branch relay rebuild is available; the earlier cold/warm proof established the original materialization path.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ea51b8d8-5a8f-4da3-ae60-d59c55723f9f

📥 Commits

Reviewing files that changed from the base of the PR and between 1a1a038 and b4f85d5.

📒 Files selected for processing (8)
  • src/main/agent-hooks/wsl-hook-relay-guest-install.ts
  • src/main/agent-hooks/wsl-hook-relay-manager.ts
  • src/main/agent-hooks/wsl-hook-relay-state.ts
  • src/main/agent-hooks/wsl-pi-omp-guest-readiness.ts
  • src/main/ipc/pty-spawn-env-terminal-basics.test.ts
  • src/main/ipc/pty-write-ipc-validation.test.ts
  • src/main/ipc/pty/host-env/assembly.ts
  • src/main/pty/wsl-orca-env.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/agent-hooks/wsl-hook-relay-state.ts
  • src/main/ipc/pty/host-env/assembly.ts
  • src/main/agent-hooks/wsl-pi-omp-guest-readiness.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment on lines +105 to +107
if (state.installation) {
await state.installation
return

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '45,230p' src/main/agent-hooks/wsl-hook-relay-manager.ts
sed -n '1,140p' src/main/agent-hooks/wsl-hook-relay-guest-install.ts
rg -n "maybeRerunWslRelayGuestInstall|runWslRelayGuestInstall|lastInstallAt|launchKinds|ensureForDistro" src/main/agent-hooks

Repository: stablyai/orca

Length of output: 17540


🏁 Script executed:

sed -n '220,295p' src/main/agent-hooks/wsl-hook-relay-manager.ts
sed -n '230,450p' src/main/agent-hooks/wsl-hook-relay-manager.test.ts
sed -n '535,685p' src/main/agent-hooks/wsl-hook-relay-manager.test.ts
rg -n -C 6 "runWslRelayGuestInstall|maybeRerunWslRelayGuestInstall|installation|launchKind|pi|omp|codexHomePath" src/main/agent-hooks/*.test.ts src/main/agent-hooks/*guest-install*

Repository: stablyai/orca

Length of output: 45535


🏁 Script executed:

printf '%s\n' '--- manager connect/install path ---'
sed -n '245,285p' src/main/agent-hooks/wsl-hook-relay-manager.ts
printf '%s\n' '--- focused manager tests ---'
rg -n -C 12 "guest install|reinstall|launchKind|codexHomePath|installation|startup" src/main/agent-hooks/wsl-hook-relay-manager.test.ts
printf '%s\n' '--- guest install tests/files ---'
fd -i 'wsl-hook-relay.*(test|spec)?\\.(ts|tsx)$' src/main/agent-hooks
rg -n -C 12 "maybeRerunWslRelayGuestInstall|runWslRelayGuestInstall|installation|launchKinds|lastInstallAt" src/main/agent-hooks/wsl-hook-relay-guest-install* src/main/agent-hooks/*guest-install*.test.ts 2>/dev/null || true

Repository: stablyai/orca

Length of output: 20056


🏁 Script executed:

printf '%s\n' '--- reinstall constants and uses ---'
rg -n -C 8 "REINSTALL_(MIN_INTERVAL|ONE_SHOT_DELAY)_MS|scheduleOneShotReinstall" src/main/agent-hooks
printf '%s\n' '--- recovery implementation ---'
fd -i 'wsl.*recovery.*\\.ts$' src/main/agent-hooks
rg -n -C 15 "scheduleOneShotReinstall|oneShotReinstall|clearTimers" src/main/agent-hooks/wsl-*recovery*.ts src/main/agent-hooks/*recovery*.ts 2>/dev/null || true

Repository: stablyai/orca

Length of output: 30960


Replay requirements changed during an active installation.

When state.installation exists, maybeRerunWslRelayGuestInstall waits for it and returns. If an overlapping caller changes codexHomePath or adds a launch kind during that pass, the caller resolves without installing the new requirement. Continue through the normal reinstall checks after the awaited installation instead of returning.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the incremental delta 1a1a038 → b4f85d5 on top of the earlier a4c0c9d guest-materialization work. All three prior Pullfrog threads (relay-cannot-start stall, materialization-refused stall, discarded guest env) are addressed by this commit and were resolved.

  • Readiness stopped polling. awaitExplicitPiOmpGuestReadiness now races ensureForDistro(...) against the timeout, so the gate resolves as soon as the install pass settles and only a relay whose startup never settles pays the full 10s.
  • ensureForDistro/ensureInternal became async and share startup. A running relay awaits the rate-limited reinstall, a starting or cooling-down relay awaits existing.startup, and a fresh state stores startup so concurrent callers join the same launch instead of no-oping.
  • Per-kind install state replaced the single launchKind. launchKinds: Set drives a per-kind install loop that records piAgentDir/ompStatusExtension; installation dedups concurrent passes and a newly requested kind resets lastInstallAt so the pass re-runs.
  • Guest Pi/OMP env now reaches the guest. The ORCA_PI_SOURCE_AGENT_DIR/ORCA_OMP_STATUS_EXTENSION assignment moved below clearPiAgentShadowEnv and the host extension blocks, and wsl-orca-env.ts crosses them as /u when they hold guest POSIX paths.
  • Tests updated for the async 3-arg signature and cover readiness waiting on a gated install, startup failure, timeout, and the bare-shell skip.

Verification: pnpm tc:node passed; the six changed test files passed (104 tests).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the fix/19739-wsl-pi-extension branch from ebb8a35 to baa88d2 Compare September 20, 2026 22:07
@nwparker nwparker closed this Sep 20, 2026
@nwparker nwparker reopened this Sep 20, 2026
@nwparker nwparker closed this Sep 20, 2026
@nwparker nwparker reopened this Sep 20, 2026

@pullfrog pullfrog 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.

ℹ️ No critical issues — one rebase-hygiene suggestion inline.

Reviewed changes — the delta since pullfrog review 5261791541 on b4f85d5: a rebase onto current main with no content change to any PR file, plus one duplicate-helper issue the new base surfaces.

  • Rebased onto current main. Every one of the 17 PR files is byte-identical to the previously reviewed b4f85d5 (diff-tree restricted to the PR paths is empty); only the base advanced. main's newer clearPiAgentShadowEnv / host-extension ordering in assembly.ts still leaves the guest Pi/OMP env assignment (new lines 229-242) last, so the prior fix holds.
  • main's extracted helpers became unreferenced. wsl-hook-relay-state-machine.ts re-declares resolveWslDefaultDistro / resumeWslStoppedRelays, which now duplicate main's wsl-hook-default-distro.ts / wsl-hook-relay-resume.ts and leave those modules with no callers. Details inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

}
}

export async function resolveWslDefaultDistro(

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.

resolveWslDefaultDistro here, and resumeWslStoppedRelays above it, duplicate main's resolveWslHookDefaultDistro (wsl-hook-default-distro.ts:1) and resumeStoppedWslHookRelays (wsl-hook-relay-resume.ts:1) exactly, and main's manager was those modules' only caller. After this rebase the branch leaves both files unreferenced, so the tree ships two implementations of each. Prefer importing the existing helpers, or delete the now-dead files in this PR.

Technical details
# Rebase leaves `main`'s extracted WSL helpers dead

## Affected sites
- `src/main/agent-hooks/wsl-hook-relay-state-machine.ts:42` — `resumeWslStoppedRelays` duplicates `wsl-hook-relay-resume.ts:1`.
- `src/main/agent-hooks/wsl-hook-relay-state-machine.ts:60` — `resolveWslDefaultDistro` duplicates `wsl-hook-default-distro.ts:1`.
- `src/main/agent-hooks/wsl-hook-relay-manager.ts:31-35` — imports the state-machine copies; `main`'s manager imported the two files instead.
- `wsl-hook-default-distro.ts` / `wsl-hook-relay-resume.ts` — `git grep` on HEAD matches only their own declarations; no callers remain.

## Required outcome
- One implementation of each helper. Either the manager imports `resolveWslHookDefaultDistro`/`resumeStoppedWslHookRelays` from their existing modules (keeping only `markWslRelayFailed` in `wsl-hook-relay-state-machine.ts`), or those two files are deleted so the state-machine copies are the sole definitions.

## Open questions for the human
- Were `wsl-hook-default-distro.ts` and `wsl-hook-relay-resume.ts` added to `main` after this branch forked, and is the intent for the branch to adopt them? If a follow-up is planned, a note would avoid the dead-code window.

@nwparker
nwparker merged commit 3b055c8 into main Sep 20, 2026
68 of 70 checks passed
@nwparker
nwparker deleted the fix/19739-wsl-pi-extension branch September 20, 2026 23:17
brennanb2025 added a commit that referenced this pull request Oct 16, 2026
…ike host spawns (#29780)

A Pi or OMP agent started from the window inside WSL, with the terminal
daemon on, could start before the distro's hook relay was up. It then
reported no working/idle status for that session. Host starts and
local-provider starts already waited (#21721); the window's daemon path
was the one left out.

The shared host-env step now always runs the wait on the daemon spawns
it builds, so the lane input that skipped it for window starts is gone.
The wait is a no-op for anything but an explicit Pi/OMP launch in WSL.
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]: Pi status extension is installed on Windows but missing in WSL

1 participant