Repository navigation
fix(agent-hooks): the WSL hook relay stays down while its distro is stopped (E9) - #34195
Conversation
…topped (E9)
verify-15b: after `wsl --terminate`, the relay link died ("mux disposed
(connection_lost); scheduling restart") and about 10 s later a `wsl.exe … launch.sh`
restart booted the stopped distro. The restart already asked whether the distro
runs, but any running-list answer would do, including one from a read that started
before the link died. Now:
- only a confirmed running-list read started after the link died can allow the
restart (the shared startedAfter rule; a failed read counts as stopped);
- while the distro is stopped the relay stays down, and it comes back on its own once
something else confirms the distro runs again (deferUntilWslDistroRunning), or when
a WSL terminal re-ensures it as before. Nothing in recovery boots a distro.
Co-Authored-By: Claude <[email protected]>
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ac1070dc-00c0-4ee3-95f3-24421da02d0d
Files selected for processing: 6-
src/main/agent-hooks/wsl-hook-relay-deps.tssrc/main/agent-hooks/wsl-hook-relay-manager.test.tssrc/main/agent-hooks/wsl-hook-relay-manager.tssrc/main/agent-hooks/wsl-hook-relay-recovery.test.tssrc/main/agent-hooks/wsl-hook-relay-recovery.tssrc/main/wsl-background-distro-gate.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
-
…rred relay restart A stopped verdict dropped the relay state before the deferred restart ran, so the relay came back without the managed Codex home or the pi/omp launch setups. Capture them first and pass them through. Also re-probe once after 30 s so a failed running-list read while the distro is up does not leave the relay down.
…ep all relay config The running-list read must start when the restart check runs, not when the link died: a read begun right after a terminate can still list the distro. A deferred restart now seeds every relay config field (Codex home, Claude agent view and config dirs, OpenCode overlays, pi/omp setups) so ensure brings them back.
ELI5
After
wsl --terminate, the WSL hook relay (which carries agent status from WSL terminals back to Orca) noticed its link had died and, about 10 s later, restarted. The restart ranwsl.exe … launch.sh, which switched the stopped distro back on. Now the relay stays down while its distro is stopped, and comes back by itself when the distro runs again or when you open a WSL terminal.What Changed
startedAfter, set to the moment the restart check runs, so only a read that started then can allow the restart. A read that started just after the terminate, while WSL still listed the distro, can't. This reuses the shared rule inwsl-running-distro-cache.ts.isWslDistroRunningandlistConfirmedRunningWslDistrostake the option and pass it through.deferUntilWslDistroRunning, so it restarts once something else, such as the user, is seen to have started the distro. It never boots the distro itself.src/main/agent-hooks/wsl-hook-relay-recovery.ts,wsl-hook-relay-state-machine.ts(the restart and recovery wiring moved here so the manager stays within the line limit),wsl-hook-relay-manager.ts,wsl-hook-relay-deps.ts,src/main/wsl-background-distro-gate.ts.Why
E9 says nothing boots a stopped distro in the background. The relay's restart is background work. The
startedAfterrule is the one the WSL host liveness code already uses after an exit.Linked Issue
WSL re-write, gate E9. Evidence: verify-15b final (
5e-2-terminate-log.txt,logs-noauto/).Visual Proof
N/A: no UI.
Testing
wsl-hook-relay-recovery.test.ts: the restart's running-list read is anchored at check time, not at the terminate; after a terminate the relay stays down, never restarts on its own, and restarts once the deferred "distro runs again" fires.isWslDistroRunning(codex runtime home routing, kimi, guest pane processes, running-distro cache).pnpm tc:nodeandcheck:code-quality:changedpass.Review
Self-reviewed.
Agent skill upstream boundary
Notes
fs:readDirrealpath on\\wsl.localhost\<distro>\…\p10erroring. Access to a\\wsl.localhostpath can itself start a stopped distro, so the file explorer reading a bridge project's UNC path may be a second background booter. That needs process-level evidence to confirm.