feat(cli): add 'gym env validate' pre-flight config check (#1205 friction #12)#1599
Merged
Conversation
wprazuch
added a commit
that referenced
this pull request
Jun 16, 2026
Supersedes #1510; covers epic #1205 friction #8 + #12 and issues #1488, #1489, #1490 in one place: - #1488: missing config_paths entry -> ConfigPathNotFoundError (names entry + searched locations). - #1490: malformed (non-list) config_paths -> MalformedConfigPathsError with the expected Hydra list syntax. - #1489: zero configured servers -> NoServerInstancesError, raised in RunHelper.start() before Ray (covers ng_run AND e2e_rollout_collection). All three subclass a new ConfigError base. A CLI decorator (exit_cleanly_on_config_error) on run()/e2e_rollout_collection() turns any ConfigError into a clean, rich-escaped message + exit 1 with NO traceback (the explicit ask in #1488/#1489), while keeping them ordinary exceptions so ng_validate (#1599) can still catch and format them. Zero-server check uses validated server instances, not a raw key count. Tests: deterministic tmp_path-based path-error tests (both-locations, dedup, absolute), malformed-config_paths, zero-server, and the decorator (ConfigError -> clean exit; non-ConfigError propagates). Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
621d0f0 to
dc297fa
Compare
wprazuch
added a commit
that referenced
this pull request
Jun 17, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
f44535d to
624d4cf
Compare
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
2fdee46 to
eebfcf8
Compare
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
624d4cf to
4ad73ce
Compare
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 22, 2026
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks example_rollouts.jsonl (fixes its data validation). This branch is the base for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in one place. Drop when martas/1434 rebases on main. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 25, 2026
…hs (#1205 #8/#12; #1488/#1489/#1490) (#1609) ## What One coherent fix for the three `config_paths` failure modes, all failing fast with a **clean message and no traceback**: | Issue | Bad input | Before | After | |-------|-----------|--------|-------| | [#1488](#1488) | typo'd / missing path | 7-frame `FileNotFoundError` | `Error: config_paths entry '...' was not found. Looked in: ...` | | [#1490](#1490) | scalar instead of list | raw Pydantic `ValidationError` (+pydantic.dev URL) | `Error: 'config_paths' must be a list of paths ...` | | [#1489](#1489) | empty / omitted (zero servers) | Ray starts, hangs until SIGTERM | `Error: No server instances are configured ...` before Ray | ## How - New `ConfigError` base in `config_types.py`; `ConfigPathNotFoundError`, `MalformedConfigPathsError`, `NoServerInstancesError` (and the existing `ServerRefNotFoundError`) inherit it. They stay ordinary exceptions, so `ng_validate` (#1599, `except Exception`) can still catch and format them. - `load_extra_config_paths` wraps `OmegaConf.load` (#1488); `parse()` wraps `ta.validate_python` (#1490). - `raise_on_no_server_instances` (validated server-instance check, not a raw key count) runs in **`RunHelper.start()`** before `initialize_ray()` — covers both run and `e2e_rollout_collection` (#1489). - A CLI decorator `exit_cleanly_on_config_error` converts any `ConfigError` to a rich-escaped message + `exit 1`, **no traceback**. Unexpected errors still propagate unchanged. ## Supersedes #1510 Consolidates [#1510](#1510): typed exceptions `ng_validate` can catch/format (a bare `SystemExit` would escape it), a validated zero-server check, the guard in `start()` so `e2e` is covered, and deterministic tests. ## Tests `test_global_config.py`: path-not-found (both-locations / dedup / absolute), malformed config_paths, zero-server (raise + pass). `test_cli.py`: the decorator (ConfigError → clean exit; non-ConfigError propagates unchanged; success passes through). 67/67 `test_global_config`+`test_cli` pass; ruff + pre-commit clean. --------- Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
4ad73ce to
a25ab3c
Compare
…ction #12 / FEP-1016) Add `gym env validate` (+ ng_validate/nemo_gym_validate deprecated shims): run the full config parse with no Ray and no server subprocesses, exit 0 (valid) / 1 (invalid) with a clean, traceback-free message — config errors otherwise only surface ~30-60s later after Ray bootstrap. It reuses get_global_config_dict so the checks stay in sync: config_paths resolution (#1488/#1490), server cross-references (#1561), mandatory ??? values (#1575), and schema. A dummy policy_model (NO_MODEL) is injected so model interpolations resolve without real creds — the model is supplied by --model* at run time. Registered in the env group with the same config-selection flags as env start; wrapped in exit_cleanly_on_config_error. Tests: env validate routing + validate() valid/invalid behavior. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
a25ab3c to
82fb80c
Compare
5 tasks
Friction-point tracking belongs in the PR/epic, not in shipped docstrings. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
1 task
Contributor
|
This double config flag seems strange to me, i get that we used to do a list, is there any other option? Hmm
|
1 task
Contributor
|
i guess another option could be not sure what will be most common for development experience tho |
Contributor
|
Given
Maybe dont need to even pass the model config here then? |
chtruong814
previously approved these changes
Jun 25, 2026
cmunley1
reviewed
Jun 25, 2026
cmunley1
previously approved these changes
Jun 25, 2026
cmunley1
left a comment
Contributor
There was a problem hiding this comment.
lgtm, just docs comment
cmunley1
reviewed
Jun 25, 2026
cmunley1
reviewed
Jun 25, 2026
…al tests) @cmunley1 review: - Examples now lead with `gym env validate --environment <env>` / `--benchmark <benchmark>`; reword so the model config is clearly optional (NO_MODEL injects a dummy policy_model). - Remove the `# pragma: no cover` from validate() — it is unit-tested. - Strengthen TestValidate to run REAL validation (valid config -> ok; unknown cross-ref -> clean exit 1) instead of mocking the parser; keep one fast decorator-path unit test. The real test surfaced that ServerRefNotFoundError (a cross-ref error) was a plain ValueError, so it escaped exit_cleanly_on_config_error and dumped a traceback. Fold it into the ConfigError family so cross-reference errors are reported cleanly by validate (and gym env start). Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
ritaneves
pushed a commit
that referenced
this pull request
Jun 25, 2026
…hs (#1205 #8/#12; #1488/#1489/#1490) (#1609) ## What One coherent fix for the three `config_paths` failure modes, all failing fast with a **clean message and no traceback**: | Issue | Bad input | Before | After | |-------|-----------|--------|-------| | [#1488](#1488) | typo'd / missing path | 7-frame `FileNotFoundError` | `Error: config_paths entry '...' was not found. Looked in: ...` | | [#1490](#1490) | scalar instead of list | raw Pydantic `ValidationError` (+pydantic.dev URL) | `Error: 'config_paths' must be a list of paths ...` | | [#1489](#1489) | empty / omitted (zero servers) | Ray starts, hangs until SIGTERM | `Error: No server instances are configured ...` before Ray | ## How - New `ConfigError` base in `config_types.py`; `ConfigPathNotFoundError`, `MalformedConfigPathsError`, `NoServerInstancesError` (and the existing `ServerRefNotFoundError`) inherit it. They stay ordinary exceptions, so `ng_validate` (#1599, `except Exception`) can still catch and format them. - `load_extra_config_paths` wraps `OmegaConf.load` (#1488); `parse()` wraps `ta.validate_python` (#1490). - `raise_on_no_server_instances` (validated server-instance check, not a raw key count) runs in **`RunHelper.start()`** before `initialize_ray()` — covers both run and `e2e_rollout_collection` (#1489). - A CLI decorator `exit_cleanly_on_config_error` converts any `ConfigError` to a rich-escaped message + `exit 1`, **no traceback**. Unexpected errors still propagate unchanged. ## Supersedes #1510 Consolidates [#1510](#1510): typed exceptions `ng_validate` can catch/format (a bare `SystemExit` would escape it), a validated zero-server check, the guard in `start()` so `e2e` is covered, and deterministic tests. ## Tests `test_global_config.py`: path-not-found (both-locations / dedup / absolute), malformed config_paths, zero-server (raise + pass). `test_cli.py`: the decorator (ConfigError → clean exit; non-ConfigError propagates unchanged; success passes through). 67/67 `test_global_config`+`test_cli` pass; ruff + pre-commit clean. --------- Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com> Signed-off-by: Rita Fernandes Neves <rfernandesne@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 29, 2026
…CLI commands (#1754) Documents the config/CLI features merged for epic #1205 that were not yet reflected in the docs. Requested follow-up: a single doc PR covering the recently merged config/CLI work. ## What's documented | Area | Change | Merged in | |---|---|---| | `reference/cli-commands.mdx` | New `gym list environments`, `gym list agents`, and `gym env validate` sections (+ Quick-Reference entries) | #1635, #1671, #1599 | | `troubleshooting/configuration.mdx` | Three `config_paths` startup errors (Config Path Not Found, Malformed `config_paths`, No Server Instances) + a `gym env validate` pre-flight tip; corrected the stale `ServerRefNotFound` message | #1609, #1599 | | `data/index.mdx` | Unified dataset `source:` block + dedicated "Dataset `source`" subsection + legacy-deprecation note | #1637 | | `data/download-huggingface.mdx` | Auto-download example migrated to `source: { type: huggingface }` | #1637 | | `reference/faq.mdx` | Dataset example and field bullets rewritten around `source:` | #1637 | | `environment-tutorials/single-step-environment.mdx` | Scaffold comment updated to reference `source:` | #1637 | --------- Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch
added a commit
that referenced
this pull request
Jun 29, 2026
Bring the gym env compose / config_composer work (RFC M3) up to date with main (27 commits). Resolved overlapping CLI additions in nemo_gym/cli/main.py and nemo_gym/cli/env.py: keep both the new `env compose` command (this branch) and the `env validate` command (merged to main via #1599) as separate COMMANDS entries and separate functions; both share the NO_MODEL parser-config pattern. Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
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
Adds
gym env validate(+ng_validate/nemo_gym_validatedeprecated shims) — runs the full config parse with no Ray and no server subprocesses, then exits 0 (valid) / 1 (invalid) with a clean, rich-escaped message (no traceback). Returns in well under a second instead of after a ~30–60s Ray bootstrap.How
validate()lives incli/env.pyand is registered asenv validatein thegymrouter (cli/main.pyCOMMANDS) with the same config-selection flags asenv start(--config,--benchmark,--environment,--resources-server,--model-type,--search-dir,--model*). It reuses the sameget_global_config_dict()parse path the other commands use, so the validation checks stay in sync:name:refs (#1561)???values (#1575)BaseNeMoGymCLIConfig)Wrapped in
exit_cleanly_on_config_error(from #1609) so anyConfigErrorbecomes a clean message +exit 1. A dummypolicy_modelis injected (theNO_MODELparser config, as ingym list/env compose) so model interpolations like${policy_base_url}resolve without real creds — validation is about config well-formedness; the real model is supplied by the--model*flags at run time.Targets
mainOriginally drafted on the unified-CLI epic branch; rebuilt directly on
mainnow that #1630 (and #1637/#1609/#1635/#1671) have merged. The old branch contents (a snapshot of the CLI refactor + unrelated CI commits) were superseded and replaced.Scope note
The zero-server check (#1489, "nothing configured to run") is intentionally not part of
validate:NO_MODELinjects a dummy model server (which would defeat the check), and "is anything configured to run" is a start-time concern already enforced bygym env startbefore Ray init.validatefocuses on config well-formedness.Why
Epic #1205 friction #12 (no config validation tooling) — the M1 "fast failure triage" deliverable. Config errors otherwise only surface after Ray starts (~30–60s).
Tests
test_cli_main.py:gym env validate --config Xroutes tonemo_gym.cli.env:validatewith+config_paths=[X](added to the parametrized config-command matrix).test_cli.py:validate()prints OK on a valid config; a raisedConfigErrorbecomesexit 1(no traceback).test_cli+test_cli_main+test_cli_legacypass (the only failures are the pre-existing Python-3.12TestDidYouMeanargparse issue onmain); ruff + pre-commit clean. Smoke-tested end-to-end:✓ Config is valid.on a real benchmark, clean error +exit 1on a bad path, and theng_validatedeprecation shim.