Repository navigation
refactor(verification): move the verification modules into nemo_gym/verification - #5210
Conversation
|
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. |
ee91ad8 to
386f066
Compare
386f066 to
6939a78
Compare
4d1825e to
6454bf3
Compare
6454bf3 to
85c1c0e
Compare
85c1c0e to
b648504
Compare
b648504 to
5a91ded
Compare
yaoyu-33
left a comment
There was a problem hiding this comment.
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 (
ischecks). 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 JudgeErrorand 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-importskeeps the contract. No CI path filter, CODEOWNERS rule orscripts/harness_conformance/ci.pyentry named the old paths. Thefern/docs.ymlredirects 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: onlytests/unit_tests/telemetry/test_propagation.py::test_lazy_client_initialization_failure_is_inside_the_client_span[True|False]fail (ClientConnectorErrorto127.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_modelTestRefusedProviderConnection. Its fixture patchesserver_utils.get_global_aiohttp_client, which now lives innemo_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 probesfails on #5209 too.
Cross-PR notes (rooted below this PR, not blocking here)
- #5167.
from nemo_gym import judge, and attribute access such asnemo_gym.judge, go throughnemo_gym.__getattr__._SKIP_FILE_PREFIXESinnemo_gym/_moved_paths.pydoes not skipnemo_gym/__init__.py, so the DeprecationWarning is attributed tonemo_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, whilepython -c "from nemo_gym.judge import call_judge"does. mock.patch("nemo_gym.judge.X")is attributed topkgutil.pyin the same way.- This PR puts three more names on that path. The beam test used
from nemo_gym import judgebefore this PR.
- #5189.
scripts/migrate_imports.pyrewritesfrom nemo_gym.judge import call_judgeto the public formfrom nemo_gym.verification import call_judgein a.pyfile.- In a
.md/.mdxfile it rewrites the same line tofrom nemo_gym.verification.judge import call_judge. The cause:_text_import_rematches onlyMOVED_NAMESmodules, 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_verifyorsklearnlocally. CI covers those.
…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]>
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. Theverifier_utilspackage becomesverificationitself.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.
Where the package sits
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:
nemo_gym/judge.pynemo_gym/verification/judge.pynemo_gym/verifier_fixture.pynemo_gym/verification/verifier_fixture.pynemo_gym/verifier_utils/sandbox_verification.pynemo_gym/verification/sandbox_verification.pyHow to review
One commit. Its changes:
MOVED_MODULESinnemo_gym/_moved_paths.py.scripts/migrate_imports.py.verificationlayer becomes thenemo_gym.verificationpackage.fern/docs.ymlredirects the old library reference pages to the new ones.nemo_gym.verifier_utilsis recorded as a package, sonemo_gym.verifier_utils.sandbox_verificationresolves too.verifier_utils/__init__.pybecomesverification/__init__.pywith new content: the lazy public API, and a docstring that covers all three modules. Read it rather than treating it as a rename.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 outsidenemo_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 outsidenemo_gym/and its tests (servers and their tests, benchmarks, scripts, and docs) imports those names fromnemo_gym.<package>, so later moves inside a package leave it alone. Code insidenemo_gym/, and the library's tests undertests/, 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.mdstates the rule.Validation
pytest -n 16 tests/unit_tests, also with-W errorfor the moved paths. The only failures are environment-specific and unrelated to the move: this machine's hostname resolves to127.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 runon the changed files.Rollout evidence: N/A. The modules move unchanged.
Compatibility
nemo_gym.verification.*. A logging config set onnemo_gymstill 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 fromnemo_gym.python scripts/migrate_imports.py <paths>.Issue
Part of #5166.