refactor(evaluator)!: rename env_overrides to hydra_params, add env_vars - #1314
Merged
Conversation
SandyChapman
marked this pull request as ready for review
August 14, 2026 13:49
Base automatically changed from
aalgo-485-gym-error-legibility/schapman
to
main
August 17, 2026 13:25
`env_overrides` read as "environment variables" to everyone who met it. It is
not: the "env" is Gym's *environment* (the resources-server), and the values
become Hydra config overrides — `{'a': {'b': 1}}` flattens to `++a.b=1`. The
name is now `hydra_params`, which says what it does.
That frees `env` to mean what people assumed, and the gap it leaves is real.
Some Gym environments are configurable only through the OS environment:
`wmt_translation` reads `WMT_TRANSLATION_COMET_PY_CACHE` for its model-cache
root and otherwise defaults to `/opt/Gym/.cache/comet-python`, a path that
exists only inside NVIDIA's container image, so on any other machine it fails
with `PermissionError: /opt/Gym` before the GPU requirement is even reached.
Until now the only way to set that was to export it before invoking the
runner, which makes a property of the *environment* into a property of
whoever happened to launch the run — and a job spec executed elsewhere has no
ambient environment to inherit from at all. The new `env_vars` field carries
it in the config instead.
Precedence is this process's environment, then the Ray uv-hook default, then
`env_vars`. Explicit config wins over both, including over the Ray setting:
that default exists to make Gym work rather than as an invariant, and someone
debugging that hook needs a way to put it back. `_gym_invocation_env` exists
so this is assertable without starting Ray.
`env_vars` is redacted in `RunnerInfo.config` on the same rules as
`hydra_params`, and needs it more: an environment variable is the conventional
way to hand a process an API key, so a caller doing the obvious thing would
otherwise write one into the run bundle. Verified the existing markers catch
`OPENAI_API_KEY`, `HF_TOKEN`, `AWS_SECRET_ACCESS_KEY` and `DB_PASSWORD` while
leaving `WMT_TRANSLATION_COMET_PY_CACHE` and `HTTPS_PROXY` verbatim.
BREAKING CHANGE: `env_overrides` is renamed to `hydra_params` on both
`GymRuntimeConfig` and the Gym runner-target job spec, so it changes the REST
contract in plugins/nemo-evaluator/openapi/openapi.yaml. The field landed in
main one day ago (#1257) and has no known callers.
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
Rebased onto main after #1295 split `gym_runtime.py` into the `gym/` package.
Re-applied on the new layout rather than resolving a delete/modify conflict
against a file that no longer exists. One placement changed as a result:
`_gym_invocation_env` now lives in `gym/process.py` rather than beside the
runner. The environment a CLI is invoked with is part of how it is run, which
is what that module is for, and it keeps the runtime module orchestration-only.
It is `process.py`'s first dependency on `config.py`, which stays acyclic.
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
SandyChapman
force-pushed
the
aalgo-485-gym-config-naming/schapman
branch
from
August 17, 2026 13:34
43b6e9e to
bc6bb6e
Compare
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later. Comment |
Contributor
|
JashG
approved these changes
Aug 17, 2026
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.
Summary
env_overridesreads as "environment variables" to everyone who meets it, and it isn't — the "env" is Gym's environment (the resources-server), and the values become Hydra config overrides ({'a': {'b': 1}}→++a.b=1). Renamed tohydra_params, which says what it does.That frees the name for the thing people assumed it was. Some Gym environments are configurable only through the OS environment:
wmt_translationreadsWMT_TRANSLATION_COMET_PY_CACHEfor its model-cache root and otherwise defaults to/opt/Gym/.cache/comet-python, a path that exists only inside NVIDIA's container image — so anywhere else it dies withPermissionError: /opt/Gymbefore the GPU requirement is even reached. Until now the only way to set that was to export it before invoking the runner, which turns a property of the environment into a property of whoever launched the run. A job spec executed elsewhere has no ambient environment to inherit from at all. Newenv_varsfield carries it in the config instead.Related Issue
Tracked in Linear as AALGO-485. No GitHub issue.
Stacked on #1295 — both change the same regions of
gym_runtime.py, so basing onmainwould guarantee a conflict. Review #1295 first; once it merges, this diff collapses to just this commit.Changes
env_overrides→hydra_paramsonGymRuntimeConfigand the Gym runner-target job spec, plus_redact_env_overrides→_redact_hydra_params(leaving the old name on the helper would defeat the point). Descriptions now say explicitly that the two fields are different things.env_vars: dict[str, str]on both, merged into the environment thegymCLI is invoked with._gym_invocation_env(config)extracted so the precedence is assertable without starting Ray: process environment →RAY_ENABLE_UV_RUN_RUNTIME_ENV=0→env_vars.env_varsredacted inRunnerInfo.configon the same rules ashydra_params.make refresh-openapi, verified idempotent.Design calls
env_varsoutranks the Ray default. That setting exists to make Gym work, not as an invariant; someone debugging Ray's uv hook needs a way to restore it. Explicit config beats a built-in default.hydra_params' markers rather than a new list. Verified against real names:OPENAI_API_KEY,HF_TOKEN,AWS_SECRET_ACCESS_KEYandDB_PASSWORDall redact;WMT_TRANSLATION_COMET_PY_CACHEandHTTPS_PROXYstay verbatim.env_varsneeds this more thanhydra_paramsdoes — an environment variable is the conventional way to hand a process an API key, so a caller doing the obvious thing would otherwise write one into the run bundle.mainone day ago (feat(evaluator): add GymRunnerTarget plugin wiring and Studio rendering #1257), nothing inweb/references it, and it is absent from the generated Python SDK. Adoption is as close to zero as it will ever be; an alias now would be permanent cost for a day-old field.env_overridesinservices/rlandservices/core/auth. Different concepts that happen to share a name — and the auth one is genuinelyMapping[str, str]of OS environment variables, which is its own small argument that the old name misleads.Type of Change
Quality Gates
Field(description=...), which is what surfaces in the OpenAPI spec and is regenerated here.examples/gym/README.mdis updated for the rename. No Fern page documents the Gym runner target.Verification
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowTargeted validation:
pytest packages/nemo_evaluator_sdk/tests -qpytest plugins/nemo-evaluator/tests --ignore=…/integration -quv run ruff checkuv run ruff format --checktools/lint/lint-python-types.shmake refresh-openapimake vendorRun on Python 3.12, matching
make toolchain-versions. See the note below on why that matters.On
make update-sdk— run, and deliberately revertedI ran it. The Stainless half succeeded but produced nothing for this change, and I reverted what it did produce:
openapi/openapi.yaml— the spec Stainless consumes — is unchanged by this work, and contains zero references to the Gym runner target (hydra_params,env_overrides,resources_server). That target lives only inplugins/nemo-evaluator/openapi/openapi.yaml, which is not Stainless's input. The generated Python SDK never exposed these fields, so renaming them cannot affect it.make refresh-openapialone was the whole job.access_keys.py, its types__init__, and its tests — the committed SDK no longer matches what Stainless generates from the current spec. The regeneratedlist()drops thepage/page_sizedocstring params and rewrites the query transform, which looks like a regression rather than cosmetic drift. Reverted here; it deserves its own investigation rather than riding along invisibly in a rename.make update-web-sdkfailed outright:tsx: command not found,node_modulesmissing, because this worktree has never runpnpm installinweb/. Not run, since per the above there was nothing of this change to generate. Worth knowing thatmake update-sdkpiped throughtailreports exit 0 even when this step fails.Blocked checks (host toolchain, not this change)
uv-lockpyproject.toml/uv.lock;uv-lock-check, which catches real drift, passesstudio-lint-stagedmise ERROR No version is set for shim: pnpmweb/filesHelm DocsUnrelated finding, filed separately
test_harbor_runtime.py::test_symlink_loop_degrades_the_stamp_instead_of_killing_the_runfails on Python 3.13 and passes on 3.12. Its premise assertsPath.resolve()raisesRuntimeErrorfor a symlink loop, which is 3.12 behaviour; on 3.13 it raises nothing. It surfaced because a fresh worktree's venv resolved 3.13.12 —requires-python = ">=3.12,<3.15"permits it even thoughmake toolchain-versionsreports 3.12. Nothing to do with this change, but it means the package claims support for a version at least one test does not hold on.