Repository navigation
fix(sandbox): terminate POSIX shell children on timeout - #3508
Draft
BichengWang wants to merge 1 commit into
Draft
BichengWang wants to merge 1 commit into
BichengWang wants to merge 1 commit into
Conversation
5 of 6 tasks
This branch has not been deployed
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.
Why are these changes needed?
A local shell command can return timeout exit code 124 while its child keeps running and writing files. Killing only
shleaves the actual command alive. This also happens when the shell has exited but a background child still holds the output pipes open.Start local commands in their own POSIX session and kill their process group on timeout, then reap the direct process. Other platforms retain direct-process termination. The timeout message and exit code stay the same. The sandbox docstring describes the POSIX behavior.
The regression starts a child that waits for a release file. After the timeout returns, releasing it must not create its completion file. Both the waiting-shell and exited-shell cases fail on unchanged upstream and pass with the fix.
Related issue number
No existing issue found for this timeout defect. Cancellation of an executing call is a separate defect and remains outside this fix.
Checks
Local validation on macOS / Python 3.14.7:
just testconstrained to sandbox tests, local shell tests, and sandbox code-tool tests: 169 passed.ag2/tools/sandbox/local.py; license checks andgit diff --checkpassed.referencing,jsonschema, andrespx; the full suite was not validated. The dependency-installing lint/type hook wrappers were replaced with the direct checks above. Windows was not exercised; the process-group regression is POSIX-only.AI assistance
The reproduction, implementation, regression and description were checked against the actual diff and local validation above.