Skip to content

refactor(verification): move the verification modules into nemo_gym/verification - #5210

Merged
ananthsub merged 1 commit into
mainfrom
ananthsub/layout-verification
Oct 30, 2026
Merged

ananthsub merged 1 commit into
mainfrom
ananthsub/layout-verification

Conversation

@ananthsub

@ananthsub ananthsub commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Moves the verification helpers that resources servers share into a new nemo_gym/verification/ package: the LLM judge, verifier fixtures, and sandboxed verification. The verifier_utils package becomes verification itself.

Where this PR sits

The stack lands bottom-up; each PR's base is the branch of the PR before it, so each diff shows only that PR's change.

flowchart LR
  compat["#5167<br/>Old import paths<br/>keep working"]
  linter["#5168<br/>import-linter<br/>layer contract"]
  prep["#5169<br/>Remove path and<br/>name couplings"]
  config["#5189<br/>Move config/"]
  utils["#5195<br/>Move utils/"]
  core["#5203<br/>Move core/"]
  client["#5206<br/>Move client/,<br/>start telemetry/"]
  trajectory["#5209<br/>Move trajectory/"]
  verification["#5210<br/>Move verification/"]
  metrics["#5211<br/>Move metrics/"]
  artifacts["#5212<br/>Move artifacts/"]
  srmods["#5214<br/>Move server_runtime/<br/>modules"]
  su["#5215<br/>Split server_utils"]
  model["#5224<br/>Move models/<br/>modules"]
  modelbase["#5225<br/>Split model<br/>call capture"]
  agents["#5228<br/>Move agents/"]
  data["#5229<br/>Move data/"]
  harbor["#5230<br/>Split the<br/>Harbor task CLI"]
  rollouts["#5231<br/>Move rollouts/"]
  rsplit["#5232<br/>Split the<br/>rollout collector"]
  testing["#5233<br/>Dissolve testing/"]
  orch["#5234<br/>Move orchestration/<br/>modules"]
  sup["#5235<br/>Split the<br/>server supervisor"]
  eval["#5244<br/>Move eval/"]
  env["#5298<br/>Move environment/<br/>registries"]
  cli["#5300<br/>Retire the<br/>cli_setup_command shim"]
  docs["#5385<br/>Describe the<br/>package layout"]
  owners["next<br/>CODEOWNERS:<br/>per-package groups"]
  remove["0.10.0<br/>Remove the<br/>old paths"]
  compat --> linter
  linter --> prep
  prep --> config
  config --> utils
  utils --> core
  core --> client
  client --> trajectory
  trajectory --> verification
  verification --> metrics
  metrics --> artifacts
  artifacts --> srmods
  srmods --> su
  su --> model
  model --> modelbase
  modelbase --> agents
  agents --> data
  data --> harbor
  harbor --> rollouts
  rollouts --> rsplit
  rsplit --> testing
  testing --> orch
  orch --> sup
  sup --> eval
  eval --> env
  env --> cli
  cli --> docs
  docs --> owners
  owners --> remove
  classDef this fill:#fde68a,stroke:#b45309,stroke-width:2px,color:#1f2937
  classDef later fill:#f3f4f6,stroke:#9ca3af,color:#4b5563,stroke-dasharray: 4 3
  class verification this
  class owners,remove later
Loading

Where the package sits

flowchart TD
  cli["cli/"]
  eval["eval/"]
  environment["environment/"]
  testing["testing/"]
  orchestration["orchestration/"]
  rollouts["rollouts/"]
  data["data/"]
  agents["agents/"]
  model["models/"]
  server_runtime["server_runtime/"]
  artifacts["artifacts/"]
  metrics["metrics/"]
  verification["verification/"]
  trajectory["trajectory/"]
  sandbox["sandbox/"]
  client["client/"]
  telemetry["telemetry/"]
  core["core/"]
  utils["utils/"]
  config["config/"]
  cli --> eval
  cli --> environment
  cli --> orchestration
  eval --> rollouts
  environment --> data
  testing --> rollouts
  orchestration --> data
  rollouts --> data
  rollouts --> agents
  rollouts --> model
  data --> server_runtime
  data --> artifacts
  agents --> server_runtime
  model --> server_runtime
  server_runtime --> metrics
  server_runtime --> verification
  server_runtime --> trajectory
  artifacts --> trajectory
  artifacts --> utils
  metrics --> utils
  verification --> sandbox
  trajectory --> core
  sandbox --> client
  client --> telemetry
  client --> utils
  telemetry --> core
  core --> config
  utils --> config
  classDef this fill:#fde68a,stroke:#b45309,stroke-width:2px,color:#1f2937
  classDef done fill:#d1fae5,stroke:#047857,color:#1f2937
  classDef todo fill:#f3f4f6,stroke:#9ca3af,color:#4b5563
  class verification this
  class config,utils,core,telemetry,client,trajectory done
  class cli,eval,environment,testing,orchestration,rollouts,data,agents,model,server_runtime,artifacts,metrics,sandbox todo
Loading

An arrow means "imports"; each package imports only packages below it. Yellow: created by this PR. Green: created by an earlier PR in the stack. Grey: still to come.

What moves

Whole modules, unchanged:

Old path New path
nemo_gym/judge.py nemo_gym/verification/judge.py
nemo_gym/verifier_fixture.py nemo_gym/verification/verifier_fixture.py
nemo_gym/verifier_utils/sandbox_verification.py nemo_gym/verification/sandbox_verification.py

How to review

One commit. Its changes:

  1. Renames, with no content changes.
  2. Everything else:
    • The moves are recorded in MOVED_MODULES in nemo_gym/_moved_paths.py.
    • In-repo references are rewritten by scripts/migrate_imports.py.
    • The contract's verification layer becomes the nemo_gym.verification package.
    • fern/docs.yml redirects the old library reference pages to the new ones.
    • nemo_gym.verifier_utils is recorded as a package, so nemo_gym.verifier_utils.sandbox_verification resolves too.
    • verifier_utils/__init__.py becomes verification/__init__.py with new content: the lazy public API, and a docstring that covers all three modules. Read it rather than treating it as a rename.
  3. Tests: the judge, verifier fixture, and sandbox verification tests move into tests/unit_tests/verification/.

Public API

Every layout package that exists after this PR has a lazy public API in its __init__.py: the names non-test code outside nemo_gym/ imports from it (servers, benchmarks, scripts, and code samples in docs and skills), each served from the submodule that defines it on first use. Code outside nemo_gym/ and its tests (servers and their tests, benchmarks, scripts, and docs) imports those names from nemo_gym.<package>, so later moves inside a package leave it alone. Code inside nemo_gym/, and the library's tests under tests/, import from the module that defines each name, so the import-linter contract sees every dependency and a test reads what it patches. A patch target names the module the code under test looks the name up in. AGENTS.md states the rule.

Validation

  • pytest -n 16 tests/unit_tests, also with -W error for the moved paths. The only failures are environment-specific and unrelated to the move: this machine's hostname resolves to 127.0.1.1, which the sandbox host check refuses (the Harbor run summary tests and the benchmark listing test), and two Docker PTY tests.
  • lint-imports.
  • pre-commit run on the changed files.
  • Server and agent tests run in CI.

Rollout evidence: N/A. The modules move unchanged.

Compatibility

  • Old paths work until 0.10.0, with one warning each, and give the same module objects.
  • Logger names follow the module path, so these modules now log under nemo_gym.verification.*. A logging config set on nemo_gym still covers them.
  • nemo_gym.verifiers, the standard-library-only package that in-sandbox Python verifiers import, stays where it is: task authors import it by that name, and it imports nothing else from nemo_gym.
  • Open branches: run python scripts/migrate_imports.py <paths>.

Issue

Part of #5166.

@ananthsub
ananthsub added this pull request to stack #5170 October 28, 2026 18:48
@copy-pr-bot

copy-pr-bot Bot commented Oct 28, 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.

@ananthsub ananthsub added the feature New capabilities, enhancements, or enablement work label Oct 28, 2026
@ananthsub
ananthsub requested a review from yaoyu-33 October 28, 2026 18:50
@ananthsub ananthsub changed the title ananthsub/layout verification refactor(verification): move the verification modules into nemo_gym/verification Oct 28, 2026
@ananthsub ananthsub added area:core Shared APIs, servers, telemetry, health, and registries needs-review PR is ready for code review and waiting on a reviewer labels Oct 28, 2026
@ananthsub
ananthsub marked this pull request as ready for review October 28, 2026 18:50
@ananthsub
ananthsub requested review from a team as code owners October 28, 2026 18:50
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 28, 2026 18:50
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

@ananthsub
ananthsub force-pushed the ananthsub/layout-verification branch from 4d1825e to 6454bf3 Compare October 28, 2026 21:23
@ananthsub
ananthsub force-pushed the ananthsub/layout-verification branch from 6454bf3 to 85c1c0e Compare October 28, 2026 21:56
@ananthsub
ananthsub force-pushed the ananthsub/layout-verification branch from 85c1c0e to b648504 Compare October 28, 2026 23:10
@ananthsub
ananthsub force-pushed the ananthsub/layout-verification branch from b648504 to 5a91ded Compare October 29, 2026 00:54

@yaoyu-33 yaoyu-33 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.

Verdict: SHIP. No blockers or risks. There is one docstring note inline.

This PR moves judge.py, verifier_fixture.py and verifier_utils/sandbox_verification.py into nemo_gym/verification/ and rewrites about 100 imports. What we checked for verifier correctness:

  • The three modules are pure renames: the same git blob before and after. None of them depends on its own location (__file__, relative imports, package-relative paths).
  • Every rewritten import in servers, tests, docs and the scaffold templates binds the same object as before (is checks). Apart from imports, the servers changed only docstrings and one README line. No reward can change, so "Rollout evidence: N/A" holds.
  • The old paths (nemo_gym.judge, nemo_gym.verifier_fixture, nemo_gym.verifier_utils, nemo_gym.verifier_utils.sandbox_verification) return the same module objects, with one warning each. except JudgeError and pickles that name an old path keep working.
  • No script uploaded into a sandbox imports these modules, so unlike the harness runner in #5189 no old-path fallback is needed.
  • lint-imports keeps the contract. No CI path filter, CODEOWNERS rule or scripts/harness_conformance/ci.py entry named the old paths. The fern/docs.yml redirects cover both the unversioned and the /:version/ URLs.

PR description. The "Whole modules, unchanged" table lists nemo_gym/verifier_utils/__init__.py → nemo_gym/verification/__init__.py. The new __init__.py has new content (the lazy public API), and git pairs the old file with tests/unit_tests/verification/__init__.py (R073). Could you move that row out of the "unchanged" table, so reviewers know to read the new __init__.py?

CI. None of the red jobs on this head comes from this PR:

  • Unit tests / Test: only tests/unit_tests/telemetry/test_propagation.py::test_lazy_client_initialization_failure_is_inside_the_client_span[True|False] fail (ClientConnectorError to 127.0.0.1:80). They fail on #5206 and #5209 too, and pass on #5203.
  • Unit tests / Server suite (shard 3): responses_api_models/openai_model TestRefusedProviderConnection. Its fixture patches server_utils.get_global_aiohttp_client, which now lives in nemo_gym/client/http_client.py. The same tests fail on #5206 and #5209, and shard 3 passes on #5203. Both failures therefore come from #5206.
  • Harness conformance (non-blocking) / kilocode conformance probes fails on #5209 too.
Cross-PR notes (rooted below this PR, not blocking here)
  • #5167.
    • from nemo_gym import judge, and attribute access such as nemo_gym.judge, go through nemo_gym.__getattr__.
    • _SKIP_FILE_PREFIXES in nemo_gym/_moved_paths.py does not skip nemo_gym/__init__.py, so the DeprecationWarning is attributed to nemo_gym/__init__.py:247, not to the caller.
    • Under Python's default filters, the user then sees nothing: python -c "from nemo_gym import verifier_fixture" prints no warning, while python -c "from nemo_gym.judge import call_judge" does.
    • mock.patch("nemo_gym.judge.X") is attributed to pkgutil.py in the same way.
    • This PR puts three more names on that path. The beam test used from nemo_gym import judge before this PR.
  • #5189.
    • scripts/migrate_imports.py rewrites from nemo_gym.judge import call_judge to the public form from nemo_gym.verification import call_judge in a .py file.
    • In a .md/.mdx file it rewrites the same line to from nemo_gym.verification.judge import call_judge. The cause: _text_import_re matches only MOVED_NAMES modules, so docs text skips the public-API rewrite for whole-module moves.
    • This PR's own docs edits are already in the public form. The gap affects downstream docs and open branches.
  • #5206. The two CI failures above.

Validation for this review (head 480db26dc10e, macOS, no GPU):

  • pytest tests/unit_tests -n 8: every failure but a few timing tests also fails on the base (#5209) tree, for missing optional dependencies, Docker, or this host's unresolvable hostname. The timing tests pass when rerun.
  • The same suite with old-path DeprecationWarnings turned into errors: none raised.
  • Server tests with the same filter, about 1,350 passed: partner_if, genrm_compare, beam, single_agent_turn, frontierscience_judge, equivalence_llm_judge, gdp_pdf, verifif, xstest, aalcr, aegis_v4_safety, proof_jury_judge, multichallenge, competitive_coding_challenges, and code_gen sandbox execution. The remaining failures are host-only and also fail on the base.
  • lint-imports (import-linter 2.15): contract kept.
  • Not verified here: GPU, real sandboxes, and servers that need ray, math_verify or sklearn locally. CI covers those.

Comment thread nemo_gym/verification/__init__.py Resolved
yaoyu-33
yaoyu-33 previously approved these changes Oct 30, 2026

@yaoyu-33 yaoyu-33 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.

Approving at 480db26. The verification modules move unchanged, the old paths resolve to the same modules, and the red CI on this head comes from #5206. The docstring suggestion is optional.

…erification

the verifier_utils package becomes nemo_gym/verification, and judge.py
and verifier_fixture.py move into it.

Record the three moves in MOVED_MODULES (verifier_utils as a package, so
its submodules resolve too), rewrite in-repo references with
scripts/migrate_imports.py, make the contract's verification layer the
nemo_gym.verification package, and redirect the old library reference
pages in fern/docs.yml.

Regenerate the public API of each layout package that exists here from
what non-test code outside nemo_gym imports, and point code outside
nemo_gym, tests included, at nemo_gym.<package>.

Signed-off-by: Ananth Subramaniam <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 4b420d4c Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Shared APIs, servers, telemetry, health, and registries feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants