Repository navigation
fix: kill extension exec descendants on timeout - #98342
qingminglong wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same linked bug now has a stronger canonical landing path in #98340, which is open, mergeable, implements the same process-tree cleanup with explicit helper options, and has live ExtensionAPI.exec proof. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #98340 as the canonical landing path, optionally preserving this PR's extra abort and no-PID regression coverage there. So I’m closing this here and keeping the remaining discussion on #98340. Review detailsBest possible solution: Use #98340 as the canonical landing path, optionally preserving this PR's extra abort and no-PID regression coverage there. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main and v2026.6.11 kill only the direct api.exec child, while the linked PRs and shared helper show the intended process-tree cleanup boundary. Is this the best way to solve the issue? No as the branch to keep open. The implementation is plausible, but #98340 is the better canonical landing path because it has the same fix shape, explicit helper options, clean mergeability, and live ExtensionAPI.exec proof. Security review: Security review cleared: The diff stays within existing local process termination and tests, with no new dependency, secret, CI, workflow, package, or permission surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 4ac5cf863673. |
|
ClawSweeper applied the proposed close for this PR.
|
Closes #98335
What Problem This Solves
Fixes an issue where session extensions using
api.exec()could report a timed-out, aborted, or output-limit-killed command as killed while descendant processes launched by that command continued running in the background.Why This Change Was Made
api.exec()now uses the existing OpenClaw process-tree termination helper for timeout, abort, and default output-limit kills. On Unix it spawns the command in a separate process group so the tree signal reaches descendants; on Windows it stays non-detached and lets the shared helper use the taskkill tree boundary. The no-PID direct-kill fallback is preserved.User Impact
Extension authors and operators can expect
api.exec()cleanup to match the built-in command execution boundary more closely: when OpenClaw reports an extension exec command as killed, wrapper-launched descendants are not left behind under the normal timeout/abort/output-limit kill paths.Evidence
killProcessTree()when a child PID is available, while preserving the directSIGTERM/SIGKILLfallback when no PID exists.node scripts/run-vitest.mjs src/agents/sessions/exec.test.ts src/process/kill-tree.test.tssrc/agents/sessions/exec.test.ts11 tests passed,src/process/kill-tree.test.ts7 tests passed.corepack pnpm exec oxfmt --check --threads=1 src/agents/sessions/exec.ts src/agents/sessions/exec.test.tsgit diff --checknode --import tsx -proof script that invokedexecCommand(process.execPath, ["-e", parentScript], process.cwd(), { timeout: 250 }), where the parent Node process spawned a marker-bearing child Node process and then idled.{ "killed": true, "code": 1, "leftovers": [] }for markerOPENCLAW_EXEC_TREE_PROOF_29996_1782873839097.python .agents\skills\autoreview\scripts\autoreview --mode localautoreview clean: no accepted/actionable findings reported; the helper also printed a late Windows GBK reader-thread decode exception after the clean verdict, but exited 0.Not tested / proof gaps:
pnpm check, full typecheck, or broad test suites per the contributor-scope instructions.