Repository navigation
Description
Summary
When auto-repair restarts a setup-managed local WSL gateway, it force-terminates the distro first. That also kills the keepalive (wsl.exe -d <distro> -- sleep infinity). The keepalive is re-armed only when the restart succeeds. If the restart fails or is aborted after the terminate, the distro is left with no keepalive until something else calls TryEnsureAsync. In my case that took about 6 hours.
Version
- OpenClaw Windows companion 2026.11.1 (
04f413d26531) - Setup-managed local gateway in the WSL distro
OpenClawGateway, running OpenClaw 2026.10.6
Code path (v2026.11.1)
WslGatewayController.cs:130:TerminateDistroAsync, i.e.wsl.exe --terminate <distro>. This kills everywsl.exesession of the distro, the keepalive included.ManagedLocalGatewayRepairCoordinator.cs:403-417: when the restart throws, returns!restart.Success, or hitsGetRestartAbortResult, the method returnsRestartFailedor an abort result.ManagedLocalGatewayRepairCoordinator.cs:419-421:_reArmKeepAliveAsyncis reached only on success, so the early returns above skip it.
Evidence (tray log, local time UTC-3)
[2026-11-08 20:53:08.412] [INFO] Running OpenClaw gateway restart in WSL distro 'OpenClawGateway'.
[2026-11-08 20:53:09.945] [INFO] Force-terminating WSL distro 'OpenClawGateway' before restart (in-place restart failed).
[2026-11-08 20:53:09.946] [INFO] [WSL] wsl.exe --terminate OpenClawGateway
[2026-11-08 20:53:10.035] [INFO] Running OpenClaw gateway restart in WSL distro 'OpenClawGateway'.
...
[2026-11-08 21:06:53.411] [INFO] Running OpenClaw gateway restart in WSL distro 'OpenClawGateway'.
[2026-11-08 21:06:55.202] [INFO] Force-terminating WSL distro 'OpenClawGateway' before restart (in-place restart failed).
[2026-11-08 21:06:55.202] [INFO] [WSL] wsl.exe --terminate OpenClawGateway
- The previous
[WslKeepAlive] Started keepaliveline is from 2026-11-07 17:25. - After these terminates, the next
[WslKeepAlive]line is at 2026-11-09 03:18:20. - The log does not record the outcome of either repair, so I can't tell whether it was
RestartFailedor an abort. Because no re-arm happened, it was not a success. - The gateway was slow and failing at startup at the time, which makes a failed restart likely.
Impact
- With no keepalive, the distro idles out and gets started again by later
wsl.execalls. - Each of those unclean stops counts toward the gateway's restart-loop breaker, which suppresses channel auto-start.
- Each stop also leaves behind a plugin capture, and those captures filled the host drive (see Bug: plugin source capture can consume the entire volume during plugin load churn (ENOSPC amplification loop) openclaw#161839).
- The gateway also had startup failures of its own, so this was not the only source of unclean restarts. It did keep the distro from recovering on its own.
Expected
After any repair attempt that has already issued --terminate, the keepalive should be re-armed, for example from a finally once the terminate has run, whether the restart succeeds or not. A more robust alternative would be for the keepalive service to watch its own process and respawn it whenever it exits.
Workaround
A per-user scheduled task at logon that runs wsl.exe -d OpenClawGateway -- sleep infinity in a loop and relaunches it when it exits.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsBacklog
Activity
clawsweeper commentedon Nov 9, 2026
Codex review: this still needs some work.
Summary
Keep this issue open: current main still skips keepalive restoration when a forced WSL restart fails, and no matching fix PR was identified.
Reproducibility: Current source establishes the path: a definitive in-place failure triggers distro termination, a failed cold restart returns RestartFailed, and the coordinator exits before re-arm; no build, test, or native reproduction ran during this read-only review, and WinApp CLI is unavailable on this host.
Next step
Fix failure-path keepalive restoration and first establish a failing regression covering termination followed by a failed cold restart, with no unintended restart after Stop or cancellation.
Review details
Best possible solution:
Restore keepalive after failed forced restarts while retaining lifecycle ownership, cancellation, and explicit user-intent safeguards.
Do we have a high-confidence way to reproduce the issue?
Current source establishes the path: a definitive in-place failure triggers distro termination, a failed cold restart returns RestartFailed, and the coordinator exits before re-arm; no build, test, or native reproduction ran during this read-only review, and WinApp CLI is unavailable on this host.
Is this the best way to solve the issue?
A focused lifecycle repair is justified, but an unconditional finally or a new respawn supervisor is broader than necessary and could defeat intentional shutdown.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 045d13ac19b8.
Label changes
Label changes:
P1: A source-confirmed failure in default managed-local recovery can prolong an existing gateway outage on an official affected release.impact:crash-loop: Losing the WSL keepalive after forced termination undermines gateway process availability and can permit repeated distro idle shutdowns.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P1: A source-confirmed failure in default managed-local recovery can prolong an existing gateway outage on an official affected release.impact:crash-loop: Losing the WSL keepalive after forced termination undermines gateway process availability and can permit repeated distro idle shutdowns.Evidence reviewed
Acceptance criteria:
ManagedLocalGatewayRepairCoordinatorTests|FullyQualifiedNameWslGatewayControllerTests|FullyQualifiedName~WslKeepAlivePolicyTests"What I checked:
src/OpenClaw.Tray.WinUI/Services/ManagedLocalGatewayRepairCoordinator.cs:403, 045d13ac19b8)src/OpenClaw.Connection/WslGatewayController.cs:130, 045d13ac19b8)src/OpenClaw.Tray.WinUI/Services/WslGatewayKeepAliveService.cs:73, 045d13ac19b8)tests/OpenClaw.Tray.Tests/ManagedLocalGatewayRepairCoordinatorTests.cs:517, 045d13ac19b8)src/OpenClaw.Tray.WinUI/Services/ManagedLocalGatewayRepairCoordinator.cs:421, bc210e048aa9)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed November 9, 2026, 1:27 PM ET / 18:27 UTC.