Repository navigation
Conversation
Node's spawn() emits 'error' asynchronously when the binary is missing or
fails to execute. The try/catch at the force-kill taskkill site (line 546)
only catches synchronous throws, so an async spawn error permanently
leaks the child process tree on Windows.
Add an 'error' event listener that falls back to child.kill("SIGKILL"),
mirroring the existing catch-block behavior.
Fixes openclaw#101381
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 2:35 AM ET / 06:35 UTC. Summary PR surface: Source +3, Tests +79. Total +82 across 2 files. Reproducibility: yes. for source-level reproduction: current source returns after taskkill spawns that lack async Review metrics: 1 noteworthy metric.
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 findings
Review detailsBest possible solution: Route the Windows taskkill launches through one small helper, or equivalent shared logic, so every taskkill child observes async spawn failures and falls back to direct Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current source returns after taskkill spawns that lack async Is this the best way to solve the issue? No: adding the handler only to the delayed force-kill spawn is narrower than the bug boundary because sibling taskkill spawns in the same cleanup helper still share the async-error failure mode. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 33163d427391. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +3, Tests +79. Total +82 across 2 files. View PR surface stats
Acceptance criteria:
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
|
|
Closing as a duplicate of #101392. #101409 correctly identifies the asynchronous Thank you for the precise regression test. A failure mode not covered by those canonical paths would be new evidence to reopen or split follow-up work. |
What Problem This Solves
Closes #101381
In
src/process/exec.ts, the force-kill taskkill fallback on Windows spawnstaskkill /PID /T /Finside atry/catchblock. However, Node'sspawn()does not throw synchronously when the binary is missing or fails to execute — it emits an'error'event asynchronously. The catch block (child.kill("SIGKILL")) never executes, so the child process tree is permanently leaked.This happens specifically at the force-kill site (line 546), which is the safety-net fallback after the first graceful taskkill attempt. If
taskkill.execan't be spawned (missing system32 path, misconfigured environment, etc.), the child process and its descendants silently leak.Why This Change Was Made
The fix adds an
'error'event listener on the spawned taskkill process that callschild.kill("SIGKILL")— mirroring the existing catch-block fallback. Both the synccatchand the async'error'handler now produce the same final outcome.The change is minimal: 3 added lines that save the spawn result and attach the error handler.
Evidence
New regression test: "falls back to SIGKILL when force-kill taskkill spawn emits async error"
The test simulates the Windows kill path with
vi.spyOn(process, 'platform', 'get').mockReturnValue('win32'):killProcessTree: trueand a short timeout'error'event on the spawned taskkill processchild.kill("SIGKILL")was calledAll tests pass (20/20)
Not tested
Merge Risk
Low. The change:
process.platform === "win32"code pathchild.kill("SIGKILL")