fix(agent): supervise jobs and query process state safely - #268
Open
onion-hong wants to merge 1 commit into
Open
fix(agent): supervise jobs and query process state safely#268onion-hong wants to merge 1 commit into
onion-hong wants to merge 1 commit into
Conversation
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.
Querying an async job currently calls os.kill(pid, 0), which terminates the process on Windows. A vanished process is also reported as completed without checking its exit code.
Use psutil identity checks with recorded process creation time for read-only status queries and cancellation. A small supervisor persists the dispatcher exit code atomically, separately from submission metadata, so fast exits cannot be overwritten. Unknown/legacy process identities remain unknown and are not cancelled. Validate job IDs and resolved paths before accessing records; status reads no longer create directories.
Validation: 21 passed (14 lifecycle regression cases plus 7 experiment-manifest cases) on this independent branch. Tests use disposable Windows workers for success, failure, status and cancellation, plus traversal, reused PID, legacy records and access-denied cases. Agent quick suite: 36/36 passed during combined patch validation. Changed Agent files and tests pass Ruff lint/format; git diff --check passes. Repository-wide lint/format have existing findings; codespell is not installed. Linux/macOS process-tree integration remains for CI.
Based directly on current main b44ea12. No A2 experiments or training changes included.