Repository navigation
feat(environment): make a manifest's name its ID instead of its folder path - #6102
yuhezhang-ai wants to merge 4 commits into
Conversation
cf8a82b to
6f9371a
Compare
9fb7a5b to
8f35ca2
Compare
|
/ok to test 8f35ca2 |
8f35ca2 to
8771a7a
Compare
|
/ok to test 8771a7a |
8771a7a to
191e4f6
Compare
|
/ok to test 191e4f6 |
e4748ea to
5e0e09c
Compare
|
/ok to test 5e0e09c |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
Three RISK findings affect catalog/selector agreement and manifest validation. One NOTE covers a lost typo hint. The RISK findings should be addressed or accepted deliberately before merging.
I inspected all 12 changed files and their directly affected discovery, CLI, validation, scaffold, and compatibility paths. This was a static review; I didn't execute tests or independently verify the reported test results.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| f"Manifest identity name '{manifest.name}' does not match its catalog path '{catalog_name}'." | ||
| ) | ||
|
|
||
| catalog_kind = catalog_directory.name if catalog_directory is not None else None |
There was a problem hiding this comment.
RISK — Retain the catalog's named-directory requirement
Removing the name/path comparison also lets explicit validation accept an ordinary ID directly at the catalog-tree root. Starting with the existing _asset(tmp_path) fixture, move its manifest to environments/manifest.yaml, set config_path: demo/config.yaml, and retain name: demo. The kind check passes, uniqueness excludes the manifest itself, and the path-collision check sees its own config, so validate_environment() can succeed. However, catalog discovery rejects that same manifest because it isn't inside a named catalog directory. A successful validation therefore leaves a tree that makes gym list fail.
Could _validate_manifest_location() preserve this location constraint without restoring name-equals-folder? Immediately after assigning catalog_directory, add:
if catalog_directory is not None and manifest_path.parent == catalog_directory:
raise EnvironmentValidationError(
f"Manifest '{manifest_path}' must be inside a named catalog directory."
)A manifest accepted inside a catalog tree should meet discovery's location requirement. Preserve moved and nested manifests whose IDs differ from their folders, standalone manifests outside both trees, and the existing kind check.
Acceptance — proposed tests, not executed: The root-level fixture above must raise EnvironmentValidationError mentioning a named catalog directory. Retain name == 'renamed' for the moved-ID case, name == 'acme/demo' for the nested case, and rejection of a kind/tree mismatch in the validation tests. Inspect that catalog_directory is None bypasses the new guard. Verify the suggested code before adopting it.
There was a problem hiding this comment.
Confirmed and fixed in cc60385. A manifest moved to environments/manifest.yaml with config_path: demo/config.yaml validated. _validate_manifest_location() now raises "must be inside a named catalog directory" for a manifest directly in its catalog tree, the same message discovery gives. When catalog_directory is None the check is skipped, so standalone manifests are not affected. Test: test_environment_validation.py::test_a_manifest_at_the_root_of_a_catalog_tree_is_refused, which fails on the previous commit. The renamed, nested and kind-mismatch tests still pass.
| if not tree.is_dir(): | ||
| continue | ||
| config_names.update(manifest.name for _, manifest in declared_manifests(tree)) | ||
| config_names.update( |
There was a problem hiding this comment.
NOTE — Suggestion: retain environment-flavor typo hints
The common hint branch loses a diagnostic for a selector that still works. With environments/demo/config.yaml and environments/demo/fast.yaml, --environment demo/fast resolves, but --environment demo/fats no longer suggests fast: _legacy_config_paths(..., 'environment') contributes only demo. The base implementation searched the sibling YAML flavors for this case. This affects error recovery, not successful launches.
Could the hint set also include those environment flavor aliases, without adding them to the catalog? A small addition inside the root loop is:
if flag == "environment":
config_names.update(
f"{server_name}/{candidate.stem}"
for candidate in (tree / server_name).glob("*.yaml")
if candidate.name != "manifest.yaml"
)Preserve declared-ID hints across roots, bare folder aliases, nested benchmark hints, and the separate agent/model/resources-server hint behavior.
Acceptance — proposed test, not executed: Isolate one root with the two configs above. Assert that demo/fast resolves to fast.yaml and that demo/fats raises ValueError containing Did you mean \demo/fast`?`. Retain the simple/nested declared-ID and folder-alias assertions in the new hint tests. Verify the suggested addition before adopting it.
There was a problem hiding this comment.
Confirmed and fixed in cc60385 as you suggested. For --environment, the hint set now also includes <folder>/<flavor> for each YAML file in the folder typed, except manifest.yaml. These names are not added to the catalog. Test: test_assets.py::test_typo_suggestions_include_environment_flavors checks that demo/fast selects fast.yaml and that demo/fats suggests demo/fast. On the previous commit it suggested demo.
5e0e09c to
cc60385
Compare
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no remaining in-scope concerns found.
I verified all four prior findings against the current source and regression assertions:
- Shadowed manifests still claim their resolved configs, preventing accidental legacy aliases.
- Selectors distinguish catalog entries from compatibility paths. The flavor, nested-benchmark, hidden-folder, and Harbor-boundary counterexamples are addressed while fallback aliases remain supported.
- Validation rejects manifests directly at a catalog-tree root, while retaining renamed and nested IDs, standalone manifests, and the kind/tree check.
- Environment-flavor typo coverage asserts that
demo/fastselects successfully anddemo/fatssuggestsdemo/fast, alongside the existing declared-ID and folder-alias hints.
This was a static follow-up review of the earlier failures, identifiable fixes, and directly affected catalog, selector, validation, and CLI paths. I inspected tests but didn't execute them. The previously reviewed tree wasn't available, so I couldn't independently compare the complete inter-review delta. No new regression meeting the follow-up introduction and impact-escalation requirements was established.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
d865ae7 to
c21f074
Compare
|
/ok to test c21f074 |
c21f074 to
4907561
Compare
|
/ok to test 4907561 |
4907561 to
64e4c0c
Compare
64e4c0c to
f85cee6
Compare
|
/ok to test f85cee6 |
f85cee6 to
e35f078
Compare
|
/ok to test e35f078 |
e35f078 to
d293664
Compare
|
/ok to test 950dc5a |
|
/ok to test 2345083 |
2345083 to
0712855
Compare
|
/ok to test 0712855 |
|
/ok to test 83a8645 |
83a8645 to
c30c1f4
Compare
…r path A manifest's name no longer has to match its folder under benchmarks/ or environments/, so a folder can move without changing the ID that `gym list`, --benchmark and --environment use. - Catalog discovery reads each manifest once, takes its name as the ID, and refuses two manifests in one tree that declare the same name. A manifest directly in benchmarks/ or environments/ is still refused. A manifest that an earlier search root shadows by name still claims its config, so the config is not listed again under its folder path. - --benchmark and --environment select what the catalog lists under a name: in the first search root that has it, the manifest of that name, or else a config the catalog lists under that name that no manifest claims. Another config at that path is selected only when no root lists the name. Each tree's names are read once per process; a selection re-reads the one manifest its answer came from and reads the tree again when that answer no longer holds. - Validation refuses a name another manifest in the tree declares, a config another manifest declares, and a name other than the manifest's folder path that is another config's path, which it would hide. - `gym env init` refuses a name that a manifest in another folder declares. - Typo suggestions include declared names. This replaces the 13 commits of the earlier head (2345083), rebuilt on the #6098 head without setups and protocols; the parts about setup and protocol names are dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yuhe Zhang <[email protected]>
…nd environments/ A manifest's name is meant to be the one ID that the catalog, the hub and run records share, and benchmarks and environments are planned to be listed together later. The catalog keys entries by kind and name, so until now a benchmark manifest and an environment manifest in one search root could declare the same name. No two manifests in the repository do, so tightening the rule now forces no renames. - Discovery shares one name table between a search root's benchmarks/ and environments/ trees, so the same manifest name in both raises RegistryError naming both files, as a duplicate within one tree does. - Validation checks a manifest's name against the manifests of both trees of its root. - `gym env init --benchmark/--environment` refuses a name that a manifest in either tree declares. A config without a manifest keeps its folder path as its name, so a folder of the same name may still exist in both trees, as labbench2_pdf does. Across search roots, shadowing stays by kind and name. Ignoring the kind there would also need --benchmark and --environment to read the other kind's trees and to decide what a shadowed name falls back to. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yuhe Zhang <[email protected]>
…'s own lookup --benchmark and --environment had their own, simpler copy of the catalog's rules, and a review found four cases where they picked a different config than `gym list` shows. This splits catalog discovery into two steps and has the selectors use the first one: 1. Listing (`_list_catalog`): which config each name selects, with all of discovery's rules: an earlier search root wins, a shadowed manifest still claims its config, and no two manifests in a root declare one name. 2. Details: the description and domain of each config without a manifest, which builds the whole config with its includes and is most of `gym list`'s time. Only `gym list` needs it. A selection reads only what its flag and name can select: configs without a manifest of that kind, and resources-server configs only for a `resources_servers/...` name. It keeps the listing for the rest of the process, rechecks the one file an answer came from, and reads the listing again on a miss. The selector's per-tree name table is removed. Fixed, each with a test that fails before this commit: - A name that two manifests in one root declare (in one tree or across benchmarks/ and environments/) now fails to select with the catalog's error, instead of selecting the first folder in sorted order. So does a manifest the catalog refuses (wrong kind, missing config). - A loose `benchmarks/<name>.yaml` and a resources server's runnable config, both listed by the catalog, now win over a later root's manifest of that name. Validation refuses renaming a manifest to a loose benchmark config's name, which would hide that config. - When no root lists a name, a nested `<name>/config.yaml` in any root wins over a flavor file again, as before names were IDs. Signed-off-by: Yuhe Zhang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… list A copied folder that keeps its manifest's name made the catalog's first step raise, so every --benchmark and --environment selection from that search root failed until the copy was renamed. Now the first step records each name that the root supplying it cannot list (two manifests of that root declare it, or the catalog refuses its manifest) and goes on: - --benchmark/--environment <that name> fails with the catalog's error, naming both files; - other names still select; - `gym list` still fails, with the first problem, as before. Checking the folder at the name's path first and stopping there would be faster, but after a move it would silently run a copy placed at the old folder, so the lookup still reads every manifest. Signed-off-by: Yuhe Zhang <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
c30c1f4 to
23b77aa
Compare
Stacked on #6098. This PR's base is that PR's branch, so the diff shows only this change. It will be rebased onto
mainonce #6098 merges.Status: deferred
This PR stays a draft unless we decide that an ID should not depend on the folder path. Nothing needs it now:
namemust equal its folder path inside its tree (nemo_gym/environment/registry.py), and that folder needn't hold the config:benchmarks/swebench/verified/opencode/manifest.yamlpoints at../opencode.yaml. So renaming an entry only moves its manifest to another folder, and the configs stay put. Moving a whole tree, to another repository or frombenchmarks/totasksets/, keeps every ID.<catalog ID>[:<label>], for exampleswebench/verifiedorswebench/verified:hermes, so it needs no ID that differs from the path.swebench:verified), this PR is what allows it. The cost is that an ID no longer shows which folder it is in, and--benchmarkhas to read every manifest to find a name (about 0.5 s more per launch).What changed and why
A manifest's
namehad to equal its folder path underbenchmarks/orenvironments/. Moving a folder within its tree, for example frombenchmarks/gsm/tobenchmarks/math/gsm/, would therefore change its ID and break every record that refers to it.A name is now an ID, and it no longer has to match a path.
#6098 no longer lists setups and protocols in a main manifest (see the review), so this PR no longer makes their names IDs. It covers main manifests only.
Catalog (
nemo_gym/environment/registry.py)nameinstead of by folder path.benchmarks/orenvironments/. Discovery raisesRegistryErrornaming both files, as it already does for other broken manifests. A config without a manifest keeps its folder path as its name, so a folder of the same name may still exist in both trees._list_catalog, finds the config each name selects and applies every rule above. The second reads the description and domain of each config without a manifest, which builds the whole config with every file it includes and is most ofgym list's time (about 3.4 of 4.5 s here).discover_environment_catalog()runs both.--benchmarkand--environmentrun only the first (see Selectors).declared_manifests(tree_dir), the readable manifests of one tree, and the private_manifest_config(manifest_path, manifest), the config a manifest declares (none when its path leaves the tree).Validation (
nemo_gym/environment/validation.py)benchmarks/orenvironments/, rather than in a folder of its own, is refused, as discovery refuses it.benchmarks/orenvironments/tree declares the name.config.yamlinbenchmarks/demo/and../demo/config.yamlinbenchmarks/copy/are one config. A config with two IDs would be listed twice.--benchmarkand--environment. That includes a loose benchmark configbenchmarks/<name>.yaml, which the catalog lists under its file name; a new private helper,registry._legacy_config_name, tells whether the catalog lists such a config, reading only that file.config_pathpassed tovalidate_environmentdoes not change it.Selectors (
nemo_gym/environment/assets.py,registry.py)--benchmarkand--environmentrun the catalog's first step and select what it lists under the name, so they pick whatgym listshows by construction, and a moved benchmark still runs by its ID. They don't read descriptions. They read every manifest of the search roots (the unique-name rule needs them), the configs without a manifest of their own kind only, and the resources servers' runnable configs only for aresources_servers/...name.RegistryErrornaming both files. So does a manifest the catalog refuses: wrong kind, missing config, or directly in the tree. Only that name fails: other names from the same root still select, andgym liststill fails with the first problem, as before. Before, the selector took the first folder in sorted order, or returned the missing path.benchmarks/<name>.yamland a resources server's runnable config (resources_servers/<server>), both of which the catalog lists, now select. An earlier root's one wins over a later root's manifest of that name, as in the catalog.<name>/config.yamlin any root, then a flavor file<folder>/<flavor>.yaml. Examples:suite/fast.yaml);suite/v1/config.yaml, listed assuite/v1/config);--benchmark /path/to/folder).--environment, it also suggests the flavor files in the typed folder.gym --helpdoesn't pay for them.Scaffold (
nemo_gym/environment/scaffold.py)gym env init --benchmark/--environment <name>refuses a name that a manifest in another folder of the root'sbenchmarks/orenvironments/tree already declares. This stops it from creating a duplicate ID after a move. Running it again for the same folder still works.Docs:
contribute/environments/new-environment.mdxgets a "Names" section and an updatednamerow, both saying that a name is unique across the two trees of a search root.reference/configuration.mdxnow says that--benchmarkand--environmentfind a name the waygym listdoes, gives the path fallback's order, and points to--config <path>for a particular file.Other:
tests/unit_tests/benchmarks/test_indic_frontier_math.pypasses the loaded manifest to_manifest_entry, which now takes it instead of loading it again.tests/unit_tests/fixtures/import_surface.jsondrops the removed private helper_path_identityfrom thenemo_gym.registryentry, becausetest_moved_paths.pyasks for each name that is removed on purpose.Issue
Refs #1520 (manifest work under the custom-environment epic).
Internal tracking: GYMINT-738 (standardize environment manifests). It is not needed for GYMINT-741 (separate environments repository): moving whole trees keeps every ID (see Status).
Supersedes #2622, which is no longer being worked on. Its exclusion of
manifest.yamlfrom benchmark discovery is already onmain. Its other goal, reporting a broken manifest without failing the whole catalog, is not part of this PR.Compatibility
benchmarks/andenvironments/trees of its search root, so a benchmark manifest and an environment manifest can no longer share a name. The name is meant to be the one ID that the catalog and run records share, and benchmarks and environments are planned to be listed together, so tightening the rule later would force renames. No two manifests collide today. Three folders exist in both trees:biomnibench_daandether0, each with a benchmark manifest and an environment folder without one, andlabbench2_pdf, with no manifest in either. Their environment versions will need other names when they get manifests. Configs without a manifest keep today's behavior.--benchmarkand--environmentwould then also have to read the other kind's trees and decide what a shadowed name falls back to. Today the path fallback would still run the shadowed config, so listing and launching would disagree. That is left for a separate decision.--benchmarkand--environmentfollow the catalog: an earlier root's config at a name's path no longer wins over a later root's entry of that name when the catalog lists that config under another name or not at all, as for an environment's flavor file. Such a config is still selected by its path when no root lists the name, in the order before this PR, and--config <path>selects any file.--benchmarkand--environmentnow fail wheregym listfails for their kind, with the same error naming the file: a name that two manifests in one root declare, or a manifest of that kind with the wrong kind or a missing config. Only that name fails to select; other names still select. Before, onlygym listfailed, and the selector picked one of the two configs or a missing path. No manifest in the repository has either problem.--benchmark <name>selects a loosebenchmarks/<name>.yaml, and--benchmark/--environment resources_servers/<server>select the config the catalog lists under that name. Both failed with "does not exist" before.--resources-server <server>is unchanged._path_identityis removed. Its one check, that a manifest sits inside a named folder rather than at the tree root, moved into_manifest_entry.Validation
dda3e35fd1, which adds the review fixes to the selection fields; both commits applied cleanly and are unchanged apart from context lines. Before that, rebuilt on6440d07090, which drops setups and protocols. The 13 commits of the earlier head (2345083b37) are now one commit without the parts about setup and protocol names: listed names as IDs, a shadowed manifest hiding its listed configs, one config per ID within a manifest, theconfigs/folder recommendation for listed configs, and their tests. A test that a main manifest whose name is another config's path still selects what the catalog lists replaces the setup version of that test, and a test that two manifests can't share a config replaces the one for a listed config.pytest tests/unit_tests/environment tests/unit_tests/cli tests/unit_tests/benchmarks/test_indic_frontier_math.py tests/unit_tests/test_moved_paths.py tests/unit_tests/test_public_api.py tests/unit_tests/tooling/test_review_policy.py -n 8at the current head: 1,720 passed; 1 failed, the memory-profiler CLI test, which fails the same way locally on feat(environment): add selection fields to environment manifests #6098's head.f0476baa5c), with tests that each fail at the pushed head83a8645868(run there with the new test files):benchmarks/demo.yamlwins over a later root's manifestdemo;--benchmark resources_servers/demoover a later root's manifest of that name;suite/fast/config.yamlwins over an earlier root'ssuite/fast.yaml;--environmentdoesn't scan benchmark configs, and neither scans resources servers for an ordinary name;benchmarks/<name>.yaml.c30c1f46a6): with two manifests declaring one name, selecting that name fails naming both files, another name from the same root still selects, andgym liststill fails. Checking the folder at the name's path first would be faster, but after a move it would run a copy left at the old folder, so the lookup still reads every manifest.a2171580b6(the pushed head's two commits on feat(environment): add selection fields to environment manifests #6098'sdda3e35fd1),discover_environment_catalog()returns the same 545 entries (242 with manifests), and--benchmark/--environmentselect the same config for all 359 benchmark and environment names. All 186resources_servers/...names now select the config the catalog lists.--benchmark aime25: 0.70 s (pushed head 0.23 s).--environment example_single_tool_call: 0.24 s (0.03 s).--environment resources_servers/aalcr: 0.62 s (failed before).gym list's catalog: 4.45 s, unchanged.gym --help: 0.05 s; the catalog modules aren't imported.test_every_listed_token_round_trips_through_the_benchmark_selector: 18.6 s under-n 8(12.5 s at the pushed head, 9.0 s on feat(environment): add selection fields to environment manifests #6098's head). Of its 302 tokens, 12 are old path names that the catalog doesn't list, such asindic/aime_2026/config. Each reads the listing again (about 0.7 s), because a miss can be a name a manifest added during the process declares.gym env init --environment samplerefuses the name of an existing benchmark manifest. Two more tests pin what stays: across search roots, a benchmark manifest and an environment manifest of one name are both listed; and the cross-kind resolution test now pairs an environment manifest with a benchmark config without a manifest, since two manifests can no longer share the name. The catalog and all 359 selections are the same as at the commit before it.pre-commit runon the changed files: passed.validate_environmentcall reads every manifest in both trees of its root for the ID checks: here 235 benchmark manifests (about 210 ms) and 7 environment manifests (about 10 ms).tests/unit_tests/environment/test_assets.py), with two search roots: listing and selection agree for a moved entry in the earlier root; a folder claimed under another name doesn't shadow that name; an old folder path still selects when no entry has that name; a shadowed manifest's folder doesn't take a name a later root declares; an earlier root's flavor file, nested benchmark config, or manifest below a Harbor dataset or hidden folder doesn't shadow a later root's declared name; an absolute folder selects its config; the hint suggests simple and nested declared IDs and keeps the folder-path hints;--environment demo/fatssuggestsdemo/fast.gym env start --benchmark <name>finds a moved manifest by its name.gym env initrefuses the moved manifest's name, and rerunning it in place still works.pre-commit runon the changed files: passed (ruff, ruff-format, guardwords, import-linter).Rollout evidence
N/A: this changes how manifests are named, found and validated. No server, agent or verifier behavior changes, and every existing name resolves to the same config.
🤖 Generated with Claude Code