Skip to content

feat(orchestration): record the installed Gym commit in the submission record - #3529

Merged
iguehring-nvidia merged 4 commits into
mainfrom
iguehring/submission-record-gym-commit
Sep 21, 2026
Merged

iguehring-nvidia merged 4 commits into
mainfrom
iguehring/submission-record-gym-commit

Conversation

@iguehring-nvidia

@iguehring-nvidia iguehring-nvidia commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

gym-job.json records gym_version, which repeats across every commit between two version bumps. A reader that needs to reinstall the exact Gym that wrote a record — to recompose the submission's config with gym eval submit --resolve-only (#3524) and compare it against what it expects — cannot pin that from the version alone.

This adds SubmissionRecord.gym_commit: the commit of the nemo-gym that wrote the record.

  • A git install (pip install git+…@<sha>) records the commit in the distribution's PEP 610 direct_url.json as vcs_info.commit_id; that is used when present.
  • Otherwise the checkout the running nemo_gym package is tracked in is asked directly (git ls-files --error-unmatch on the package, then rev-parse HEAD / status --porcelain): its HEAD when clean, <HEAD>-dirty when it has uncommitted changes. This does not depend on install metadata at all, so an editable install whose venv lacks nemo-gym dist-info (uv can produce that) and a plain source tree on sys.path both work.
  • A package no checkout tracks — a wheel in site-packages, even when the venv sits inside a clone — yields None; so does a missing git. Every None is logged with its reason. An index wheel needs no commit anyway: a published version is immutable, so gym_version already identifies it.

Added with a default, as jobs.py's compatibility rule requires of a same-version change: records written before this still load under schema_version: 1. jobs.py stays executor-agnostic (no new imports from executors/).

Consumer: NVIDIA's eval-factory certification layer (Evergreen) pins the Gym it recomposes with from this field instead of from its own toolchain pin.

Validation

.venv/bin/python -m pytest tests/unit_tests/test_orchestration_jobs.py tests/unit_tests/test_slurm_executor.py tests/unit_tests/test_cli_eval_submit.py
# 62 passed
pre-commit run --files nemo_gym/orchestration/jobs.py nemo_gym/orchestration/executors/slurm.py tests/unit_tests/test_orchestration_jobs.py
# all hooks pass

Against real installs: in a venv created with pip install "nemo-gym @ git+https://github.com/NVIDIA-NeMo/gym.git@c41584d1…", direct_url.json reads {"vcs_info": {"commit_id": "c41584d1…"}} and the helper returns it; in this editable checkout with local edits it returns <HEAD>-dirty, and the same source tree on PYTHONPATH in a venv with no nemo-gym dist-info (where distribution("nemo-gym") raises PackageNotFoundError) returns the same.

End to end on a Slurm cluster: pip install "nemo-gym @ git+…gym.git@4636cd35…" into a fresh venv, gym eval submit a real config (job cancelled right after enqueue), gym-job.json reads "gym_commit": "4636cd35d33675551bfb6e3ba91295a1b03874fe".

Install scenarios exercised for real against this branch's head (29bf4f61), beyond the unit tests:

How nemo-gym is running direct_url.json gym_commit
pip install "nemo-gym @ git+…@29bf4f61" into a fresh venv on a Slurm login node, real gym eval submit (job cancelled at enqueue) vcs_info.commit_id 29bf4f61…
uv pip install -e <clean clone> dir_info.editable 29bf4f61…
same editable venv, checkout with an uncommitted edit dir_info.editable 29bf4f61…-dirty
clean clone on PYTHONPATH, no nemo-gym dist-info at all (distribution() raises) — 29bf4f61…
same, checkout dirty — 29bf4f61…-dirty
wheel built from the clone, installed into a .venv inside the clone archive_info None (not tracked in a checkout)
clone on PYTHONPATH, git not on PATH — None (git is not available)

Rollouts

N/A — orchestration metadata only; no environment or agent code.

Compatibility and benchmark impact

Additive, defaulted field on gym-job.json; no schema version bump needed and older records load unchanged. No benchmark-result effect.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification — the field is documented in SubmissionRecord's docstring, where the other fields are.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header — no new files.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

🤖 Generated with Claude Code

@iguehring-nvidia iguehring-nvidia added feature New capabilities, enhancements, or enablement work area:orchestration Job submission, deployment, services, and lifecycle management labels Sep 18, 2026
@iguehring-nvidia iguehring-nvidia self-assigned this Sep 18, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team September 18, 2026 13:18
@yaoyu-33 yaoyu-33 added complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer labels Sep 18, 2026
@iguehring-nvidia
iguehring-nvidia force-pushed the iguehring/submission-record-gym-commit branch from 6096c35 to f23842f Compare September 20, 2026 15:38
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team and anwithk September 20, 2026 15:38
…n record

`gym-job.json` carries `gym_version`, which repeats across every commit
between two version bumps. A reader that must reinstall the exact Gym
that wrote a record -- to recompose its config with `--resolve-only` and
compare, as an external certifier does -- cannot pin it from that.

Add `gym_commit`: the commit of the running nemo-gym, read from the
distribution's PEP 610 direct_url.json for a git install, asked of the
checkout for an editable install, None for an index wheel. Added with a
default, so records written before it still load under schema version 1.

