Repository navigation
Conversation
A swap or copy merged its source as written, so a source that was itself
derived (a -> b -> c) kept an unresolved `_inherit_from` whenever the swap
reached the destination after the source, and a moved source whose own
swap ran later was put back under its old name. The Harbor route hits
this: `harbor_<taskset>_agent` inherits the selected flavor
(`nooa_agent/nooa_sandboxed` defines `agent: {_inherit_from: nooa_agent}`),
so the taskset agent was dropped and its environment server reported
"references responses_api_agents/'harbor_<taskset>_agent', which is not
defined".
Resolve each source, on a copy, with its own `_inherit_from`, `_copy` and
`_delete_key` applied before merging it, and skip keys an earlier move
removed. A source that leads back to itself raises
InheritPathNotFoundError naming the cycle instead of recursing forever.
Single-level inheritance, MISSING propagation and the agent/resources
rename bookkeeping are unchanged.
Signed-off-by: Elad Sarafian <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ived `--reuse-verifier` refused a bundled environment server declared with `_inherit_from` or `_copy` because configuration resolved inheritance against the configs as written. Chained sources now resolve link by link, so the workload can inherit such a server; the test resolves a scaffolded workload whose reused server inherits a base server. Signed-off-by: Elad Sarafian <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
/ok to test 400e180 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found four RISK issues: detached interpolation resolution, nested moves within a source, reference repair across complete chains, and scaffold name collisions with derivation ancestors.
I inspected all six changed files and their directly affected configuration, Harbor, and scaffold paths. This was a static review; I couldn't execute tests with the available tools. The acceptance checks below are proposed tests, not reported results.
Inline comments (escaped v1):
-
nemo_gym/config/global_config.pyline 1572: RISK — Don't resolve ordinary interpolations against the temporary holderFailure: Could source resolution retain the global interpolation context? Consider:
config = DictConfig({ "model": "m", "source": {"items": ["${model}"]}, "target": {"_copy": "source"}, }) GlobalConfigDictParser()._recursively_swap_keys(config)
The new traversal places
sourceunder a root containing onlyvalue, then indexes its list elements. That evaluates${model}where the root has nomodel, producing an interpolation error instead of a target whose first item resolves to"m". The base implementation didn't perform this detached traversal. This affects ordinary single-level copies and inheritance, not just chains.Correction: In
_resolved_swap_sourceand the list branch of_recursively_swap_keys_helper, either preserve the original interpolation context or traverse unresolved nodes while detached. The invariant is that resolving Gym directives must not evaluate an ordinary interpolation against the synthetic holder root. The exact patch needs to account for interpolated container aliases and relative references, so I haven't supplied an unverified replacement.Preservation and proposed acceptance checks: Exercise this example in both key orders with
_copy,_inherit_from, and their string forms. The target item must resolve to"m"; retainsourceonly for copies. Also test a literal dictionary inside the list containing both a nested copy directive and a relative reference, such as{"local": "m", "selected": "${.local}", "copied": "${copy:model}"}: both selected and copied values must resolve to"m". Keep the missing-list assertions, chain/delete behavior, and cycle diagnostics. These outcomes are source-derived, not executed. -
nemo_gym/config/global_config.pyline 1528: RISK — Apply nested moves to the source being resolved, not only the live global treeFailure: Resolving a source on a copy still sends every nested move through
original_dict_config. A minimal case is:config = DictConfig({ "source": {"x": 1, "y": "${inherit_from:source.x}"}, "target": {"_inherit_from": "source"}, }) GlobalConfigDictParser()._recursively_swap_keys(config)
The outer move removes
sourcebefore resolving it. When the detached source reachesy, resolving its live parent pathsourceraisesInheritPathNotFoundError. Expected:{"target": {"y": 1}}.With
_copy: sourceinstead, the live parent remains, but the nested move removesxonly from that live parent. The detached source retainsx, so the target incorrectly contains bothxandy. This contradicts the existing nested-move behavior, whose expected result removes the original leaf. The new eager source traversal exposes this mismatch between the detached value and the live mutation target.Correction: Change the working-context contract between
_resolved_swap_sourceand_recursively_swap_keys_helper: a nested move must remove its source from the working source subtree, even after that subtree's live ancestor has been consumed. Track external consumed paths separately where needed to preserve top-level move semantics. Merely tolerating an absent live parent would avoid the exception but still leave the moved key in the target. The exact implementation needs this context distinction, so a one-line patch would be incomplete.Preservation and proposed acceptance checks: Test the example in both key orders, using both move and copy targets. Moves must leave only
target: {y: 1}; copies must leave bothsourceandtarget, each exactly{y: 1}. Repeat with a property-form nested move of a mapping. Retain the existing chain assertions: a copied intermediate survives, consumed bases don't return, overrides merge, and each link's_delete_keyapplies. These checks weren't executed. -
nemo_gym/config/global_config.pyline 1351: RISK — Follow consumed intermediate names before filtering rename destinationsFailure: Could reference repair follow the complete newly resolved chain? Add
"mcqa_simple_agent"toreferencedin the new Harbor-shaped test. Resolution removes bothmcqa_simple_agentandflavor_agent, leavingtaskset_agent, but this comprehension discards the base agent's destination becauseflavor_agentno longer survives. Its environment server still namesmcqa_simple_agent: strict mode raisesAgentWithoutEnvironmentServerError; otherwise server-reference validation rejects the stale reference. Expected: the unique surviving agent remains behind the original environment server.The resources path has the same gap. Starting with the resources-binding fixture, add
middle_resources: {_inherit_from: resources}andfinal_resources: {_inherit_from: middle_resources}. Onlyfinal_resourcessurvives, but resource retargeting discards the consumed intermediate and leaves the environment namingresources.This one-hop bookkeeping predates the PR; it's a remaining integration gap in the newly supported chained-source behavior. The new resolver reliably consumes intermediates, but its reference consumer still assumes a single edge.
Correction and preservation: In
_recursively_swap_keys, collect all top-level move edges, including intermediate definitions without an explicit server-type block. Follow consumed destinations to surviving endpoints, deduplicate those endpoints, then apply the agent/resources type and ambiguity checks. A surviving intermediate is an endpoint;_copyisn't a rename edge. Both retargeting paths need this calculation. Preserve surviving originals, explicit references to another surviving instance, ignored non-server endpoints, and ambiguity errors for multiple valid endpoints. The coordinated graph change isn't an unambiguous small patch.Proposed acceptance checks: Extend the Harbor test to reference the base agent and retain its single
taskset_agentmapping in both orders. Add the resources chain in both orders and expectresources_server.name == "final_resources", while the agent's null resources binding stays null. A branch with two surviving endpoints must raise the corresponding ambiguity error. Keep the existing copy and explicit-target assertions: copies must not redirect the original's environment, and explicit surviving targets must remain unchanged. These checks weren't executed. -
nemo_gym/environment/scaffold.pyline 989: RISK — Reserve derivation ancestors when choosing scaffold instance namesFailure: The removed guard now permits a reused server whose ancestor collides with the generated workload name, but _composition's collision set contains only the selected resources, agent, and environment instances.
A minimal regression is the new derived-server test, with both occurrences of
base_environment_serverrenamed toreused_environment_server. The scaffold still choosesreused_environment_serveras its destination and generates inheritance fromshared_environment_server. Merging then creates:reused_environment_server: _inherit_from: shared_environment_server shared_environment_server: _inherit_from: reused_environment_server
Scaffolding writes the files, but resolving the workload raises a cycle error. Expected: choose the free
reused_catalog_environment_servername, as the existing direct-collision behavior does, or reject before writing if neither name is free.Correction: Carry the occupied instance names of the reused configuration, including its derivation ancestors, into
_ReusedVerifierand use that set in_compositioninstead of only the three selected instances. Include ancestors supplied by included configs when collecting that namespace. Keep the existing fallback and final collision rejection. The exact loading change needs to preserve the current component-root/include handling, so I haven't supplied a partial patch limited to same-file ancestors.Preservation and proposed acceptance checks: Add the renamed-ancestor variant above; assert that the generated server is
reused_catalog_environment_server, resolution succeeds, and the only mapping isreused_agent -> [reused_catalog_environment_server], withentrypoint == "app.py". Cover an ancestor supplied throughconfig_pathstoo. If both candidate destination names are occupied, expectScaffoldErrorbefore an asset directory is written. Retain the existing direct-collision assertions, ordinary derived reuse, independent workloads sharing a scorer, and rejection when a route names the server being retired. These checks weren't executed.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| f"`_inherit_from` / `_copy` sources form a cycle: {' -> '.join((*resolving, source))}. " | ||
| "Point one of them at a config that does not derive from the others." | ||
| ) | ||
| holder = OmegaConf.create({"value": deepcopy(value)}) |
There was a problem hiding this comment.
[P2] Preserve global interpolation context when resolving sources
Resolving the source under a detached {"value": ...} holder breaks ordinary list references to global settings. For example:
policy_model_name: example-model
base:
aliases: ["${policy_model_name}"]
derived:
_copy: baseThis resolves successfully on the base commit, but now raises InterpolationKeyError at value.aliases[0]: the existing list traversal evaluates v[i] against the holder, where policy_model_name is absent. _inherit_from has the same problem, including through full configuration parsing.
Please preserve the original interpolation context or defer ordinary list interpolation during this pass, and add this regression case.
|
Could you refresh the remaining notes that describe inheritance as limited to one level? For example, the BrowseComp config says a second level “does NOT chain” and cites the TODO removed here; the HLE Diamond README gives the same limitation. Rewording these as historical explanations would preserve the rationale for the current configurations while avoiding outdated guidance. |
What does this PR do?
Resolves chained
_inherit_fromand_copysources. Before this change,_recursively_swap_keys_helpermerged each source as written (nemo_gym/config/global_config.py, the former TODO "We may want to recurse again after swap"). When the source itself inherits from another config, its own_inherit_fromwas copied into the target unresolved, and a key that an earlier swap had moved could be added back.This breaks
gym eval run <harbor task folder> --agent nooa_agent/nooa_sandboxed. The Harbor route generatesharbor_<taskset>_agent: {_inherit_from: agent}(nemo_gym/data/tasks/harbor/materialize.py), andnooa_sandboxed.yamldefinesagent: {_inherit_from: nooa_agent}. Resolution then fails with:The fix resolves each swap or copy source on a copy, with its own
_inherit_from,_copyand_delete_keyapplied, before merging it. The result no longer depends on which key the pass reaches first. A source that leads back to itself raisesInheritPathNotFoundErrorand names the cycle. A key that an earlier swap in the same pass moved away is skipped.The second commit removes the
--reuse-verifierscaffold check that refused an environment server derived with_inherit_fromor_copy(nemo_gym/environment/scaffold.py). That check existed only because of this limitation.Issue: none filed; found while running the sandboxed NOOA agent on local Harbor task folders.
Validation
On Linux x86_64, Python 3.13.14, uv 0.13.7:
pytest tests/unit_tests/config: 311 passed, including 24 new cases. The new cases cover chains in the property,${inherit_from:...}and_copyforms and in both key orders,_delete_key,???sources, five cycle forms, and the Harbor-shaped case where an environment server names the derived agent. All 24 fail on main.aiohttpimport errors in scripts run by path and fail the same way on unmodified main.pre-commit run --files <touched files>: clean.gym eval run <harbor folder> --agent nooa_agent/nooa_sandboxed --only-tasks <task>, with server start stubbed out, gives the error above on main. On this branch it gives one agent,harbor_<taskset>_agent, withexecution_mode: sandboxedandsandbox_runner_timeout_seconds: 21600inherited.Rollouts
N/A for this PR: it changes config resolution only, checked without model calls. With this fix and the related NOOA agent fixes, we ran sandboxed NOOA rollouts on Harbor task folders with the docker sandbox.
Compatibility and benchmark impact
_inherit_from/_copysources used to be left partly unresolved; it now raises an error that names the cycle.--reuse-verifiernow accepts an environment server that is itself derived.Checklist
pre-commit run --files <touched files>).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code