NVIDIA-NeMo/RL #5340.
NeMo-RL links pin the PR head d421014e; Gym links pin 9e2e5d0a, the version RL pins. First raised by another reviewer on the PR; this page backs it with the RL side.
legacy_agent relay ignores the cap.max_concurrent_episodes.Three pages on this PR, one question each. This one: why a capped server stalls snapshots, and the proposed guard.
A typed Gym server with max_concurrent_episodes lets that many episodes run; the rest wait for a free slot (the wait). A waiting row is not yet known to Gym's checkpoint: it registers only later, in claim/begin. So at a snapshot Gym saves the running episodes and pauses them, still holding their slots, and says nothing about the waiting row. RL sent that row, so it waits for its answer (_drain_non_exported_candidates) for token_capture.control_timeout_s, 60 s by default (config.py:756). The row cannot start until a paused episode frees its slot, which only happens after the snapshot.
Configs that set the cap with a long wait: enterpriseops_gym (64 slots, 86400 s), gdpval (32, 86400 s), officeqa_pro (8, 600 s). Gym requires the wait whenever the cap is set (validate_queue_timeout). The legacy_agent relay never takes a slot (run_legacy), which is why this never showed up before.
Where the fix lands: RL now, Gym later. In RL, refuse turn/prefix recovery at setup when a typed server sets the cap, in initialize_checkpoint_adapter, where the old typed-server refusal ran. In Gym (an issue, not this PR): a row still waiting for a slot should fail at once with the same retryable "admission closed" error a new row gets (environment.py:105) once a checkpoint starts. Then the RL check can go.
The guard, as pseudocode (proposed, not run)
# Gym actor, once, before the first checkpoint def initialize_checkpoint_adapter(): capped = [f"{inst}.{kind}: cap={s.max_concurrent_episodes}, wait={s.queue_timeout_seconds}" for inst, entry in gym_config # every Gym server instance for kind, s in entry.environment_servers # its typed servers if s.max_concurrent_episodes is not None] if capped: raise ValueError(f"turn/prefix recovery cannot snapshot rows waiting for a slot: {capped}") adapter = GymCheckpointAdapter(...) await adapter.discover()
A unit test: one capped and one uncapped server; only the capped one is named in the error.
🔴 review comment C1 — reply on gym_checkpoint_adapter.py:190