Repository navigation
fix(process): fall back when Windows taskkill cannot spawn - #101392
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 2:29 AM ET / 06:29 UTC. Summary PR surface: Source +12, Tests +72. Total +84 across 4 files. Reproducibility: yes. for source-level reproduction: current main and v2026.6.11 still spawn Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one canonical process-layer fix that preserves trusted System32 taskkill resolution, handles async taskkill errors in both exec cleanup and the shared helper, includes focused tests, and has redacted real Windows proof. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main and v2026.6.11 still spawn Is this the best way to solve the issue? Yes for the code shape: observing taskkill child AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 13f8dfae864f. Label changesLabel justifications:
Evidence reviewedPR surface: Source +12, Tests +72. Total +84 across 4 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
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Land-ready verification:
Known proof gap: I did not destructively hide or replace the protected System32 By Wynne668 (@ZengWen-DT, account created 2026-06-05) | OpenClaw: 85 PRs, 0 issues, 40 commits/12mo | GitHub: 46 commits, 85 PRs, 0 issues, 0 reviews/12mo. |
|
Merged via squash.
|
…estart (openclaw#101392 follow-up) The spawn() call in relaunchGatewayScheduledTask() creates a detached child process with child.unref() but without an 'error' listener. When spawn fails, Node.js emits an async 'error' event that crashes the parent as an unhandled error. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…101392 follow-up) The spawn mock in schtasks.startup-fallback.test.ts was missing the `on` property, causing "child.on is not a function" when launchFallbackTaskScript calls child.on("error", ...). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Closes #101381
What Problem This Solves
Fixes an issue where Windows timeout cleanup could fail to terminate a timed-out command when
taskkill.exefailed afterspawn()returned. Node reports failed child-process spawns through the child processerrorevent, so the oldtry/catchfallback could miss the failure and leave the original command process running.Why This Change Was Made
The Windows cleanup path now attaches an async spawn-error fallback to each
taskkill.exechild and routes both synchronous and asynchronous failures through the same directchild.kill("SIGKILL")fallback. The change keeps the trusted System32taskkill.exeresolution insrc/process/exec.ts; the shared process-tree helper also now observes asynctaskkillerrors so its existing best-effort ignore contract covers both failure modes.This is the canonical candidate for #101381 after #101389 was closed as the weaker duplicate; #101392 keeps the timer cleanup, shared helper guard, and focused Windows regression coverage.
User Impact
Windows users should no longer accumulate leaked direct child processes when command timeout cleanup cannot start
taskkill.exe. Normaltaskkill.execleanup behavior is unchanged when it starts successfully.Evidence
Node contract premise:
ChildProcessemitserrorwhen a process could not be spawned, andclosefollowsexitorerror: https://nodejs.org/api/child_process.html#event-errorBefore/after behavior harness:
Focused local tests:
Windows runner proof from this PR:
WIN-FE737MTRSOT.pnpm test:windows:ci.src/process/exec.windows.test.ts, which contains the new forced and graceful taskkill childerrorfallback tests. The job log shows:Other local checks:
Not run locally: full
pnpm check/pnpm test; this linked checkout is using focused local proof and GitHub CI for broad gates. Live Windows terminal proof from my local environment was not available becausepowershell.exe,pwsh, andcmd.exewere not present; the Windows behavior is covered by the Node child_process contract check, focused OpenClaw regression tests, and the Windows CI runner log above.AI-assisted: AI-assisted; proof run manually.