Repository navigation
fix(grl): start GRL READMEs without the unbound gymnasium_agent and keep agent_ref on --agent - #4544
Merged
ananthsub merged 3 commits intoOct 12, 2026
Conversation
…ommands The GRL Sokoban and Tetris READMEs passed the generic gymnasium_agent.yaml to gym env start. That file defines an extra gymnasium_agent instance with no resources_server or model_server, so GymnasiumAgentConfig rejects it and startup aborts. Each resource config already ships a bound <resource>_gymnasium_agent, matching the blackjack and wordle READMEs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: qiaochuz <[email protected]>
…s own agent
gym eval run --agent X sets agent_map._default = X, and the agent_map
branch rewrote every row's agent_ref to {"name": X} even when the row
already named X. That dropped extra fields such as type from the
materialized and rollout rows. Restamp only on a real re-route, matching
the fan-out path.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: qiaochuz <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: qiaochuz <[email protected]>
ananthsub
approved these changes
Oct 12, 2026
Contributor
|
/ok to test a8c36b0 |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38308835709 |
ananthsub
deleted the
qiaochuz/nvb-6775679-grl-readme-gymnasium-config
branch
October 12, 2026 21:23
This branch was previously deployed
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 does this PR do?
The
gym env startcommands in the GRL Sokoban and GRL Tetris READMEs now start the servers. Before this change both aborted at startup with aGymnasiumAgentConfigvalidation error, before any model call.With startup fixed, the README flow reached a second bug.
gym eval run --agent Xdroppedtypefrom each row'sagent_refin the materialized and rollout files, even though the row already namedX. This PR fixes both.Fixes NVBug 6775679 (Linear GYM-1016). Closes #4490.
Cause
resources_servers/grl_sokoban/README.md:16andresources_servers/grl_tetris/README.md:17pass--config responses_api_agents/gymnasium_agent/configs/gymnasium_agent.yamlin addition to--resources-server. That generic file declares a top-levelgymnasium_agentinstance with onlyentrypoint: app.py. Its name differs from the resource's owngrl_<x>_gymnasium_agent, so Gym starts both, and the generic one fails validation becauseGymnasiumAgentConfigrequiresresources_serverandmodel_server.The line came in with the READMEs themselves (#1330, #1331). At those commits the generic config already had no references and the agent config already required them, so the command never worked.
gym eval run --agent Xsetsagent_map._default = X(nemo_gym/rollout_collection.py:1564). The agent_map branch of_preprocess_rows_from_configthen rewroteagent_refto{"name": X}for every row, including rows already routed toX. This contradicts the fan-out path a few lines later, which keeps the row'sagent_refdict byte-for-byte. GRL example rows carry{"type": "responses_api_agents", "name": "grl_<x>_gymnasium_agent"}, so the README's--agentcommand losttype. The rewrite came in with #2710.Fix
--configline from both commands. Each resource config already ships a boundgrl_<x>_gymnasium_agent(resource,policy_model,max_steps: 20), so--resources-server <name>alone is the full recipe. The blackjack and wordle READMEs already use this form.rollout_collection.py: restampagent_refonly when agent_map actually re-routes the row (mapped != agent_name). Re-routes still restamp and warn as before. New testTestAgentMapRouting::test_agent_name_matching_row_keeps_agent_ref_dictfails before this change ({'name': 'x'}) and passes after;test_agent_name_reroute_restamps_clean_agent_refpins that a real re-route still writes a clean{"name": new}(the old agent'stypeis not carried over).Before the fix
Gym
f054cf644(main), README command (model endpoint values are local placeholders; startup fails before any model call):gym env start \ --model-type openai_model \ --config responses_api_agents/gymnasium_agent/configs/gymnasium_agent.yaml \ --resources-server grl_sokobangrl_tetrisfails the same way.After the fix
Gym
ea41df3a2(README commit on this branch), the README's corrected command:gym env start \ --model-type openai_model \ --resources-server grl_sokobangrl_tetris:All 4 / 4 servers ready!agent_refinexample_rollouts_materialized_inputs.jsonlaftergym eval run --no-serve --agent grl_sokoban_gymnasium_agent --input resources_servers/grl_sokoban/data/example.jsonl ...:Validation
grl_sokoban,grl_tetris(full README flow with a hosted model, all 5 examples, 20-turn budget): onf054cf644both FAIL (rollout agent identity: expected {'type': 'responses_api_agents', 'name': 'grl_<x>_gymnasium_agent'}, got {'name': ...}); ond7bb77ebdboth PASS. One earlier tetris attempt ond7bb77ebdhit a hosted-model 503 (Model ... is not ready to serve requests yet) and was rerun.pytest tests/unit_tests/test_rollout_collection.py: 432 passed. Fulltests/unit_testson macOS: the same 42 sandbox/telemetry/launcher failures with and without this change; none touch rollout collectionpre-commit run --all-files: passedtests/unit_tests/test_fern_docs_links.py: 18 passednemotron-3.5-super-vl-preview, 5 examples each, 0 failure rows; sokoban mean/reward 10.56, tetris 9.04, both matching the persisted rollouts; sokoban moves replayed against the seeded board.Compatibility
README change: none. Rollout collection: rows already routed to the selected agent now keep their full
agent_ref(e.g.type) in materialized and rollout files. Gym consumers key onagent_ref.name; ATIF export also readstypewhen present (nemo_gym/atif_export.py:901), so it now sees the value the data declared. Routing, re-route warnings, and rows that are actually re-routed are unchanged.🤖 Generated with Claude Code