You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LLC adapters: agent cancel/timeout orphans the whole subprocess tree #13097
terminate_pid() signals a single PID. None of the LLC CLI adapters spawn
their child in its own process group, so cancelling or timing out an agent run
kills the CLI process and orphans every descendant it spawned.
Agent CLIs are process trees, not single processes: the Claude Code CLI spawns
Bash-tool children, MCP servers, and npx/node chains. Those keep running after
the parent is killed — holding file handles, ports, and workspace locks, and in
the worst case continuing to mutate a workspace that the scheduler believes is
released.
Evidence
autobot-backend/llc/adapters/subprocess_support.py:302-335 — terminate_pid()
uses os.kill(pid, signal.SIGTERM) then os.kill(pid, signal.SIGKILL) on one PID.
All 8 spawn sites use bare asyncio.create_subprocess_exec with no start_new_session:
Add start_new_session=True to all 8 create_subprocess_exec calls.
terminate_pid() → signal the process group via os.killpg(os.getpgid(pid), …),
falling back to the current single-PID path on ProcessLookupError / PermissionError (a child that already changed its own pgid, or a
non-signallable group).
Preserve the existing return contract: True when the process was already gone
on the initial signal.
Acceptance criteria
All 8 spawn sites create a new session/process group
terminate_pid() kills the group, with documented single-PID fallback
Test: spawn a parent that forks a long-lived child; assert the grandchild is
gone after terminate_pid()
Test: already-dead PID still returns True (no regression)
SIGTERM→SIGKILL grace behaviour unchanged
Notes
Found during a capability audit of the LLC adapter layer. This is a live
correctness bug, not a feature request.
Closure audit against origin/main (vehicle merge #16702, closing PR #16284).
AC
Verdict
Evidence
All 8 spawn sites create new session/process group
met
Every LLC adapter routes through autobot-backend/llc/adapters/subprocess_support.py:spawn_detached() (start_new_session=True); tests/test_process_group_kill_13097.py::TestSpawnSitesCreateNewSession::test_every_call_site_sets_start_new_session is an AST-based guard over every call site
terminate_pid() kills the group, documented single-PID fallback
met
subprocess_support.py:terminate_pid() uses _process_group_id()/_signal_target(); falls back to os.kill(pid, sig) on ProcessLookupError/PermissionError or when pid isn't its own group leader (docstring at line ~498)
tests/test_process_group_kill_13097.py::test_sigterm_then_sigkill_after_grace; terminate_pid() retains the same grace-poll-then-SIGKILL shape, now targeting the group
Activity
mrveiss commentedon Jul 31, 2026
Parent: #13096 (capability audit umbrella).
fix(llc): never signal a process the run no longer owns, and judge a …
fix(llc): survive a missing boot time and honour the SIGKILL grace pe…
fix(llc): kill the agent's whole process tree on cancel and timeout, …
fix(llc): never signal a process the run no longer owns, and judge a …
fix(llc): survive a missing boot time and honour the SIGKILL grace pe…
test(llc): mark the two survive-a-window sleeps as deliberate for the…
2 remaining items
test(guards): register the two deliberate stall-watchdog sleeps in th…
fix(llc): kill the agent's whole process tree on cancel and timeout, …
fix(llc): never signal a process the run no longer owns, and judge a …
fix(llc): survive a missing boot time and honour the SIGKILL grace pe…
test(llc): mark the two survive-a-window sleeps as deliberate for the…
fix(llc): drop the duplicated registry docstring paragraph (#13097)
fix(llc): a finished run polled after its stall deadline never touche…
test(guards): register the two deliberate stall-watchdog sleeps in th…
fix(tests): use a long-lived child to avoid the pid-reuse test's own …
mrveiss commentedon Sep 14, 2026
Closure audit against
origin/main(vehicle merge #16702, closing PR #16284).autobot-backend/llc/adapters/subprocess_support.py:spawn_detached()(start_new_session=True);tests/test_process_group_kill_13097.py::TestSpawnSitesCreateNewSession::test_every_call_site_sets_start_new_sessionis an AST-based guard over every call siteterminate_pid()kills the group, documented single-PID fallbacksubprocess_support.py:terminate_pid()uses_process_group_id()/_signal_target(); falls back toos.kill(pid, sig)onProcessLookupError/PermissionErroror when pid isn't its own group leader (docstring at line ~498)terminate_pid()tests/test_process_group_kill_13097.py::TestGrandchildSurvival::test_terminate_pid_kills_the_grandchildTruetests/test_process_group_kill_13097.py::TestTerminatePidRealProcesses::test_already_dead_pid_returns_truetests/test_process_group_kill_13097.py::test_sigterm_then_sigkill_after_grace;terminate_pid()retains the same grace-poll-then-SIGKILL shape, now targeting the groupAll 5 criteria met. Kept closed.
fix(test): the already-dead-pid test's child blocks on stdin until it…