Skip to content

refactor(nemo-user-sim): move episode-only contracts to the Environment Server - #4619

Merged
ananthsub merged 2 commits into
mainfrom
ffrujeri/nemo-user-sim-episode-contracts
Oct 15, 2026
Merged

ananthsub merged 2 commits into
mainfrom
ffrujeri/nemo-user-sim-episode-contracts

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

resources_servers/nemo_user_sim/episode_contracts.py held every UserSim contract, including four types that only the Environment Server uses:

  • UserSimEpisodeRequest
  • UserSimEpisodeResponse
  • UserSimEpisodeResult
  • UserSimEpisodeFailure

This 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_session and /verify:

  • the TaskData alias (UserSimTaskInput)
  • UserSimSeedResponse
  • UserSimSimulationResult
  • UserSimInvocation
  • UserSimVerificationInput
  • UserSimVerifyRequest
  • UserSimVerification

The Environment Server still imports the Resources Server contracts. It is the client of /seed_session and /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 build UserSimEpisodeRequest. They now validate the materialized task_input against TaskData, which the Resources Server owns, and check the task_id/taskset directly. A new Environment Server test, test_example_rows_materialize_as_episode_requests, checks that every example row materializes as a UserSimEpisodeRequest. No Resources Server code or test imports from environment_servers/.

The UserSimTaskInput re-export is marked # noqa: F401 because 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 passed
  • resources_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 passed
  • ruff check / ruff format --check on both server directories: passed
  • pre-commit run --files <changed files>: passed

Rollout 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_contracts must import them from environment_servers.nemo_user_sim.episode_contracts instead. There are no in-repo users other than the ones updated here. Persisted rollouts and task rows are unaffected.

🤖 Generated with Claude Code

…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]>
@ffrujeri ffrujeri added the area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers label Oct 15, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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 yaoyu-33 added complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 15, 2026
@ananthsub

Copy link
Copy Markdown
Contributor

/ok to test 6b7b3c2

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38751862167

Merged via the queue into main with commit b4e6e6f Oct 15, 2026
51 of 56 checks passed
@ananthsub
ananthsub deleted the ffrujeri/nemo-user-sim-episode-contracts branch October 15, 2026 14:43

This branch was previously deployed

1 inactive deployment
public — 6b7b3c22 Deployed Oct 15, 2026 by copy-pr-bot[bot] via release / finalize / notify #5491
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants