Skip to content

test(cuda.core): retry all failed tests after confirmed sticky OOM - #3704

Open
juenglin wants to merge 4 commits into
NVIDIA:mainfrom
juenglin:test/sticky-oom-rerun-oom-failures
Open

juenglin wants to merge 4 commits into
NVIDIA:mainfrom
juenglin:test/sticky-oom-rerun-oom-failures

Conversation

@juenglin

@juenglin juenglin commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #3695 and its CodeRabbit review. Part of #3472 / NVBugs 7092346.

Retry policy

The invalid Windows driver state that produces false CUDA OOMs may also cause failures that don't look like OOMs, including before the first test that lets us confirm the state. The retry policy assumes that genuine test failures are deterministic: they will recur in a fresh process even when previously completed tests are skipped. An intermittent or order-dependent failure can therefore be masked by a successful restart. This tradeoff applies only after the sticky-OOM probe confirms the driver state; ordinary failures do not trigger a restart.

Changes

  • Retry failed tests after confirmed sticky OOM, regardless of the error they reported. Only tests that completed without a reported failure or pending rerun are written to the resume file. The triggering test is also left out, even if an in-process rerun passed. The fresh process reruns these tests and determines the result; the .failed sidecar no longer forces a failure based on the discarded attempt. Each attempt still emits its own JUnit report for diagnosis.
  • Use the exception to decide whether to probe for sticky OOM. OOM text in a source line or comment no longer makes a setup or call failure look like OOM. An exception group qualifies only if all its underlying exception messages contain the marker.
  • Preserve log-folding failures across attempts. If pytest eventually exits successfully, the wrapper still returns a log-folding failure from any attempt.

Verification

  • Subprocess regression tests simulate an earlier non-OOM failure followed by confirmed sticky OOM. The restart skips the completed test, retries both failed tests, and passes only if the earlier failure clears. A negative probe leaves the original pytest failure intact.
  • Five sticky-OOM tests, nine log-folding tests, and four shell-wrapper exit-code scenarios passed. Bash syntax and Ruff checks passed. The driver probe was simulated; this was not tested against a live Windows driver.

@copy-pr-bot

copy-pr-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module labels Dec 3, 2026
@juenglin juenglin closed this Dec 3, 2026
@juenglin
juenglin deleted the test/sticky-oom-rerun-oom-failures branch December 3, 2026 20:08
@juenglin
juenglin restored the test/sticky-oom-rerun-oom-failures branch December 3, 2026 21:58
@juenglin juenglin reopened this Dec 3, 2026
Follow-up to NVIDIA#3695, addressing the remaining CodeRabbit findings.

- A test whose call failed for a reason other than OOM and then hit an
  OOM in teardown was left unfinished so it reruns, but its real failure
  was dropped: a pass after the restart turned the run green. Such a test
  is now also listed in the .failed file.
- run_pytest_with_restarts ignored a log-folding failure in an attempt
  that exited with the sticky-OOM code. A fold failure in any attempt now
  fails the run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@juenglin
juenglin force-pushed the test/sticky-oom-rerun-oom-failures branch from 39ff0b7 to 1f353c3 Compare December 3, 2026 22:15
@juenglin juenglin changed the title test(cuda.core): rerun tests that failed with OOM before a sticky-OOM restart test(cuda.core): keep non-OOM failures across a sticky-OOM restart Dec 3, 2026
@juenglin juenglin added this to the cuda.core next milestone Dec 3, 2026
@juenglin
juenglin marked this pull request as ready for review December 3, 2026 22:17
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

Summary

Summary by CodeRabbit

  • Bug Fixes

    • Test runs now retain and report log-folding failures even if a later attempt passes.
    • Sticky-OOM restarts are limited to confirmed OOM failures, while other pytest exit codes are preserved.
    • Completion tracking now better distinguishes unfinished tests from tests that completed successfully.
  • Tests

    • Added coverage for sticky-OOM detection, restart outcomes, completed-test tracking, and grouped exception classification.

The test runner now retains log-folding failures across attempts. Test hooks classify OOM failures and track unfinished tests. The sticky-OOM helper records completed test IDs without writing failed test IDs. New tests cover restart behavior and exception-group classification.

Changes: Test failure tracking

Layer / File(s) Summary
Classify OOM failures and track completion
cuda_core/tests/helpers/sticky_oom.py, cuda_core/tests/conftest.py, cuda_core/tests/test_sticky_oom.py
The helper classifies failed reports, including exception groups, and records completed test IDs. The hooks use OOM classification when probing for a stuck driver and track unfinished nodes. Tests cover sticky-OOM restart outcomes and exception-group classification.
Preserve log-folding failures across attempts
ci/tools/run-tests
run_pytest_with_restarts remembers folding failures across attempts. If pytest passes after a non-sticky-OOM exit, it returns the remembered folding error. Otherwise, it returns pytest’s exit code.

Suggested reviewers: rwgk, andy-jost

Change: Bug fix

Merge Risk: Moderate · up to ae847

A real non-OOM test failure can be masked in CI when a sticky-OOM restart is followed by a passing rerun, which gives a false green result. The wrapper and tests need to preserve that failure before merge.

Security architecture risk: Low · up to ae847

A Windows cuda.core CI run can report success after a sticky-OOM restart even though an earlier pytest process reported a non-OOM failure. Retrying unfinished tests is useful, and the change correctly preserves log-folding errors, but a passing retry should not erase a failure the PR says it will preserve.

Retained concerns

  • Minor · reliability · inferred: The PR intends to rerun unfinished tests without losing reported non-OOM failures, but the reviewed code removes the cross-process failure record. If an earlier non-OOM failure would have been recorded at the merge base, a later sticky-OOM stop followed by a passing retry can now make the wrapper return success. Keep restart selection separate from failure status so a test can rerun without clearing the earlier failure.

View findings in the submitted review

Security review details

Security Blast Radius

  • inferred — The demonstrated impact is on the exit status of a cuda.core CI suite that enters sticky-OOM recovery. Consumers that use only the wrapper’s status can miss a failure; the wrapper still requests separate JUnit reports for each attempt.

Trust Boundaries and Controls

  • observed — The exception classifier checks exception messages rather than rendered tracebacks and requires every leaf of an exception group to match the OOM marker. The Windows driver probe remains a separate condition for requesting a sticky stop.

Dependencies

  • observed — Completion tracking uses reports delivered to pytest_runtest_logreport after pytest-rerunfailures may relabel an outcome. The hook can track failed or rerun reports it receives; it cannot preserve a report the plugin does not deliver.

Data and control flow

  • observed — The wrapper clears the suite’s completion file on entry and passes the same path to each sequential attempt. Pytest appends eligible completed node IDs and deselects those IDs on the next collection. A missing node ID does not distinguish a test that never ran from one that failed and must rerun.

Resilience and Maintainability Implications

  • observed — An earlier log-folding failure now survives a retry and is returned if pytest eventually passes. A terminal nonzero pytest status still takes precedence, and the wrapper stops after three restarts.
  • inferred — Retrying an OOM-only failure in a fresh process can legitimately end green. But after replay, the wrapper cannot distinguish that history from one with an earlier reported non-OOM failure if both end with a passing pytest result and no log-folding error.
  • observed — As at the merge base, once the sticky-stop flag is set, the session hook can translate an unrelated interruption into exit 75. The retry budget bounds automatic recovery, but exit 75 does not prove the sticky stop was the only reason the session ended.

Hardening Proposals

  • proposed — Keep a run-scoped record of reported non-OOM failures separate from completion, and have the wrapper consult it before returning success. Cover both a passing retry after a reported non-OOM failure and a passing OOM-only retry at the wrapper exit-code boundary.

Rollout and rollback

  • inferred — There is no new operator step to start recovery: pytest still requests the stop and the wrapper still owns the retry budget. The wrapper no longer treats an earlier .failed record as a reason to reject success. Until the failure record is restored, an operator who needs to verify a recovered run must check earlier attempt reports rather than rely on the final exit code alone.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Signed-off-by: Ralf Juengling <rjuengling@nvidia.com>
Signed-off-by: Ralf Juengling <rjuengling@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@juenglin

juenglin commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 3749c99

@juenglin juenglin self-assigned this Dec 3, 2026
@juenglin
juenglin requested a review from jpascucci-nv December 3, 2026 22:36
Treat non-OOM failures from a poisoned driver process as provisional. Checkpoint only completed non-failing tests and let failures that reproduce in a fresh process determine the CI result.

Signed-off-by: Ralf Juengling <rjuengling@nvidia.com>
@juenglin juenglin changed the title test(cuda.core): keep non-OOM failures across a sticky-OOM restart test(cuda.core): retry all failed tests after confirmed sticky OOM Dec 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments

Major 1
  1. important: Preserve non-OOM failures before restarting.
Minor 1
  1. The PR intends to rerun unfinished tests without losing reported non-OOM failures, but the reviewed code removes the cross-process failure record. If an earlier non-OOM failure would have been recorded at the merge base, a later sticky-OOM stop followed by a passing retry can now make the wrapper return success. Keep restart selection separate from failure status so a test can rerun without clearing the earlier failure.
Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3749c99 and ae847a3.

Files selected for processing: 4

  • ci/tools/run-tests
  • cuda_core/tests/conftest.py
  • cuda_core/tests/helpers/sticky_oom.py
  • cuda_core/tests/test_sticky_oom.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.

Comment thread cuda_core/tests/conftest.py Resolved
@juenglin

juenglin commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ae847a3

@jpascucci-nv jpascucci-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sol 6.1 high finds no actionable issues.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

This branch has not been deployed

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

Labels

CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants