Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 1:47 AM ET / 05:47 UTC. Summary PR surface: Source +11. Total +11 across 1 file. Reproducibility: yes. for source-level reproduction: current main and the latest release show taskkill child spawns without 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 a narrow process-layer fix that preserves the trusted System32 taskkill lookup, handles async taskkill child errors, and includes focused fallback coverage plus real Windows proof. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main and the latest release show taskkill child spawns without Is this the best way to solve the issue? Yes for the code shape: observing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 094c0d421faf. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +11. Total +11 across 1 file. 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
|
…rocess leaks
Node.js spawn() emits 'error' asynchronously when the target executable
fails to start — try/catch cannot see it. Attach error handlers to all
three Windows taskkill spawns in killChild so missing or blocked
taskkill.exe falls back to child.kill("SIGKILL") instead of silently
leaking orphaned process trees.
Fixes openclaw#101381
…rocess leaks
Node.js spawn() emits 'error' asynchronously when the target executable fails
to start — try/catch cannot see it. Attach once('error') handlers to all taskkill
spawns so missing, blocked, or corrupted taskkill.exe falls back to direct
child.kill('SIGKILL') instead of silently leaking orphaned process trees.
- Extract spawnTaskkillOrFallback helper to reduce duplication across 3 call sites
- Extract killDirectChild helper for consistent guarded child termination
- Fix kill-tree.ts runTaskkill to handle async spawn errors (best-effort contract)
- Add regression tests for graceful, forced, and no-tree-kill taskkill error paths
- Add kill-tree test for async taskkill error survival
Fixes openclaw#101381
5cd0972 to
877b9fb
Compare
|
Closing as the weaker duplicate of #101392 for #101381. #101392 covers the same asynchronous The canonical branch still needs real Windows proof before landing; this closure only consolidates the implementation discussion. |
What Problem This Solves
Fixes #101381
In
src/process/exec.ts, the Windowstaskkill.exeprocess tree cleanup usesspawn()insidetry/catchblocks, but Node.jsspawn()errors are emitted asynchronously — not thrown synchronously. Iftaskkill.exefails to start (missing binary, permission denied, antivirus interception), thetry/catchnever fires,child.kill("SIGKILL")is never called, and the orphaned child process tree permanently leaks system resources.Why This Change Was Made
Three
spawn(taskkillPath, ...)calls in thekillChildfunction had noerrorevent handlers. The fix captures the returnedChildProcessand attaches.on("error", () => child.kill("SIGKILL"))so any async spawn failure falls back to direct child termination.Fixed locations
taskkill /TgracefulKiller.on("error", () => child.kill("SIGKILL"))taskkill /T /F(post-timeout)forceKiller.on("error", () => child.kill("SIGKILL"))taskkill /T /F(no-tree-kill path)directKiller.on("error", () => child.kill("SIGKILL"))All three paths now defend against both synchronous (
catchclause) and asynchronous (errorevent) spawn failures.User Impact
taskkill.exe→ orphaned Windows process trees accumulate indefinitelychild.kill("SIGKILL")runs, process tree is terminatedEvidence
pnpm tsgo— passnode scripts/run-vitest.mjs src/process/exec.test.ts src/process/exec.windows.test.ts src/process/kill-tree.test.ts— 49 tests passed