fix(daemon): keep node tasks off gateway listener cleanup#85597
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 26, 2026, 1:48 PM ET / 17:48 UTC. Summary PR surface: Source +175, Tests +441. Total +616 across 3 files. Reproducibility: yes. source-reproducible: current main's Windows Scheduled Task stop/restart path always resolves and cleans gateway listener ports, and the linked issue gives concrete Windows/WSL2 steps. I did not rerun the Windows repro in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the focused daemon fix after maintainer review and CI acceptance so Windows node lifecycle commands target only the installed node host and leave WSL2 gateway listeners alone. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main's Windows Scheduled Task stop/restart path always resolves and cleans gateway listener ports, and the linked issue gives concrete Windows/WSL2 steps. I did not rerun the Windows repro in this read-only review. Is this the best way to solve the issue? Yes; splitting gateway-listener cleanup by service kind and matching the installed node command is the narrowest maintainable fix for the implicated daemon path. The remaining packaged CLI proof gap is a maintainer acceptance call, not a concrete code defect from this review. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 8c575bd3c8d2. Label changesLabel justifications:
Evidence reviewedPR surface: Source +175, Tests +441. Total +616 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🌱 uncommon Cosmic Branchling Hatch commandComment Hatchability rules:
Rarity: 🌱 uncommon. What is this egg doing here?
|
41413cd to
9204441
Compare
|
@clawsweeper re-review Current GitHub checks are green, including Real behavior proof. Please refresh the durable review verdict and labels for this head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Maintainer proof decision for #85597: I accept the existing partial native Windows/WSL2 proof for this availability fix rather than blocking on the exact packaged Rationale:
Please refresh the durable verdict/labels with maintainer acceptance of the direct Task Scheduler proof. |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
9204441 to
4fcf7bd
Compare
|
Updated #85597 against current Current head: Verification run after the rebase:
GitHub now reports the PR as mergeable. CI is rerunning on the new head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Follow-up after the failed-job rerun on the rebased head
So the conflict update is pushed and the remaining red CI is unrelated to this branch's changed surface. |
|
Updated the branch with a focused CI repair for the failing checks.\n\nValidation run locally in WSL from /root/src/openclaw-85597-ci:\n- \pnpm lint --threads=2\n- \pnpm check:test-types\n- \pnpm lint:extensions:bundled\n- |
8f29499 to
10b6987
Compare
|
Rebased the PR branch onto current main and force-updated it with an explicit lease. The branch now carries only the daemon fix commit on top of main.\n\nRevalidated after rebase in WSL from /root/src/openclaw-85597-ci:\n- \pnpm lint:extensions:bundled\n- \pnpm check:test-types\n- \pnpm lint --threads=2\n- |
97ed722 to
41a81b5
Compare
90231b3 to
1841067
Compare
|
@clawsweeper re-review Refreshed #85597 onto current upstream \main\ by rebuilding the branch as the original daemon fix commit on top of current main, removing the old merge-from-main commits. New signed head is \1841067017cf8fa8b4e30e684f529f259d9b410a. Focused WSL validation after the refresh passed:
Existing native Windows/WSL2 Task Scheduler proof remains in the PR body. No merge performed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1841067 to
1697564
Compare
|
@clawsweeper re-review Refreshed #85597 onto current upstream \main\; new signed head is \169756458c5298a85cb063ff7deafe26d3fe8f80\. Focused WSL validation after the refresh passed:
Existing native Windows/WSL2 Task Scheduler proof remains in the PR body. No merge performed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1697564 to
ccf3d04
Compare
|
@clawsweeper re-review Refreshed #85597 onto current upstream \main\; new signed head is \ccf3d0481c72f2df08135bb1fcf5f1559947f788\. Focused WSL validation after the refresh passed:
Existing native Windows/WSL2 Task Scheduler proof remains in the PR body. No merge performed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer verification before landing:
This matches #85289: node stop/restart no longer reclaims or waits on the gateway listener port, while node runtime detection/cleanup is limited to the installed node host command line. |
Summary
Fixes #85289
Verification
git diff --checknode_modules/.bin/oxfmt --check --threads=1 src/daemon/schtasks.ts src/daemon/schtasks.stop.test.ts src/daemon/schtasks.startup-fallback.test.tsOPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_TEST_PROJECTS_SERIAL=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=120000 node scripts/run-vitest.mjs run src/daemon/schtasks.stop.test.ts --reporter=verboseOPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_TEST_PROJECTS_SERIAL=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=120000 node scripts/run-vitest.mjs run src/daemon/schtasks.startup-fallback.test.ts --reporter=dotcodex review --uncommittedReal behavior proof
Behavior addressed: Windows node Scheduled Task lifecycle no longer reclaims or reports runtime from the Gateway listener port, while still detecting and stopping the installed node host process by matching the installed command line.
Real environment tested: WSL Ubuntu-24.04 durable OpenClaw worktree at
/root/src/openclaw-85597; native Windows hostredmond\giodlwith Ubuntu-24.04 WSL2; Windows Task Scheduler (schtasks) run/end/rerun/end against task nameOpenClaw Node; WSL loopback listener reachable from Windows on127.0.0.1:19897.Exact steps or command run after this patch: From the WSL PR checkout at SHA
9204441152acbc9ace41eff1ed369eed053f3935, ran focused daemon tests and maintainer Testbox below; then started a WSL TCP listener with WindowsStart-Process wsl.exe -u root -- node /tmp/oc85597-listener.js 19897, createdOpenClaw Nodewithschtasks /Create, ranschtasks /Run,schtasks /End, reran, and ended it again while probingTest-NetConnection 127.0.0.1 -Port 19897after each lifecycle step.Evidence after fix: Focused daemon tests passed; Blacksmith Testbox
pnpm check:changedpassed; native Windows/WSL supplemental proof showedtcp_127.0.0.1_19897=Trueafter WSL listener start, after node task run, after node task end, after node task rerun, and after node task second end.Observed result after fix: Node service paths skip gateway listener/port cleanup, ignore unrelated manual node hosts on the same gateway port, and terminate only the matching installed node host command when stop/restart needs process cleanup. In the native Windows/WSL supplemental proof, Windows Task Scheduler lifecycle activity did not disrupt the WSL loopback listener.
What was not tested: full native
openclaw node install/start/stop/restartagainst the active Sebby/OpenClaw VM setup. The local native package path was blocked by unrelated environment issues:pnpm buildcurrently fails onprotobufjsdescriptor resolution in the shared WSL dependency tree, and the packaged launcher/tsx respawn hits a Windows child-processAccess is deniedfailure on this host.Additional maintainer verification
node scripts/run-vitest.mjs src/daemon/schtasks.stop.test.ts src/daemon/schtasks.startup-fallback.test.ts src/daemon/schtasks.test.ts src/daemon/service.test.ts src/commands/node-daemon-install-helpers.test.ts- passed 5 files / 78 testsnode_modules/.bin/oxlint src/daemon/schtasks.ts src/daemon/schtasks.stop.test.ts src/daemon/schtasks.startup-fallback.test.tsnode_modules/.bin/oxfmt --check --threads=1 src/daemon/schtasks.ts src/daemon/schtasks.stop.test.ts src/daemon/schtasks.startup-fallback.test.tsgit diff --checktbx_01ks9f2fmhfar6ahwqvx071pak, Actions run https://github.com/openclaw/openclaw/actions/runs/26322648137, commandcorepack pnpm check:changed, exit 0redmond\giodl, Ubuntu-24.04 WSL2, taskOpenClaw Node, port19897;Test-NetConnectionstayed true afterschtasks /Run,schtasks /End, rerun, and second end; cleanup removed the task and stopped the listener.