Repository navigation
Conversation
The Harbor Python verifier helpers move from nemo_gym/verifiers/ to nemo_gym/verification/python_verifier/, beside the other helpers for verifying submissions. nemo_gym/verifiers/ is removed, and the verification package is no longer split across two top-level names. The helpers still import nothing from nemo_gym and keep to Python 3.8, because the shim copies them into the verifier sandbox. The shim now vendors them at .ng/nemo_gym/verification/python_verifier/, with empty parent __init__.py files. The old path keeps working until 0.10.0. On the host it has a MOVED_MODULES entry. In the sandbox, the shim also writes an alias package at .ng/nemo_gym/verifiers/ that serves the same modules and prints where they moved. The shim writes the alias only while the MOVED_MODULES entry exists, so both go away together. Signed-off-by: Ananth Subramaniam <[email protected]>
35 of 41 tasks
svcnvidia-nemo-ci
left a comment
Contributor
There was a problem hiding this comment.
SHIP — LGTM — no concerns found.
I reviewed all 19 changed files and traced the affected host imports, sandbox vendoring, Harbor uploads, publishing, and regression tests. I found no material correctness or compatibility regression.
This was a static review. I didn't execute tests or build the documentation.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Contributor
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Moves the Harbor Python verifier helpers from
nemo_gym/verifiers/intonemo_gym/verification/python_verifier/, and removesnemo_gym/verifiers/.Before this PR, the helpers for verifying submissions lived under two top-level names:
verification/held the helpers that resources servers use, such as LLM judges.verifiers/held the helpers that a Harbor task'sverifier.pyimports, plus the runner that callsverifyinside the sandbox.The two names were one word apart, so it wasn't clear which one to use. Now both sets of helpers live in
verification/.Where this PR sits
This is a follow-up to the package reorganization (#5166), after the stack and #5536.
What moves
nemo_gym/verifiers/__init__.pynemo_gym/verification/python_verifier/__init__.pynemo_gym/verifiers/files.pynemo_gym/verification/python_verifier/files.pynemo_gym/verifiers/runner.pynemo_gym/verification/python_verifier/runner.pyThe modules move unchanged, apart from docstrings that name their own path. Verifier code now imports from the new path:
Why a subpackage
The helpers could sit flat in
verification/. They get their own folder because they follow different rules from the rest of the package: they run in the sandbox, use only the standard library, and keep to Python 3.8, whilejudge.py,verifier_fixture.pyandsandbox_verification.pyrun on the host and import the rest of Gym..pyfile inpython_verifier/. Flat modules would need a hard-coded list of the files allowed into the sandbox, and a new helper missing from the list would fail only inside the sandbox.__init__.py, so a verifier writesfrom nemo_gym.verification.python_verifier import exact_match. Importing them fromnemo_gym.verificationinstead would need that package's lazy public API, which depends onnemo_gym._public_apiand serves the host modules. The sandbox would then need a second, hand-writtenverification/__init__.py.How the helpers reach the sandbox
The helpers run inside the verifier sandbox, under whatever Python 3.8 or newer the task image has. Nothing else from
nemo_gymis available there. The shim copies the helpers into the.ng/folder that it uploads over/tests:.ng/nemo_gym/verification/python_verifier/.__init__.pyfiles fornemo_gymandnemo_gym.verification. The sandbox then never runs the realnemo_gym.verificationpackage, whose__init__.pydepends on the rest ofnemo_gym.verificationlayer. That layer allows imports of lower layers, but the sandbox has none of them, so a new test fails if a vendored module imports anything outside the standard library and its own package.Compatibility
nemo_gym.verifierswas onmainbefore the reorganization, so it gets an old path like the other moved modules. It keeps working until 0.10.0.MOVED_MODULESentry servesnemo_gym.verifiers,nemo_gym.verifiers.filesandnemo_gym.verifiers.runnerfrom the new modules, with aDeprecationWarning..ng/nemo_gym/verifiers/__init__.py, an alias that registers the vendored modules under their old names. It prints one line to stderr (the verifier log) saying where the helpers moved and when the old path is removed.MOVED_MODULESentry exists. The test that fails once the version reaches 0.10.0 with the entry still present therefore removes both together.gym dataset publish --harborcarries its own copy of the old package intests/.ng/, so it keeps grading under Harbor without changes.fern/docs.ymlredirects the old library reference pages to the new ones.How to review
One commit. Its changes:
scripts/migrate_imports.pyupdated the in-repo imports, docs, and thehello_verifier_reuseexamples. I reverted its changes to the two example lines that name an old path on purpose (nemo_gym.server_utilsinAGENTS.mdand the API reference).nemo_gym/data/tasks/harbor/python_verifier.py): the new vendoring path, the empty parent__init__.pyfiles, and the alias.AGENTS.md, the API reference, and the Harbor tasks page say where the helpers live and that they import nothing fromnemo_gym. The Harbor tasks page also notes the old path.nemo_gymin the task'stests/folder now plants it at the new path.MOVED_MODULESentry is gone; and that the vendored modules and the alias import only the standard library.verifiersis no longer exempt from the layer coverage test.Validation
pytest -n 16 tests/unit_tests.pytest environment_servers/harbor/tests.lint-imports.pre-commit runon the changed files.python:3.8-slimcontainer, I ran the shim'stest.shfor two verifiers. One washello_verifier_reuse/exact-greeting, which imports from the new path. The other was the same check written againstnemo_gym.verifiers. Both returned a reward of 1.0. The second also printed the deprecation line naming the new path and 0.10.0.Rollout evidence: N/A. No agent or model behavior changes. The only change at run time is where the shim puts the helpers inside the verifier sandbox, which the container check above exercises.
Issue
Follow-up to #5166.