Signed-off-by: Ingo Guehring <[email protected]>
Comment thread nemo_gym/orchestration/jobs.py Resolved
…mmit, marked when dirty

A developer submitting from `pip install -e .` had `gym_commit: null`.
Ask the checkout instead: its HEAD when clean, `<HEAD>-dirty` when it
has uncommitted changes, so a clean checkout is reproducible and a dirty
one is comparable without reading as a pin. git missing or the directory
not being a repository still yield None, logged.

Signed-off-by: Ingo Guehring <[email protected]>
…eckout, not from install metadata

An editable install in a uv venv can lack distribution metadata for
nemo-gym, so `distribution("nemo-gym")` raised PackageNotFoundError and
the commit went unrecorded. Metadata is now consulted only for the
commit a git install records; otherwise the checkout the running
nemo_gym package is tracked in is asked directly, which covers editable
installs and plain source trees on sys.path alike. A package that no
checkout tracks (a wheel in site-packages, even inside a clone) still
yields None.

Signed-off-by: Ingo Guehring <[email protected]>
@iguehring-nvidia
iguehring-nvidia added this pull request to the merge queue Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35600633590

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 21, 2026
@iguehring-nvidia
iguehring-nvidia added this pull request to the merge queue Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35604727122

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 21, 2026
@iguehring-nvidia

Copy link
Copy Markdown
Contributor Author

Merge-queue ejections are not from this PR: main fails test_every_repo_benchmark_appears_in_listing since #3535 (reproduced on main alone). Fix in #3564; will re-queue once that lands.

@iguehring-nvidia
iguehring-nvidia added this pull request to the merge queue Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35615079789

Merged via the queue into main with commit 247ca85 Sep 21, 2026
41 checks passed
@iguehring-nvidia
iguehring-nvidia deleted the iguehring/submission-record-gym-commit branch September 21, 2026 15:05
reinainblood pushed a commit to reinainblood/Gym that referenced this pull request Sep 21, 2026
…NeMo#3564)

## What does this PR do?

Unbreaks `main` after NVIDIA-NeMo#3535. Its 75 new `benchmarks/*/manifest.yaml`
files each mirror their benchmark's `type: benchmark` dataset, so
`_benchmark_config_paths`'s content-based prefilter
(`_is_benchmark_config`) takes every manifest for a second config of the
same benchmark. Manifests don't resolve as configs, so the listing drops
them and
`tests/unit_tests/test_benchmarks.py::TestDiscoverBenchmarksInDir::test_every_repo_benchmark_appears_in_listing`
fails on `main`:

```
AssertionError: 218 benchmark config(s) discovered but only 143 appear in the listing
```

`NVIDIA-NeMo#3535`'s own merge-queue run passed because it was queued against the
previous base; the first PR queued after it (NVIDIA-NeMo#3529) has been ejected
twice with "failed status checks". Reproduced locally: fails on `main`
(`9164de0e`), passes on its parent (`2581db97`).

Fix: `_is_benchmark_config` rejects a `manifest.yaml` by name before
looking at content, so the predicate states the whole definition of a
benchmark config and every caller of the discovery inherits it.
`nemo_gym/registry.py` already filtered the manifest out of the legacy
benchmark listing for the same reason; that filter is now redundant and
removed, and `MANIFEST_FILENAME` moves to `benchmarks.py` so both
modules read one definition (registry imports benchmarks, not the other
way round).

## Validation

```
python -m pytest tests/unit_tests/test_benchmarks.py tests/unit_tests/test_registry.py \
  tests/unit_tests/test_environment_publication.py tests/unit_tests/test_environment_onboarding.py \
  tests/unit_tests/test_environment_manifest.py
# all pass, including test_every_repo_benchmark_appears_in_listing (218 == 218)
pre-commit run --files nemo_gym/benchmarks.py nemo_gym/registry.py tests/unit_tests/test_benchmarks.py
```

New test `test_prefilter_rejects_the_benchmarks_manifest`: a
`config.yaml` and a `manifest.yaml` declaring the same dataset → the
prefilter rejects the manifest and only the config is discovered.

## Rollouts

N/A — discovery only.

## Compatibility and benchmark impact

None to configs or scoring. `gym list benchmarks` output is unchanged
from before NVIDIA-NeMo#3535; the catalog (`registry.py`) reads manifests through
its own path as before.

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/NVIDIA-NeMo/Gym/blob/main/CONTRIBUTING.md).
- [x] The change is focused; unrelated "drive-by" edits are tracked as
separate issues/PRs.
- [x] Tests added or updated and pass locally, or N/A for docs-only /
non-code changes (so CI unit/server checks pass when applicable).
- [x] Documentation added or updated, or N/A with justification —
docstring of `_benchmark_config_paths` explains the exclusion.
- [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so
CI lint/format checks pass).
- [x] New source files include the required Apache-2.0 SPDX header — no
new files.
- [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check
passes).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Ingo Guehring <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 29bf4f61 Deployed Sep 21, 2026 by copy-pr-bot[bot] via release / finalize / notify #3336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:orchestration Job submission, deployment, services, and lifecycle management complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants