Skip to content

Automate Puzzletron GPU lifecycle tests - #2167

Open
j-rausch wants to merge 3 commits into
jrausch/puzzletron-gpu-quality-baseline-v4from
jrausch/puzzletron-gpu-ci-image-workflow
Open

Automate Puzzletron GPU lifecycle tests#2167
j-rausch wants to merge 3 commits into
jrausch/puzzletron-gpu-quality-baseline-v4from
jrausch/puzzletron-gpu-ci-image-workflow

Conversation

@j-rausch

@j-rausch j-rausch commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: New tests.

The existing gpu_puzzletron session proves the current Puzzletron lifecycle but is only run manually. This change adds a digest-pinned repository-owned CUDA image recipe and a dedicated copied-PR, nightly, and manual workflow that runs that focused session against the reusable tiny-Qwen lifecycle test.

The workflow accepts only immutable nvcr.io image references, verifies the checked-out image contract before allocating a GPU, and installs the checked-out ModelOpt source without resolving dependencies at runtime. The image build preinstalls the declared ModelOpt runtime and test dependencies and verifies the pinned CUDA, Torch, Transformers, LMMS-Eval, AutoModel, AIPerf, and Nox environment.

Testing

Adds CPU contract coverage for the recorded base-image digest, image-reference validation, Docker setup contract, workflow permissions and routing, and dependency-isolated runtime installation. The dedicated GPU workflow runs the existing one-GPU Puzzletron lifecycle test through nox -s gpu_puzzletron.

Additional Information

This PR is stacked on #2166. The registry image must be built and published separately, then PUZZLETRON_GPU_CI_IMAGE must be configured with its immutable digest before the workflow can run.

Summary by CodeRabbit

  • New Features

    • Added automated Puzzletron GPU testing for pull requests, scheduled runs, and manual execution.
    • Added a pinned CUDA-based CI environment with automated setup and validation.
    • Added immutable container image resolution and verification for reliable GPU test execution.
  • Bug Fixes

    • Improved environment checks to validate configured dependency and CUDA versions dynamically.
  • Documentation

    • Added instructions for building, publishing, validating, and running the GPU CI image locally.
  • Tests

    • Added coverage for image immutability, workflow configuration, dependency isolation, and GPU environment validation.

@copy-pr-bot

copy-pr-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • release/.*
  • feature/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9fc7b28e-2b26-4475-812b-50c273841932

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d8f84405-3279-4d00-902c-087e1eaf55c3

📥 Commits

Reviewing files that changed from the base of the PR and between 79eb6cd and 278e060.

📒 Files selected for processing (9)
  • .github/workflows/puzzletron_gpu_tests.yml
  • .github/workflows/unit_tests.yml
  • examples/puzzletron/ci/Dockerfile
  • examples/puzzletron/ci/README.md
  • examples/puzzletron/ci/resolve_ci_image.py
  • examples/puzzletron/ci/setup_env.sh
  • examples/puzzletron/ci_environment.json
  • noxfile.py
  • tests/unit/torch/puzzletron/test_ci_image_contract.py

📝 Walkthrough

Walkthrough

The PR adds a pinned CUDA-based Puzzletron CI image, validates its image and environment contracts, updates Nox GPU verification, and adds a gated GitHub Actions workflow for GPU lifecycle tests.

Changes

Puzzletron GPU CI

Layer / File(s) Summary
Pinned image and contract validation
examples/puzzletron/ci_environment.json, examples/puzzletron/ci/Dockerfile, examples/puzzletron/ci/resolve_ci_image.py, examples/puzzletron/ci/README.md, tests/unit/torch/puzzletron/test_ci_image_contract.py
Defines the immutable CUDA image and dependencies. The resolver validates image references and repository contracts. Documentation covers image build, execution, and publication. Tests cover resolver and image contracts.
GPU environment provisioning and verification
examples/puzzletron/ci/setup_env.sh, noxfile.py, tests/unit/torch/puzzletron/test_ci_image_contract.py
Adds pinned dependency installation, ModelOpt installation, environment checks, GPU-image-specific Nox validation, and runtime installation checks.
Gated GPU workflow execution
.github/workflows/puzzletron_gpu_tests.yml, .github/workflows/unit_tests.yml, tests/unit/torch/puzzletron/test_ci_image_contract.py
Adds pull-request, nightly, and manual workflow execution. The workflow gates file scope, resolves the immutable image, runs the GPU Nox session, and reports required-check status.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: 🔵 Low · up to 278e0

The new GPU test image currently runs its test process as root, leaving a bounded container-isolation risk that should remain explicitly owned and followed up; this is mergeable without blocking the PR.

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant PRGate
  participant ImageResolver
  participant GPUContainer
  participant RequiredCheck
  PullRequest->>PRGate: evaluate changed-file scope
  PRGate->>ImageResolver: resolve pinned CI image
  ImageResolver->>GPUContainer: provide image and digest cache key
  GPUContainer->>RequiredCheck: report GPU test result
  PRGate->>RequiredCheck: report gate result
  ImageResolver->>RequiredCheck: report image result
Loading

Possibly related PRs

