Repository navigation
Conversation
The modal-torch-latest GPU controller (ci/torch_latest.py) runs pytest
remotely in a Modal sandbox / AWS instance and treats any nonzero pytest
exit as a candidate failure. A diff-selected (subset) run whose only
targets skip on the runner collects nothing, so pytest exits 5 ("no tests
collected") and the job fails red even though the run is a legitimate
green no-op.
Observed on run 42921207259 (merge_group for deepspeedai#8867): the selector picked
only tests/unit/v1/accelerator/test_klxpu_accelerator.py, which is
module-level skipped on NVIDIA runners, so pytest reported
"4 workers [0 items]" / "1 skipped" and the controller raised
RemoteCommandError: run pytest failed with exit code 5.
This mirrors the merged sibling fix for cpu-torch-latest-v1-multirank
(deepspeedai#9032), which maps pytest exit 5 to a green skip for subset selections.
That fix only touched the CPU workflow's shell step; the GPU controller
delegates all run/classify logic to ci/torch_latest.py, so the equivalent
guard belongs there and must cover both the Modal and AWS backends.
- Add EXIT_NO_TESTS = 5 and a shared EMPTY_SELECTION_MESSAGE.
- run_controller (Modal): a "run pytest" failure with code 5 in subset
mode returns 0 with the message instead of raising.
- run_aws_controller (AWS): same guard on test_code.
- Gate on selection_mode == "subset"; mode=all runs the whole
tests/unit/v1 scope, where an empty collection means the selector or a
collection guard broke and must still fail. Other exit codes (1, 124)
are unchanged.
- Add controller/AWS tests for the subset no-op and the mode=all guard.
AI assistance was used to analyze the failing run and draft this patch.
Signed-off-by: guhangsong <guhangsong@outlook.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43d0fa27f9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return (isinstance(error, RemoteCommandError) and error.label == "run pytest" | ||
| and error.return_code == EXIT_NO_TESTS and inputs.selection_mode == "subset") |
There was a problem hiding this comment.
Require proof of skips before accepting exit 5
When a subset-selected test_*.py accidentally stops exposing pytest items (for example, its test functions are renamed or removed), pytest returns 5 even though nothing was skipped; pytest's official exit-code contract defines 5 only as “No tests were collected.” Both this predicate and the analogous run_aws_controller branch check only that code and the mode, so the required merge-queue check turns that collection regression into success and can merge candidate code with zero selected coverage while printing a misleading skip message. Preserve the intended module-level-skip no-op, but require evidence that the no-collection result actually contained skips before returning 0.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| if primary_error is not None: | ||
| if _is_empty_pytest_selection(primary_error, inputs): | ||
| print(EMPTY_SELECTION_MESSAGE, flush=True) | ||
| return 0 |
There was a problem hiding this comment.
Document the exit-5 exception to failure guarantees
This new success path changes an explicitly documented safety guarantee: .github/workflows/TEST_SELECTION.md still states at lines 466-467 that every nonzero test status fails and at lines 509-511 that any failed pytest command fails the controller. For subset exit 5 neither statement is now true, so the operator/security documentation used to reason about this trusted controller is misleading; update the failure-mode section to spell out the narrowly allowed no-tests exception for both Modal and AWS.
Useful? React with 👍 / 👎.
The modal-torch-latest GPU controller (ci/torch_latest.py) runs pytest remotely in a Modal sandbox / AWS instance and treats any nonzero pytest exit as a candidate failure. A diff-selected (subset) run whose only targets skip on the runner collects nothing, so pytest exits 5 ("no tests collected") and the job fails red even though the run is a legitimate green no-op.
Observed on run 42921207259 (merge_group for #8867): the selector picked only tests/unit/v1/accelerator/test_klxpu_accelerator.py, which is module-level skipped on NVIDIA runners, so pytest reported "4 workers [0 items]" / "1 skipped" and the controller raised RemoteCommandError: run pytest failed with exit code 5.
This mirrors the merged sibling fix for cpu-torch-latest-v1-multirank (#9032), which maps pytest exit 5 to a green skip for subset selections. That fix only touched the CPU workflow's shell step; the GPU controller delegates all run/classify logic to ci/torch_latest.py, so the equivalent guard belongs there and must cover both the Modal and AWS backends.
AI assistance was used to analyze the failing run and draft this patch.