Skip to content

fix(agent): supervise jobs and query process state safely - #268

Open
onion-hong wants to merge 1 commit into
Tencent:mainfrom
onion-hong:codex/fix-agent-job-lifecycle
Open

fix(agent): supervise jobs and query process state safely#268
onion-hong wants to merge 1 commit into
Tencent:mainfrom
onion-hong:codex/fix-agent-job-lifecycle

Conversation

@onion-hong

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants