Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This was referenced Oct 1, 2026
ananthsub
force-pushed
the
ananthsub/partial-ckpt-gymnasium
branch
from
October 1, 2026 21:53
cf53406 to
b25ea94
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-blackjack
branch
from
October 1, 2026 21:53
6f93202 to
8b4bb07
Compare
This was referenced Oct 1, 2026
ananthsub
force-pushed
the
ananthsub/partial-ckpt-gymnasium
branch
from
October 1, 2026 22:05
b25ea94 to
c1d3223
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-blackjack
branch
from
October 1, 2026 22:05
8b4bb07 to
930c857
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-gymnasium
branch
from
October 2, 2026 13:22
c1d3223 to
8cee79e
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-blackjack
branch
2 times, most recently
from
October 2, 2026 19:43
492a18b to
9a99133
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-gymnasium
branch
from
October 2, 2026 19:43
8cee79e to
dc25a06
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-blackjack
branch
from
October 2, 2026 21:17
9a99133 to
eb5f7f4
Compare
…ckpoints Blackjack declares checkpoint_mode = "exported". Each session's two hands and its random number generator state decide the rest of the game, so export_env_state writes them as JSON and restore_env_state validates them and rebuilds the generator. A restored game deals the same cards and ends with the same outcome as an uncheckpointed game with the same seed. Ported from #2946 onto the v2 checkpoint hooks. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
ananthsub
force-pushed
the
ananthsub/partial-ckpt-gymnasium
branch
from
October 2, 2026 23:32
01cfa55 to
c3fbf5f
Compare
ananthsub
force-pushed
the
ananthsub/partial-ckpt-blackjack
branch
from
October 2, 2026 23:32
eb5f7f4 to
f0c480a
Compare
This branch has not been 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.
ananthsub/partial-ckpt-blackjackananthsub/partial-ckpt-gymnasiumfeature,area:env-infra(draft, so no state label yet)What changed and why
Blackjack is the first Gymnasium environment to opt in to checkpointing. Without it, a live Blackjack game is
restart_only: it blocks a checkpoint until its rollout is retired and replayed from the start.The rest of a Blackjack game depends only on the player's hand, the dealer's hand, and the session's random number generator. Blackjack sets
checkpoint_mode = "exported"and overrides the two Gymnasium hooks:export_env_statewrites both hands and the generator state (random.Random.getstate()) as JSON.restore_env_statechecks that the hands are lists of card ranks, rebuilds the generator withsetstate, and raisesValueErrorfor any malformed state. Nothing is installed if any session is invalid.The Gymnasium base handles everything else: tracking sessions from
/resetto the terminal/step, exporting every live session at commit, and closing a retired session.How it works
Where this PR sits in the overall flow
The highlighted part is what this PR adds.
flowchart LR C["Controller<br/>NeMo RL, or rollout collection"] CO["Coordination<br/>prepare, commit, restore, resume, retire"] K["Control plane on every server<br/>phases, fencing, lease, storage"] subgraph G["One participant per Gym server"] E["Environment server<br/>episode steps"] M["Policy model<br/>held responses, generation cuts"] A["Agent<br/>sessions parked at boundaries"] R["Resources server<br/>session state"] end W["Inference worker<br/>stages cut prefixes"] D[("Checkpoint directory<br/>records, then manifest")] C --> CO --> K K --> E & M & A & R M --> W G --> D classDef this fill:#fde68a,stroke:#b45309,stroke-width:2px,color:#1f2937 class R thisOne checkpoint, a crash, and the restore, end to end:
This PR
The game state that decides the rest of a hand, saved at a checkpoint and restored into a fresh server.
Where this sits in the stack
This PR builds on the partial-rollout checkpointing stack: #3882 (core) through #3889 (end-to-end suite), plus #3893 (rollout collection). It is one of five PRs that port the environments the old stack checkpointed onto the new hooks. Each one is based on #3889 and can be reviewed on its own, except Blackjack, which builds on the Gymnasium fix:
ananthsub/partial-ckpt-workplace-assistant): feat(checkpoint): checkpoint Workplace Assistant sessionsananthsub/partial-ckpt-gymnasium): fix(gymnasium): build Gymnasium servers on the shared resources server setupananthsub/partial-ckpt-blackjack): feat(checkpoint): export Blackjack game state for partial-rollout checkpoints (on the Gymnasium PR) (this PR)ananthsub/partial-ckpt-indirect-prompt-injection): feat(checkpoint): export indirect prompt injection session stateananthsub/partial-ckpt-proof-refinement): feat(checkpoint): continue proof refinement agent turns from their boundariesRelationship to the old stack
Ported from #2946 onto the v2 checkpoint hooks. The old version serialized the same three fields through the Gymnasium base's
serialize_session_stateanddeserialize_session_state, keyed by rollout attempt. Here the state is keyed by the cookie session ID, and restore also validates the hands and turns a bad generator state into a clear error.Issue
No separate issue. This is the Blackjack part of the partial-rollout checkpointing port.
Validation
RAY_TMPDIR=/tmp python -m pytest -q resources_servers/blackjack/tests: 23 passed (16 existing, 7 new). The new tests drive a checkpoint-enabled server through its control routes:RAY_TMPDIR=/tmp python -m pytest -q tests/unit_tests/test_checkpoint_*.py resources_servers/gymnasium/tests responses_api_agents/gymnasium_agent/tests: 145 passed.ruff check,ruff format, andpre-commit run --fileson the changed files.Rollout evidence
Pending. Before marking ready: run Blackjack rollouts through
gymnasium_agentwith a real model and checkpointing on, with a checkpoint taken mid-game and a restore into a fresh process, and confirm the continued games finish normally. The process-level checkpoint e2e suite does not cover Gymnasium environments yet.Compatibility