NVIDIA-NeMo/RL #5340.
NeMo-RL links pin the PR head d421014e (removed code: the base 1a78def0); Gym links pin 9e2e5d0a, the version RL pins.
legacy_agent relay, or recover whole groups instead.Three pages on this PR, one question each. This one: what changed and why resume now works.
What “typed” means here. Every Gym environment server subclasses one base class, BaseEnvironmentServer[Req, Resp]. A typed one fills in the request and response types and runs the episode steps itself: single_agent_turn, single_agent_turn_legacy (typed, despite its name), harbor, and others. The only untyped one is the legacy_agent relay (and misalignment_monitored, built on it). It forwards /run to an agent without reading it, and the agent runs the episode. There is no flag: the server type the config names decides it. Full list and picture: Gym server roles.
The PR removes two refusals: a setup check (_reject_typed_environment_servers, at the base) and a refusal of environment participants in discover (at the base). The checkpoint summary now counts an environment server's episodes as its own (_commit_summary). That alone was not enough: Gym checks that a resumed episode is the same task (begin), and a row with no task ID gets its ID from the number _ng_task_index (materialize_task). RL gave every dispatch a new number, so Gym refused every resume.
The two paths meet at the checkpoint summary: after it, a saved episode has one owner and goes through the same restore. What still differs after that point: a typed server checks the task when an episode resumes (so the number must match), and a typed server can limit how many episodes run at once. That limit is the open problem on the second page. The fix only matters for rows with no task_id, problem_id or instance_id of their own, like string_match's.
Before (base)
# rollout manager, one prompt group, on the driver's event loop rows = build_inputs(sample, task_index=take_task_index()) # one new number, every row ledger.mark_group_dispatched(group) # number not saved send(rows)
After (this PR)
# rollout manager, one prompt group, on the driver's event loop idx, fresh = {}, None for g in pending: a = group.siblings[g].current_attempt if a.environment_attempt > 0 and a.environment_task_index is not None: idx[g] = a.environment_task_index # continued: keep 7 else: fresh = fresh or take_task_index(); idx[g] = fresh # new or restarted: share 12 rows = build_inputs(sample, task_indices=idx) ledger.mark_group_dispatched(group, environment_task_indices=idx) # saved (snapshot schema 9) send(rows) # a continued row whose number changed is refused
Real code: _nemo_gym_task_indices, its call in _generate_for_finalization_attempt, and the saved field environment_task_index. Old snapshots (schemas 2–8) still load, without the number.
rollout_recovery.target_level: turn or prefix; no more swapping to legacy_agent. The review asks for one unit test that checks the dispatch path above really passes the kept number to both the rows and the ledger: removing either still leaves every CPU test green. Before using this on a server with max_concurrent_episodes set, read the second page.🟡 review comment C2 — rollout_manager.py:3288 (missing wiring test)
🔴 review comment C1 — capped servers (reply on gym_checkpoint_adapter.py:190)
🟡 review comment C3 — older-schema comment (reply on rollout_recovery.py:2074)