S00-014: Make successful runner process-tree cleanup idempotent

Changes: Record completed termination on the Popen instance after all cleanup steps succeed; avoid repeated signals to the reaped group. Add deterministic repeated-EPERM and failed-descendant-kill retry regressions without suppressing permission errors.
Validation: Four focused cleanup tests passed; make check passed 72 tests and plan/snapshot validation. git diff --check passed. Natural prior EPERM did not recur; injected EPERM reproduced the pre-fix failure. No application or parent-task acceptance is claimed.

Task: S00-014
Agent: auto-ci-cd-14343249da62
Role: ci-cd
Action: claim
Status: review

Task title: Fix repeated runner cleanup after a submitted parent is reaped
This commit is contained in:
wt committed 2026-10-15 01:47:20 +07:00
1 parent 49c054aaf9
commit 7a737eeb49
9 files changed
+106 -9

No files matched your search

+8
View File
@@ -335,6 +335,10 @@ The coordinator commits each transition before launching another agent.
def stop_process_tree(process):
# Transition/deadline handling and finally share this Popen instance. Once
# cleanup succeeds, do not signal its reaped (possibly reused) group again.
if getattr(process, '_luma_tree_stopped', False) is True:
return
if os.name == 'posix':
try:
os.killpg(process.pid, signal.SIGTERM)
@@ -360,6 +364,10 @@ def stop_process_tree(process):
except ProcessLookupError:
pass
# Set only after all termination steps succeed. Permission errors must
# propagate, including when the parent exited but a descendant is live.
process._luma_tree_stopped = True
def task_scope(tracker, task_id):
return tracker.task(task_id)['scope']