Suggested reviewers: kevalmorabia97, danielkorzekwa, grzegorz-k-karch

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: automating Puzzletron GPU lifecycle tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns ✅ Passed The PR-range diff adds no prohibited load, remote-code, eval/exec, or # nosec patterns, and adds no pyproject.toml or requirements.txt dependencies.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jrausch/puzzletron-gpu-ci-image-workflow

Comment @coderabbitai help to get the list of available commands.

@j-rausch
j-rausch marked this pull request as ready for review August 12, 2026 12:11
@j-rausch
j-rausch requested review from a team as code owners August 12, 2026 12:11
@j-rausch
j-rausch requested review from danielkorzekwa, grzegorz-k-karch and kevalmorabia97 and removed request for a team August 12, 2026 12:11
@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/puzzletron_gpu_tests.yml:
- Around line 19-23: Remove secrets: inherit from the pr-gate reusable workflow
invocation in puzzletron_gpu_tests.yml. Preserve the existing permissions and
uses configuration; if pr-gate requires a secret, pass only the specific named
secret through an explicit secrets mapping.

In `@examples/puzzletron/ci/Dockerfile`:
- Around line 20-31: Create a non-root runtime user in the Dockerfile, assign
ownership of /venv and /workspace/modelopt to that user, and add the
corresponding USER instruction before WORKDIR so GPU jobs execute checked-out
code without root privileges.

In `@examples/puzzletron/ci/resolve_ci_image.py`:
- Around line 18-22: Add the module-level __all__ declaration immediately after
the imports in resolve_ci_image.py, listing resolve_image_reference and
validate_repository_contract so both functions are explicitly exposed as the
resolver module’s public API.

In `@tests/unit/torch/puzzletron/test_ci_image_contract.py`:
- Line 87: Replace yaml.load with yaml.safe_load in the workflow parsing setup,
then update the related scalar assertions to expect PyYAML’s native values,
including True for “on” and integer 50 for “timeout-minutes.”
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ab0acb2b-83ac-4994-9a09-dc95f1ef40f2

📥 Commits

Reviewing files that changed from the base of the PR and between be08d47 and 2413b50.

📒 Files selected for processing (8)
  • .github/workflows/puzzletron_gpu_tests.yml
  • examples/puzzletron/ci/Dockerfile
  • examples/puzzletron/ci/README.md
  • examples/puzzletron/ci/resolve_ci_image.py
  • examples/puzzletron/ci/setup_env.sh
  • examples/puzzletron/ci_environment.json
  • noxfile.py
  • tests/unit/torch/puzzletron/test_ci_image_contract.py

Comment thread .github/workflows/puzzletron_gpu_tests.yml Outdated
Comment thread examples/puzzletron/ci/Dockerfile
Comment thread examples/puzzletron/ci/resolve_ci_image.py
Comment thread tests/unit/torch/puzzletron/test_ci_image_contract.py Outdated
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.04%. Comparing base (ba510fc) to head (f022768).

Additional details and impacted files
@@                              Coverage Diff                               @@
##           jrausch/puzzletron-gpu-quality-baseline-v4    #2167      +/-   ##
==============================================================================
+ Coverage                                       62.09%   63.04%   +0.94%     
==============================================================================
  Files                                             709      709              
  Lines                                           91929    91929              
==============================================================================
+ Hits                                            57083    57954     +871     
+ Misses                                          34846    33975     -871     
Flag Coverage Δ
examples 30.03% <ø> (+3.14%) ⬆️
gpu 23.75% <ø> (ø)
puzzletron 31.75% <ø> (ø)
regression 8.94% <ø> (ø)
unit 29.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from c2b81f3 to 1b5940f Compare August 12, 2026 15:32
@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/puzzletron_gpu_tests.yml:
- Around line 69-71: Remove the privileged NGC_API_KEY use from the
push-triggered GPU workflow around the credentials block. Move the GPU job and
secret access into a maintainer-controlled workflow revision, and require an
explicit trusted workflow_dispatch or maintainer approval before executing
copied PR content.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 402d3d89-0192-4214-a74a-3b6b28b3c9a9

📥 Commits

Reviewing files that changed from the base of the PR and between de15733 and 1b5940f.

📒 Files selected for processing (8)
  • .github/workflows/puzzletron_gpu_tests.yml
  • examples/puzzletron/ci/Dockerfile
  • examples/puzzletron/ci/README.md
  • examples/puzzletron/ci/resolve_ci_image.py
  • examples/puzzletron/ci/setup_env.sh
  • examples/puzzletron/ci_environment.json
  • noxfile.py
  • tests/unit/torch/puzzletron/test_ci_image_contract.py

Comment thread .github/workflows/puzzletron_gpu_tests.yml Outdated
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 1b5940f to 3274cb6 Compare August 12, 2026 16:32
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 3274cb6 to 278e060 Compare August 12, 2026 21:51
@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 278e060 to 20988e6 Compare August 12, 2026 23:03
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 20988e6 to 5fdeeb2 Compare August 13, 2026 01:00
Pin the execution image and dependency contract so the focused lifecycle workflow runs against a reproducible one-GPU environment.

Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
Require the immutable execution image to support anonymous pulls so copied pull-request branches never receive registry credentials.

Signed-off-by: Johannes Rausch <jrausch@nvidia.com>
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 5fdeeb2 to f022768 Compare August 13, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant