fix(code-run): terminate descendant processes - #800
Draft
Whxuan0701 wants to merge 1 commit into
Draft
Conversation
Author
|
Implementation and regression tests are ready in this draft. The POSIX process-group path was exercised on macOS 14.6.1; the Windows Job Object path is included but awaits Windows CI/maintainer validation. |
Whxuan0701
force-pushed
the
fix/code-run-process-tree
branch
from
September 8, 2026 09:29
709769f to
c489fc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #797
What
code_runin its own session and terminates the process group on stop/timeout.taskkill /T /Fas a fallback when job assignment is unavailable.Why
The previous
process.kill()only terminated the direct child. A command could report[Stopped]or[Timeout Error]while grandchildren continued running, retained resources, or modified files later.Validation
f6e5657: delayed child canary still appears after timeout.frontends/tests/test_code_run_process_tree.py— 2 passed.python -m py_compile ga.pyandgit diff --checkpassed.Boundary
The POSIX behavior was exercised on macOS. The Windows Job Object path was syntax-checked and is covered structurally by the same implementation, but I did not have a Windows host for an end-to-end descendant canary run; Windows CI feedback is welcome while this remains a draft.
Review note
The Windows
Popen-to-Job assignment has an unavoidable short creation window with the stdlib API. A child that forks and exits before assignment can escape the job. If maintainers need a strict Windows guarantee, I suggest following up with suspended process creation plus assignment before resume; I kept that lower-level change out of this focused patch.