Repository navigation
Description
Reproduction
On unmodified official dev a72271d9c23a4ec8a2aa273bcc9e15a363135685, cancelling a chat or headless execution coroutine after its subprocess is registered removes that subprocess from ProcessRegistry even while it continues running. Cancelling an asyncio waiter does not stop an already-running executor thread.
- Run either execution coroutine with a disposable Python child in place of the model CLI.
- Wait for subprocess registration and stdin closure, then cancel the coroutine.
- Confirm the child is still alive with
poll(), and query the registry.
Expected: the child remains tracked and available to status/termination until its exit is observed; tracking and log subscriptions close after eventual worker completion.
Actual: the child remains alive but is absent from the registry. The same ownership issue applies when the outer timeout abandons its worker.
A second regression exercises terminate() with both waits raising subprocess.TimeoutExpired: after SIGINT and SIGKILL fail to establish exit, it still reports success. Expected: an explicit unconfirmed-termination failure and retained handle.
Environment and evidence
Python 3.13 in an isolated Linux container, official dev revision above. Three initial regression cases fail on stock: cancelled chat, cancelled headless execution, and unconfirmed termination. These tests use ordinary local Python children, no model/provider calls, and stub cgroup sweeping so they own only their test children.
A registry-only change is insufficient: it preserves live handles but has no eventual cleanup when the request waiter has already ended. Both executors need worker-completion cleanup after waiter abandonment while retaining normal result-before-stream-end ordering.
Scope
This report concerns ownership of registered processes and truthful termination results. It does not claim a solution for pre-spawn ownership, capacity enforcement, server restart survival, or complete descendant-process termination.
Related work: #2433, #2435 and #2450 cover timeout/executor and cleanup concerns; the cancellation and eventual-cleanup regressions above are distinct. Existing issue/PR searches found no direct open duplicate.
Activity
test(runtime): sequence the finish-race test so the cancel always bea…
fix: retain subprocess ownership after waiter cancellation (#3308)
fix(codex): release an abandoned Codex waiter's child when its reader…
fix(agent-runtime): a failed prompt handoff kills the child and obser…
fix(gemini): reap the headless child before the reader raises (#4011)
fix(agent-runtime): an abandoned Gemini waiter hands release to its s…