Repository navigation
refactor(nemo-user-sim): move episode-only contracts to the Environment Server - #4619
Merged
Merged
Conversation
…nt Server UserSimEpisodeRequest, UserSimEpisodeResponse, UserSimEpisodeResult, and UserSimEpisodeFailure are used only by the Environment Server, but lived in resources_servers/nemo_user_sim/episode_contracts.py. Move them to environment_servers/nemo_user_sim/episode_contracts.py so the Resources Server module holds only the TaskData alias and the seed/verify contracts it owns. No wire format or behavior changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The Resources Server data tests built UserSimEpisodeRequest from example and prepared rows, which made them import the Environment Server's contracts. They now validate materialized task_input against TaskData, which the Resources Server owns. A new Environment Server test checks that every example row materializes as a UserSimEpisodeRequest. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]>
yaoyu-33
approved these changes
Oct 15, 2026
Contributor
|
/ok to test 6b7b3c2 |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38751862167 |
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 changed and why
resources_servers/nemo_user_sim/episode_contracts.pyheld every UserSim contract, including four types that only the Environment Server uses:UserSimEpisodeRequestUserSimEpisodeResponseUserSimEpisodeResultUserSimEpisodeFailureThis PR moves those four types to a new
environment_servers/nemo_user_sim/episode_contracts.py. The Resources Server module now holds only what the Resources Server owns or shares through/seed_sessionand/verify:TaskDataalias (UserSimTaskInput)UserSimSeedResponseUserSimSimulationResultUserSimInvocationUserSimVerificationInputUserSimVerifyRequestUserSimVerificationThe Environment Server still imports the Resources Server contracts. It is the client of
/seed_sessionand/verify, so the dependency still points from the Environment Server to the Resources Server.The tests follow the same split. The Resources Server data tests (
test_example_artifacts.py,test_prepare.py) used to buildUserSimEpisodeRequest. They now validate the materializedtask_inputagainstTaskData, which the Resources Server owns, and check thetask_id/tasksetdirectly. A new Environment Server test,test_example_rows_materialize_as_episode_requests, checks that every example row materializes as aUserSimEpisodeRequest. No Resources Server code or test imports fromenvironment_servers/.The
UserSimTaskInputre-export is marked# noqa: F401because the module no longer uses it internally. Both servers still import it from there.No wire format, field, or behavior changes. The models were moved without edits.
Issue: none. This is a small ownership cleanup that came out of reviewing the Resources/Environment split for
nemo_user_sim, which was added in #3800.Validation
resources_servers/nemo_user_sim/.venv/bin/pytest -q resources_servers/nemo_user_sim/tests: 36 passedresources_servers/nemo_user_sim/.venv/bin/pytest -q environment_servers/nemo_user_sim/tests: 27 passed (26 existing + 1 new)uv run gym env test --resources-server nemo_user_sim: 36 passedruff check/ruff format --checkon both server directories: passedpre-commit run --files <changed files>: passedRollout evidence
N/A. This is a pure module move with no behavior change. The request and response models are unchanged, and the existing unit tests exercise the full Environment Server
run()path against the real Resources Server.Compatibility
Code that imports the four episode types from
resources_servers.nemo_user_sim.episode_contractsmust import them fromenvironment_servers.nemo_user_sim.episode_contractsinstead. There are no in-repo users other than the ones updated here. Persisted rollouts and task rows are unaffected.🤖 Generated with Claude Code