9990bcb8ce
LocalEnvironment._kill_process kills the process GROUP (SIGTERM -> 1s wait -> SIGKILL -> 2s wait), but a descendant that called setsid escapes the group and survives — the #71148 orphan class, terminal flavor (issue #84967's local sibling). Fix: snapshot the descendant set via psutil BEFORE the first SIGTERM (children reparent to init once the wrapper dies, so a later parent walk finds nothing — same snapshot-before-signal design as agent/deadline.py kill_process_tree), then after the existing group escalation completes, SIGKILL any snapshotted survivor whose pgid is no longer the (now-dead) group. The TERM->KILL grace window for in-group members is preserved (interrupts use this path too), the Windows branch is untouched, and the snapshot is fully guarded — a broken psutil never breaks the kill path (unit-tested). Tests: live_system_guard_bypass acceptance test spawning a setsid grandchild and forcing the timeout path (RED on unmodified file, GREEN after), plus a psutil-failure unit test. Docker design note (#84967 open question 1, condensed; full note at /tmp/4b-docker-design-note.md): the docker backend inherits base.py:1378 _kill_process, which only proc.kill()s the HOST-side `docker exec` client — the in-container tree (child of containerd- shim, not the client) survives every timeout entirely. Option A, `docker exec <cid> kill -- -<pgid>` with TERM->KILL escalation using a PGID captured at command start, is surgical and preserves container state but needs a live container + shell and still misses in-container setsid escapees. Option B, container restart, is absolute (PID- namespace teardown kills everything) but destroys all in-container state mid-session and punishes every other consumer of the shared persistent container. Recommendation: Option A as a best-effort _kill_process override (degrade to today's behavior on failure); reserve restart for the existing container-gone recovery path.