Skip to content

[Epic] Search & Discoverability for Environments and Components from the CLI #1582

Closed

Description

@sephmard

Extracted from: #1434

Use cases, pain points, and background

A new user to Gym should be able to discover available environments, benchmarks, agents, datasets, and models directly from the CLI.

Today, users often need to browse GitHub, inspect configs, or understand Gym's internal project structure to answer basic questions such as:

  • What environments are available?
  • What can I evaluate against?
  • Which agents are available?
  • What does a particular environment do?
  • Which environments are compatible with my agent?

This creates unnecessary friction for both human users and agents using Gym as a tool.

Description

Add a discoverability layer to the CLI that allows users to list, inspect, and search registered Gym components.

Example workflows:

gym list environments
gym list benchmarks
gym list agents
gym list dataset

gym list environments aviary

gym search swe

gym list environments --agent openhands

gym search --environments swe

All list, search, and inspect commands should support machine-readable output via --json.

Design

  • Build a registry of discoverable components:
    • environments
    • benchmarks
    • datasets
    • agents
    • models
  • Registry should include both built-in and user-provided components.
  • Add:
gym list <type> <name>
gym search <type> <query>
  • Component inspection should expose:
    • description
    • config source
    • compatibility metadata
    • example invocation
  • Unknown component names should provide "Did you mean?" suggestions.

Out of scope

  • Changes to benchmark architecture.
  • Changes to environment architecture.
  • Agent-centric evaluation workflows.
  • Refactoring underlying config loading mechanisms.
  • Changes to how components are authored or registered internally.

Acceptance Criteria

  • Users can list registered environments, benchmarks, agents, datasets, models from the CLI.
  • Users can inspect a specific component by name.
  • Users can search across registered components.
  • List, search, and inspect commands support --json.
  • Unknown component names provide "Did you mean?" suggestions.
  • Built-in and user-provided components appear in the registry.
  • CLI help text documents discovery workflows.

References

Activity

  1. added theissue type on Jun 11, 2026
  2. sephmard commented on Jul 7, 2026

    @sephmard
    ContributorAuthor

    Sub-issue: #1950 — Environment publishing workflow: fix inaccurate listings and automate discovery surfaces

  3. moved this from Dev Todo to Dev WIP in NeMo Gym 0.5.0 - Aug 5on Jul 10, 2026
  4. sephmard commented on Jul 13, 2026

    @sephmard
    ContributorAuthor

    Bumping to Urgent since discovery will be more critical as we are expanding Environment onboarding

  5. 13 remaining items

  6. moved this from Done to QA Todo in NeMo Gym 0.5.0 - Aug 5on Jul 22, 2026
  7. moved this from QA Todo to QA WIP in NeMo Gym 0.5.0 - Aug 5on Jul 22, 2026
  8. marta-sd commented on Jul 23, 2026

    @marta-sd
    Contributor

    gym list datasets and gym search datasets were removed from the scope as datasets are not stand-alone entities in Gym. The concept of Task will be defined in #2036

  9. phtran8 commented on Jul 29, 2026

    @phtran8

    6499901 is closed as NAB

  10. moved this from QA WIP to Done in NeMo Gym 0.5.0 - Aug 5on Jul 29, 2026
  11. qiaochuz-nv commented on Jul 29, 2026

    @qiaochuz-nv
    Contributor

    Hi @marta-sd ,
    all bugs are reported under https://nvbugspro.nvidia.com/bug/6534439
    below are test summary.

    NeMo Gym CLI — Test Summary

    Feature: unified gym CLI (single entry point with grouped subcommands, replacing 40+ ng_* / nemo_gym_* scripts)

    Item Detail
    Epic #1434 CLI usability — first class CLI experience
    Implementation #1630 CLI refactor (254 files, +5994/−3377)
    Sub-epic #1582 Search & Discoverability — CLOSED/COMPLETED
    Sub-epic PRs #2061 #2062 #2063 #2064
    Reference spec fern/versions/latest/pages/reference/cli-commands.mdx (872 lines, 27 documented commands)
    System under test /home/qiaochuz/nemo/Gym @ 2e8efc8, NeMo Gym v0.5.0rc0, editable install
    Test suite nmfw_tests @ /home/qiaochuz/nemo/nmfw_tests_gym_1630, branch qiaochuz/gym_1630_cli_refactor
    Run id 20260729T192658Z-8be5f668 — local, CPU-only (num_gpus: 0)
    Date 2026-07-29

    Results are reproducible only at Gym 2e8efc8: the SUT is a live host checkout, not a pinned container image.


    1. Result Summary

    The suite is deliberately split into two instruments with opposite purposes.

    Instrument Cases Assertions Result Meaning
    Regression guard 5 30 30 PASS / 0 FAIL Current behaviour is pinned; red = something newly broke
    Defect backlog 1 8 0 PASS / 8 FAIL Red is the intended state; each failure is an open defect
    Total 6 38 30 PASS / 8 FAIL Runner manifest: failed — accurate, the feature has open defects
    # Test case Assertions Result Duration
    1 c1_cli_router 7 PASS 4.4s
    2 c1_legacy_aliases 4 PASS 7.4s
    3 c1_discovery 7 PASS 78.4s
    4 c1_reference_surface 7 PASS 194.1s
    5 c1_catalog_enumeration 5 PASS 242.9s
    6 c1_known_defects 8 FAIL (expected) 125.2s

    Other metrics: ~1,000 CLI invocations · 329/329 components covered · 204 configs validated · 8 defects found.

    Static gates: make test:lint → ok: no nemo_gym imports in suite code · ok: 20 testcases registered across 3 sections, all scripts present. py_compile clean.

    Why the split exists

    An earlier revision of this suite reported 30/30 green while all 8 defects were already open. That was not luck — it was structural. A regression guard must encode current behaviour to detect future change, so every defect found during authoring was accommodated rather than reported: quarantine sets, excluded component types, identity-key lookup tables, slicing past a polluted header. Green meant "nothing got worse", but it read as "everything is fine".

    c1_known_defects is the opposite instrument. Every assertion states what the product is supposed to do per its own epic and reference docs, so each open defect is exactly one red assertion. The failure list is the backlog:

    • a defect gets fixed → its assertion turns green, no test edit needed
    • a defect regresses → it turns red again
    • a new defect appears → add an assertion here, not a quarantine elsewhere

    Do not make this case pass by relaxing an assertion. That silently re-hides the defect the file exists to expose.


    2. Test Scope

    2.1 In scope — commands actually executed

    Every command below was run as a real subprocess against the installed console script.

    CLI command What was verified Scale Result
    gym --help Top-level surface matches the documented group set 1 PASS
    gym --version Human output 1 PASS
    gym --version --json stdout is pure parseable JSON, documented keys present 1 PASS
    gym <group> --help All 6 groups exit 0 6 PASS
    gym <group> <cmd> --help All documented sub-commands exit 0, non-empty stdout 25 PASS
    gym list <type> All 5 types return a JSON array of identified components 5 PASS
    gym list <type> <NAME> Every component inspects and round-trips its own name 329 PASS
    gym list <type> <typo> Every near-miss typo yields a real "Did you mean?" name 329 PASS
    gym search <type> <NAME> Every component is retrievable by its own name 329 PASS
    gym search <query> Bare form defaults to benchmarks, identical to explicit form 1 PASS
    gym search <type> <query> Hits are a subset of that type's catalog 5 PASS
    gym env validate --resources-server Exit 0 or clean exit 1 per the documented contract 166 PASS
    gym env validate --environment Same contract 20 PASS
    gym env validate --model-type Same contract 18 PASS
    gym env resolve --config Merges configs, emits parseable YAML on stdout 1 PASS
    gym env status --json Returns a JSON array 1 PASS
    gym env packages --json Package data well-formed for provisioned servers 2 PASS
    ng <...> Drop-in alias, byte-identical to gym 1 PASS
    ng_* / nemo_gym_* aliases All installed; routing table agrees; deprecation on stderr; stdout byte-identical 52 PASS
    Defect assertions (A–H) What the epic and docs promise 8 FAIL — see §6

    2.2 In scope — component trees, swept exhaustively

    Tree Catalog size Inspected Validated
    resources_servers 166 166 166
    responses_api_agents 30 30 — (no standalone config, by design)
    environments 20 20 20
    responses_api_models 18 18 18
    benchmarks 95 95 —
    Total 329 329 204

    Not sampled. Every entry the CLI advertises was driven individually.

    2.3 Out of scope — not executed, explicitly unverified

    Command Reason
    gym dataset upload / download / rm / migrate Destructive and/or requires GitLab + HF credentials
    gym dataset collate / render Requires prepared dataset inputs
    gym env start / gym env test Starts Ray + server subprocesses
    gym env init Writes scaffold files into the checkout
    gym eval prepare / run / aggregate / profile / reverify Requires a model endpoint, GPU, cost
    gym dev test Runs upstream's own unit suite
    --tier e2e Requires Docker + vLLM + GPU

    Their flag surface was still verified via --help (exit 0, non-empty stdout) — the only side-effect-free invocation available.


    3. Results by Test Case

    3.1 c1_cli_router — 7/7 PASS

    Router and top-level surface (nemo_gym/cli/main.py, cli/general.py).

    # Assertion Result
    1 Binary advertises exactly the documented top-level groups PASS
    2 Every group exposes exactly its documented commands PASS
    3 Every leaf answers -h with exit 0 and clean stderr PASS
    4 ng is a drop-in alias (byte-identical --help) PASS
    5 Both console scripts report the same installation PASS
    6 --version --json emits JSON and nothing else on stdout PASS
    7 Diagnostics keep stdout machine-clean PASS

    3.2 c1_legacy_aliases — 4/4 PASS

    Backward compatibility (nemo_gym/cli/legacy.py, [project.scripts]).

    # Assertion Result
    1 Every deprecated console script is installed PASS — declared 52 = installed 52
    2 Installed aliases ↔ LEGACY routing table agree exactly PASS — 26 = 25 keys ∪ {reinstall}
    3 ng_version routes correctly, notice on stderr only PASS
    4 ng_list_benchmarks stdout byte-identical to modern command PASS — 95 benchmarks

    3.3 c1_discovery — 7/7 PASS

    Discovery surface from epic #1582.

    # Assertion Result
    1 All 5 types list as JSON arrays of identified components PASS
    2 Inspect keys every type on name PASS
    3 Every environment and agent inspects + round-trips PASS — 50/50
    4 Inspected component carries config source + usage example PASS
    5 search takes component type as a positional; hits ⊆ catalog PASS
    6 gym search swe ≡ gym search benchmarks swe PASS — 19 hits
    7 Unknown name → correct per-type "Did you mean?" PASS

    3.4 c1_reference_surface — 7/7 PASS

    The documented reference (cli-commands.mdx) driven against the binary.

    # Assertion Result
    1 All 25 documented sub-commands answer --help exit 0 PASS
    2 All 166 resources servers validate or fail cleanly PASS — 10 quarantined (Defect E)
    3 All 18 model types validate or fail cleanly PASS
    4 All 20 environments validate or fail cleanly PASS — 2 quarantined (Defect E)
    5 All 329 components inspect and round-trip identity PASS
    6 Inspected components expose a runnable usage example PASS — agents/models excluded (Defect F)
    7 env resolve merges configs; env status --json is an array PASS

    3.5 c1_catalog_enumeration — 5/5 PASS

    Every command driven over every component rather than a representative sample.

    # Assertion Enumerated Result
    1 Every component inspects and round-trips its identity 329 PASS
    2 Every component is retrievable by searching its own name 329 PASS
    3 Every near-miss typo suggests a real name of that type 329 PASS
    4 Every list/search/status command emits parseable JSON 11 PASS
    5 Every provisioned resources server reports its package list 2 PASS

    Two design choices, both derived from real output:

    • The typo is name[:-1] — the one mutation that stays inside difflib's cutoff for names of any length while guaranteeing an absent key.
    • The suggestion is checked for membership in the catalog, not equality with the original name. aime2 legitimately resolves to aime26 when aime24/25/26 all exist; demanding the original back would assert difflib's tie-breaking, not the product's contract.

    3.6 c1_known_defects — 0/8 PASS · RED BY DESIGN

    Each assertion states what the product should do. Each failure is one open defect.

    # Assertion (what the epic/docs promise) Result Defect
    1 -v and --verbose are accepted before the subcommand FAIL A
    2 A misplaced flag is not suggested as a correction to itself FAIL B
    3 Every command shown in the docs is actually runnable FAIL C
    4 Every component type keys its listing rows on name FAIL D
    5 env validate never prints a raw traceback FAIL E
    6 Every inspected component exposes a runnable usage example FAIL F
    7 The reference's own env resolve example runs as printed FAIL G
    8 env packages --json emits nothing but JSON on stdout FAIL H

    Registered status: fail, expected_to_fail: true, nvbugs_status: to_be_filed so the runner records a known-red signal rather than a broken test.

    Counter-check — these assertions are bound to real behaviour, not dead code. The "fixed" shape of each is reachable today: benchmarks already carries a name key (D), gsm8k already returns a usage_example (F), gym list agents --json already emits a bare array (H). So a fix flips the assertion green with no test edit.

    A false green was caught while building this case. Assertion G initially passed while the same command failed by hand. Root cause was my own harness: scratch_workspace is sealed and writes an env.yaml supplying policy_base_url / policy_api_key / policy_model_name — exactly the three keys the documented example omits. The test infrastructure was filling the product's gap. G now runs from a bare directory, matching what a new user actually has, and correctly fails. Lesson: not only loose assertions produce false green — test infrastructure can mask defects too.


    4. Acceptance Criteria

    # Criterion (from epic #1434 / #1582) Verdict
    1 Single gym entry point with subcommands PASS
    2 -h/--help at every level, no hidden commands PASS — 6 groups + 25 sub-commands
    3 --json on list / inspect / status commands PARTIAL — 11/12 comply; env packages fails (H)
    4 ng_* / nemo_gym_* keep working with a deprecation notice PASS — 52/52
    5 "Did you mean?" suggestions PARTIAL — correct for all 329 names; broken for flags (B)
    6 -v / --verbose supported globally FAIL — A
    7 --flag value for primary inputs, Hydra as escape hatch PASS
    8 Users can list, inspect and search all registered components PASS — 329/329
    9 gym --help + migration documentation published PASS — with 2 doc defects (C, G)
    10 Component inspection exposes an example invocation PARTIAL — 281/329; agents and models null (F)

    6 PASS · 3 PARTIAL · 1 FAIL


    5. Requested Commands — Verified Individually

    Four commands were requested for verification; they originate from epic #1582's own examples. Two do not work as written.

    # Command Exit Verdict
    1 gym list environments aviary 1 FAIL — wrong component type. aviary is a resources-server, not one of the 20 environments. Correct: gym list resources-servers aviary (exit 0)
    2 gym search swe 0 PASS — 19 benchmark hits (defaults to benchmarks)
    3 gym list environments --agent openhands 2 FAIL — flag does not exist. Capability unimplemented (§7)
    4 gym search --environments swe 2 FAIL — wrong syntax. Component type is a positional: gym search environments swe

    Commands 1, 2 and 4 (corrected forms) are now permanently covered by c1_discovery and c1_catalog_enumeration. Command 3 cannot be covered — the capability does not exist.


    6. Defects

    # Severity Type Summary Asserted red
    A Major Product -v / --verbose is not global ✓
    B Minor Product "Did you mean?" suggests the exact token the user typed ✓
    C Major Doc ng_viewer documented but not shipped (exit 127) ✓
    D Minor Product list/search identity key inconsistent for models ✓
    E Major Product env validate leaks raw tracebacks on 12 configs ✓
    F Minor Product usage_example null for all agents and models ✓
    G Major Doc The reference's own env resolve example fails as printed ✓
    H Major Product env packages --json prints a human header before the JSON ✓

    All 8 are covered by a failing assertion in c1_known_defects — none rely on prose alone.

    A — -v / --verbose is not global

    nemo_gym/cli/main.py. The epic requires "-v/--verbose supported globally and honored by subcommands."

    $ gym -v list benchmarks         → exit 2, "unrecognized arguments: -v"
    $ gym --verbose list benchmarks  → exit 2
    $ gym list benchmarks -v         → exit 0, DEBUG emitted
    $ gym --help                     → -v/--verbose absent from top-level help
    

    Works only in trailing position, per-subparser. Path-dependent: gym -v eval run --help exits 0 while gym -v list benchmarks exits 2.
    Fix: register -v/--verbose on a top-level parent parser inherited by all subparsers.

    B — self-contradictory "Did you mean?"

    _GymArgumentParser.error() in nemo_gym/cli/main.py.

    $ gym -v list benchmarks
    gym list benchmarks: error: unrecognized arguments: -v Did you mean `-v`?
    

    The suggester runs against a candidate list containing the rejected token, because it was rejected for position, not for being unknown.
    Fix: exclude the rejected token from its own suggestion set; when valid-but-misplaced, say so.
    A and B share one code path — plausibly a single fix.

    C — ng_viewer documented but not shipped

    responses_api_agents/swe_agents/README.md:503

    $ ng_viewer --help    → bash: ng_viewer: command not found (exit 127)
    

    Not installed, not in [project.scripts], not in the LEGACY table — no deprecation shim, a hard 127. #1630 migrated the prose line immediately above and stopped one line short.

    D — identity key inconsistent for models

    Command Identity key
    gym list {benchmarks,environments,agents,resources-servers} --json name
    gym list models --json model + model_group, no name
    gym list <type> <NAME> --json (inspect) name — uniform across all 5

    Any consumer writing [x["name"] for x in json] breaks on models alone. Divergence is confined to the list/search projection.

    E — env validate leaks raw tracebacks

    cli-commands.mdx:417 promises validate "exits 0 when valid, or 1 with a clean message (no traceback)". 12 configs instead dump a raw omegaconf.errors.InterpolationKeyError.

    $ gym env validate --resources-server cvdp
    ...
    omegaconf.errors.InterpolationKeyError: Interpolation key 'cvdp_sim_image' not found
        full_key: cvdp.resources_servers.cvdp.oss_sim_image
    

    The CLI already handles the sibling error class cleanly — an unset ??? yields Error: 1 required config value(s) are unset …. Root cause: ConfigError in nemo_gym/config_types.py has a member for missing mandatory values but none for unresolved ${...} interpolations, so omegaconf's exception escapes uncaught.

    Affected — 10 resources servers: browsecomp_advanced_harness, cvdp, example_mcp_weather, genrm_compare, over_refusal_detection, over_refusal_detection/over_refusal_detection_nemotron, reasoning_gym/reasoning_gym_claude_code_agent, reasoning_gym/reasoning_gym_codex_agent, tavily_search/tavily_search_judge_openai_model, tavily_search/tavily_search_judge_vllm_model; 2 environments: finance_sec_search, reasoning_gym_claude_code.

    F — usage_example null for agents and models

    Epic #1582 requires component inspection to expose an example invocation.

    Type Present Null
    benchmarks 95 0
    environments 20 0
    resources-servers 166 0
    agents 0 30
    models 0 18

    G — the reference's own env resolve example fails

    cli-commands.mdx:400-416 presents a copy-paste block. Executed verbatim from a directory with no env.yaml — what a new user has:

    $ gym env resolve \
        --config resources_servers/example_single_tool_call/configs/example_single_tool_call.yaml \
        --config responses_api_models/openai_model/configs/openai_model.yaml \
        ++responses_create_params.temperature=0.6
    → exit 1
    omegaconf.errors.InterpolationKeyError: Interpolation key 'policy_base_url' not found
    

    Zero model configs resolve standalone. A working invocation needs three keys the example omits (++policy_base_url, ++policy_api_key, ++policy_model_name) — verified exit 0, 88 lines of valid YAML. Unlike validate, resolve substitutes no dummy model.

    H — env packages --json is not machine-readable

    nemo_gym/cli/env.py:1080-1082. --json is advertised in gym env packages -h, but three unconditional print() calls emit a human header to stdout before the JSON payload:

    $ gym env packages --resources-server mcqa --json | jq .
      Package list for: resources_servers/mcqa
    Virtual environment: /home/qiaochuz/nemo/Gym/resources_servers/mcqa/.venv
    ------------------------------------------------------------------------
    [{"name":"aiohappyeyeballs","version":"2.7.1"}, ...]
    
    → json.decoder.JSONDecodeError: Expecting value: line 1 column 3 (char 2)
    

    stderr is empty (0 bytes), so the header genuinely pollutes the data stream. Every other --json command emits a bare array.
    Fix: suppress the header when --json is set, or write it to stderr.


    7. Audit — every non-zero exit reviewed

    Raw logs contain 360 non-zero exits. All were re-classified; none is an unreported failure.

    Source Count Classification
    gym list <typo> 319 Intentional — did-you-mean probes (name[:-1]), exit 1 expected
    gym env validate — clean fail 18 Correct behaviour — documented Error: message, exit 1
    gym env validate — traceback 12 Defect E
    Other 0 —

    The 18 clean failures were classified individually (previously unexamined):

    Class Count Example
    missing model ref 16 simpleqa requires genrm_model; not supplied
    unset ??? mandatory 2 azure_openai_model, local_vllm_model_proxy

    Both are legitimate user errors that env validate reports correctly — evidence the command works, not defects.

    Also investigated and dismissed: a BrokenPipeError traceback appeared while piping --json output. Re-checked with | head on three commands — does not reproduce. The traceback came from my own python3 -c consumer exiting early, not from gym. Not filed.


    8. Coverage Gap — Epic #1582 Not Fully Delivered

    Issue #1582 is closed as COMPLETED, but one of its own worked examples is unimplemented:

    gym list environments --agent openhands   # "Which environments are compatible with my agent?"

    Verified absent: --agent is not a flag on list environments (exit 2), and none of #2061–#2064 add it (grep -c '"--agent"' = 0 across all four diffs). The issue's stated use case and its "compatibility metadata" design bullet have no shipped implementation.

    No test authored — a capability that does not exist cannot be tested, and suite rule R4 forbids negative tests.

    Recommendation: reopen #1582 or file a follow-up for agent-compatibility filtering.


    9. Deliverables

     M nemo_llm/test_suite/nemo-gym/testcase_list.json          (6 entries)
    ?? nemo_llm/test_suite/nemo-gym/testcases/cli/c1_catalog_enumeration.py
    ?? nemo_llm/test_suite/nemo-gym/testcases/cli/c1_cli_router.py
    ?? nemo_llm/test_suite/nemo-gym/testcases/cli/c1_discovery.py
    ?? nemo_llm/test_suite/nemo-gym/testcases/cli/c1_known_defects.py
    ?? nemo_llm/test_suite/nemo-gym/testcases/cli/c1_legacy_aliases.py
    ?? nemo_llm/test_suite/nemo-gym/testcases/cli/c1_reference_surface.py
    
    Gate Result
    make test:lint PASS — no nemo_gym imports; 20 testcases registered, all scripts present
    Registry integrity No pre-existing keys dropped
    Suite rule R2 (no import nemo_gym) PASS
    Suite rule R5 (SUT checkout unpolluted) PASS — git status --porcelain empty
    Secrets / scratch staged None — baselines/, qa_credentials.yaml, logs/ untracked

    All six cases registered function, num_gpus: 0, slurm.isolate_group: true. The five regression cases carry status: pass; c1_known_defects carries status: fail + expected_to_fail: true + nvbugs_status: to_be_filed. Nothing committed.


    10. Recommended Actions

    Priority Action
    1 File A + B as one Gym issue — same code path, one fix
    2 File E — ConfigError needs an unresolved-interpolation member; 12 configs affected, highest user impact
    3 File H — one if config.json: guard at env.py:1080
    4 File G — the reference's flagship env resolve example does not run as printed
    5 File C — one-line doc fix; needs an owner who knows what replaced ng_viewer
    6 File D and F — schema/metadata consistency; D is a breaking change needing a deprecation note
    7 Reopen #1582 or file a follow-up for --agent compatibility filtering

    As each defect is fixed, its assertion in c1_known_defects turns green on its own. When all 8 are green the case can be deleted — the regression guards already cover the fixed behaviour.

  12. moved this from Done to QA Verified in NeMo Gym 0.5.0 - Aug 5on Jul 29, 2026
  13. moved this from QA Verified to Done in NeMo Gym 0.5.0 - Aug 5on Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions