feat(checkpoint): adapt initial stateful environments - #2946
Draft
ananthsub wants to merge 4 commits into
Draft
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 Sep 1, 2026
Contributor
Author
ananthsub
force-pushed
the
ananthsub/checkpoint-environment-adapters
branch
from
September 3, 2026 09:12
5b189df to
a2e92b2
Compare
ananthsub
force-pushed
the
ananthsub/checkpoint-environment-adapters
branch
from
September 3, 2026 11:12
a2e92b2 to
c833582
Compare
This was referenced Sep 9, 2026
Restore Gymnasium, workplace, and counter sessions under replacement attempt identities while preserving resource revisions at agent boundaries. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Require explicit checkpoint opt-in, bind state only after successful session creation, and retire adapter-owned state safely. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Exercise prepare, commit, restore, explicit resume, lineage handoff, resource revisions, and straggler retirement across participants. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
ananthsub
force-pushed
the
ananthsub/checkpoint-environment-adapters
branch
from
September 10, 2026 20:48
c833582 to
91ea76c
Compare
This was referenced Sep 10, 2026
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.
Note
This checkpoint implementation is experimental. Its Python modules live under
nemo_gym._checkpoint; they are not a supported public import surface yet.Summary
What this layer adds
The shared participant in #2945 controls admission, locking, revisions, files, and restore activation. Each environment still needs a codec that translates its own live session object into versioned serializable state. This PR supplies the first concrete adapters and demonstrates several state shapes.
flowchart LR C[Resources checkpoint participant] -->|export frozen session| G[Gymnasium base adapter] G --> B[Blackjack: environment state plus RNG position] C --> S[Session-state example: counter value] C --> W[Workplace Assistant: toolkit DataFrames] B --> M[Versioned ResourceSnapshot] S --> M W --> M M --> D[Controller-provided checkpoint directory] D --> V[Validate complete replacement set] V --> R[Restore sessions under attempt N+1] R --> X[Rebuild execution-to-session mappings]The Gymnasium base deep-copies supported session state and tracks the mapping from
(rollout_id, attempt_index)to the environment session. Checkpoint continuation defaults to disabled and each supported subclass opts in after defining its state contract. Blackjack adds explicit serialization forrandom.Random. The counter example persists its logical value. Workplace Assistant serializes and restores its pandas-backed tool state.Cross-layer recovery test
sequenceDiagram participant C as Checkpoint controller participant M as Policy model participant participant A as Agent participant participant R as Resources participant participant D as Controller-provided directory C->>M: pause and drain accepted generations C->>A: prepare active executions A-->>C: committed boundary or explicit blocker C->>R: prepare bound resource sessions C->>M: retire excluded straggler and commit C->>A: retire excluded straggler and commit C->>R: retire excluded straggler and commit M->>D: model-server lineage manifest A->>D: agent-instance boundary manifest R->>D: resources-server state manifest C->>M: restore attempt N+1 paused C->>A: restore attempt N+1 paused C->>R: restore attempt N+1 paused C->>M: explicit resume C->>A: explicit resume C->>R: explicit resume A->>M: first resumed call with attempt N parent A->>M: later call linked within attempt N+1The test uses production participant and control-route implementations. It proves that the three manifests occupy separate namespaces, source attempts remain fenced, resources revisions survive restore, and the restored-parent relay applies only to the first policy call.
TransferQueuedurability and the training framework's controller remain simulated because they are outside this Gym stack.Stack
Test plan
Remaining integration work
TransferQueuecontracts/runresults belongs to the training-framework integration layerGeneration-safe checkpoint update
Layer validation: 20 tests passed. Full stack validation: 624 tests passed; Ruff and formatting clean.