Repository navigation
feat(checkpoint): report every participant's checkpoint mode in status and discovery - #4957
Conversation
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
211f90d to
93aa07d
Compare
|
/ok to test 93aa07d |
|
Thanks @macandro96 for this fix. The inline comment asks to extend from agents to every participant, as a common field next to A typed status reply, with each kind's other fields under its own key, can follow separately. |
An agent that declares checkpoint_mode = "restart_only" takes part in checkpoints through RestartOnlyAgentParticipant: its in-flight rollouts are reported as restarts and start over from their input after a crash. Its /status reply did not say so; it differed from an exported agent's only in lacking the session participant's accepting field. A training framework that asks for turn-level recovery could therefore learn only at its first checkpoint that every rollout of that agent would start over. Both agent participants now report mode in /status, the key and values a resources server already reports: exported for an agent that continues its rollouts, restart_only for one that restarts them. A server with several workers reports the workers' shared mode, as it does for resources servers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…s contract Reporting mode only from the agent participants' status extras left it optional: environment servers declare checkpoint_mode but their status said nothing, the policy model said nothing, and a server with several workers built its extras only from the workers that answered in time. A controller still had to treat a missing mode as unknown for some kinds and as "always saves" for others, and made a second round of status calls after discovery. Every CheckpointParticipant now declares mode next to kind, and the control plane refuses a participant without a valid one. Agents and the policy model set it as a class constant, a resources participant keeps the mode it is given, an environment participant takes its server's checkpoint_mode, and the several-worker coordinator copies it from the wrapped participant as it copies kind. The status reply reports mode beside kind instead of in the extras, and discover() reads it into Participant.mode, so a controller can filter restart-only servers from discovery alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
93aa07d to
b74bfe4
Compare
ananthsub
left a comment
There was a problem hiding this comment.
LGTM! one small comment for CI and then this is good to ship
|
/ok to test b74bfe4 |
…metry tests coordination.Participant now has a required mode field; the coordination telemetry tests built participants without it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
|
/ok to test 5721be0 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40412066372 |
…rom discovery Gym main now has NVIDIA-NeMo/Gym#4957: every checkpoint participant reports its checkpoint mode, and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. The pin also brings NVIDIA-NeMo/Gym#4997's renames: the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. NVIDIA-NeMo/Gym#3909 lets checkpointing agents and resources servers run several workers, so the guide drops the num_workers: 1 requirement. Gym's dependencies are unchanged, so uv.lock is too. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…rom discovery Gym main now has NVIDIA-NeMo/Gym#4957: every checkpoint participant reports its checkpoint mode, and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. The pin also brings NVIDIA-NeMo/Gym#4997's renames: the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. NVIDIA-NeMo/Gym#3909 lets checkpointing agents and resources servers run several workers, so the guide drops the num_workers: 1 requirement. Gym's dependencies are unchanged, so uv.lock is too. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…rom discovery Gym main now has NVIDIA-NeMo/Gym#4957: every checkpoint participant reports its checkpoint mode, and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. The pin also brings NVIDIA-NeMo/Gym#4997's renames: the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. NVIDIA-NeMo/Gym#3909 lets checkpointing agents and resources servers run several workers, so the guide drops the num_workers: 1 requirement. Gym's dependencies are unchanged, so uv.lock is too. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…rom discovery Gym main now has NVIDIA-NeMo/Gym#4957: every checkpoint participant reports its checkpoint mode, and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. The pin also brings NVIDIA-NeMo/Gym#4997's renames: the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. NVIDIA-NeMo/Gym#3909 lets checkpointing agents and resources servers run several workers, so the guide drops the num_workers: 1 requirement. Gym's dependencies are unchanged, so uv.lock is too. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…pt Gym's checkpoint names Gym main reports every checkpoint participant's mode (NVIDIA-NeMo/Gym#4957) and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. Gym also settled its checkpoint names (NVIDIA-NeMo/Gym#4997): the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. Checkpointing agents and resources servers may run several workers since NVIDIA-NeMo/Gym#3909, so the guide drops the num_workers: 1 requirement. Main's Gym pin already includes all three. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…pt Gym's checkpoint names Gym main reports every checkpoint participant's mode (NVIDIA-NeMo/Gym#4957) and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. Gym also settled its checkpoint names (NVIDIA-NeMo/Gym#4997): the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. Checkpointing agents and resources servers may run several workers since NVIDIA-NeMo/Gym#3909, so the guide drops the num_workers: 1 requirement. Main's Gym pin already includes all three. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…pt Gym's checkpoint names Gym main reports every checkpoint participant's mode (NVIDIA-NeMo/Gym#4957) and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. Gym also settled its checkpoint names (NVIDIA-NeMo/Gym#4997): the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. Checkpointing agents and resources servers may run several workers since NVIDIA-NeMo/Gym#3909, so the guide drops the num_workers: 1 requirement. Main's Gym pin already includes all three. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unless allowed A restart-only Gym server reports its in-flight rollouts as restarts at every checkpoint, so under target_level='turn' they quietly start over from their tasks after a crash, and nothing told the user. Restart-only is Gym's default for resources servers that declare no checkpoint mode and for agents without checkpoint session support. Before the first rollout, SC reads every Gym participant's checkpoint status: a resources server reports its mode, and an agent reports restart_only (NVIDIA-NeMo/Gym#4957; an agent on an older Gym is not flagged). If any server is restart-only, setup fails and names it, unless the new rollout_recovery.allow_restart_only_gym_servers is true, which accepts it with a warning. Setting it when no server is restart-only warns that it has no effect, and setting it below target_level='turn' is rejected. Each saved rollout snapshot also logs gym_restarted_episodes, the episodes that would start over after a crash, on its save line and as a metric. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
…pt Gym's checkpoint names Gym main reports every checkpoint participant's mode (NVIDIA-NeMo/Gym#4957) and discover() returns it. The restart-only check reads that mode instead of asking every participant for its status again, and no longer depends on an agent status field that never shipped. Gym also settled its checkpoint names (NVIDIA-NeMo/Gym#4997): the policy model's checkpoint_policy moves into a checkpoint block, restored_pending is unclaimed, and control error codes carry a checkpoint_ prefix. RL reads the codes from Gym's error classes; only test fixtures named them. Checkpointing agents and resources servers may run several workers since NVIDIA-NeMo/Gym#3909, so the guide drops the num_workers: 1 requirement. Main's Gym pin already includes all three. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Lets a training framework tell, from discovery alone, whether each checkpoint participant's rollouts can continue after a crash.
An agent that declares
checkpoint_mode = "restart_only"(the default) takes part in checkpoints throughRestartOnlyAgentParticipant. That is the safe default: its in-flight rollouts are reported as restarts and start over from their input after a crash. But its/ng-control/v1/checkpoint/statusreply did not say so. Both agent participants reportkind: "agent", and the only difference was that the session participant also reportsaccepting. Resources servers already report their checkpointmode; agents had no equivalent.So a controller that asks for turn-level recovery could only find out at the first checkpoint, from the restarts it reports, that every rollout of that agent would start over. NeMo RL wants to refuse that configuration at setup unless the user opts in (review on NVIDIA-NeMo/RL#4500).
The change. Every checkpoint participant now declares its checkpoint
mode(restart_only,statelessorexported) next to itskind, and the control plane refuses a participant without a valid one when it is built:modeRestartOnlyAgentParticipantrestart_onlyAgentSessionParticipantexportedEnvironmentParticipantcheckpoint_mode, passed in bysetup_environment_checkpointResourcesParticipantmode, as beforePolicyModelParticipant,CoordinatedPolicyParticipantexportedCoordinatedServerParticipantmode, copied askindisThe status reply reports
modebesidekindrather than instatus_extra(); the resources participant's extras drop themodethey carried, and the reply's shape is otherwise unchanged.discover()reads it from the status reply it already fetches intoParticipant.mode, so a controller can find restart-only servers from discovery alone, with no second round of status calls. Because the coordinator copies the mode, a server with several workers reports it even when no worker answers the status call in time.The agent harness guide notes the field next to
checkpoint_mode.Validation
checkpoint_mode.discover()returns each participant's mode, and refuses a status reply that names none.discover(), ignoring the environment server'scheckpoint_mode, and a wrong agent mode each fail a test.tests/unit_tests/test_checkpoint_{control,coordination,participant_workers,agent,environment,sequences_mixed}.pyandtest_environment_server.py: 317 passed, plus the new environment-server test.responses_api_agents/simple_agent/tests: 77 passed.environment_servers/single_agent_turnonly changes how its tests buildEnvironmentParticipant; it had no local venv, so CI covers it.pre-commit run --fileson the changed files: every hook passes.Rollouts
N/A: this adds a field to the checkpoint control status reply and changes no rollout, verifier or checkpoint behavior.
Compatibility
modefor every participant and lose none of their other fields; a resources server'smodekeeps its key and value.EnvironmentParticipantnow takes a required keywordmode, andcoordination.Participantgains a requiredmodefield.discover()refuses a participant whose status names no mode, so every server in a deployment must run a Gym with this change.Checklist
pre-commit run --all-files) (so CI lint/format checks pass). Run with--fileson the changed files; every hook passes.git commit -s) (so the DCO check passes).🤖 Generated with Claude Code