Repository navigation
feat(cc): support SingleController checkpoint and resume - #4200
Merged
Merged
Conversation
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-capture-redesign-20260914
branch
2 times, most recently
from
September 30, 2026 16:43
083ece0 to
33ad46e
Compare
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-checkpoint-resume-20260918
branch
2 times, most recently
from
October 5, 2026 20:58
6609363 to
1ede30d
Compare
Contributor
Author
|
/ok to test 1ede30d |
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-checkpoint-resume-20260918
branch
from
October 6, 2026 01:18
1ede30d to
72235d7
Compare
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-capture-redesign-20260914
branch
from
October 7, 2026 21:56
c617a2c to
46d9f6a
Compare
This was referenced Oct 15, 2026
aroshanghias-nvd
marked this pull request as ready for review
October 15, 2026 16:21
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-checkpoint-resume-20260918
branch
3 times, most recently
from
October 20, 2026 18:44
c9c1b02 to
63631ae
Compare
Contributor
Author
|
/ok to test 63631ae |
Contributor
Author
|
/ok to test 5039e3d |
Contributor
Author
|
/ok to test a9b7cd9 |
terrykong
reviewed
Oct 27, 2026
terrykong
left a comment
Collaborator
There was a problem hiding this comment.
Re-checked at 93d1e8f. Thanks for the rebase and the fixture fix: the RNG unit test's missing names and the stale forest-guard docs are both fixed, so I dropped those two comments.
Before merge
- Run CI on the head. The last
/ok to testwas for a9b7cd9; two commits landed after it, and only the bookkeeping checks (DCO, copyright, title) ran on 93d1e8f. Please run/ok to test 93d1e8ffa77322304ac649a4743bf112316ec5dc. The RNG change in (C5) touches every Megatron resume, so also confirm the existing resume tests pass:sft_resume_diamond.shandgrpo_checkpoint_single_controller.sh.
Inline comments
- (C2) A resume can run with a different forest mode or forest padding than the checkpoint was saved with. Record both at save time and check them on restore.
- (C3) The
obsolete_emptycheckpoint test passes even with its guard deleted; match on the error message. - (C5) Drop the "Forest recovery" doc subsection. Move its two general lines (the capture-write stop and the RNG change on every Megatron resume) into the main recovery section, and keep the one forest limit (older CC checkpoints can't be resumed) in the context-compaction guide.
- (C6) Low priority: rebuild
RolloutSelectionfrom every saved field. - (C8) Low priority: several new errors name the problem but not the value or rollout behind it. Add what is already in scope (schema found vs. needed,
gate_id, group ID) so a failure can be triaged from the log.
PR description
- "retaining ordinary schema-2/3 recovery support": the code accepts {3, 4} (rollout_recovery.py#L47); schema 2 was not supported at the base either.
- Not mentioned: forest groups now get data retries as well as infra retries, and an unresolved capture acknowledgement now stops ordinary capture runs too (before, it was a retried data error).
- "Megatron policy RNG survive[s] recovery" reads as forest-only. Say that every Megatron resume, for every algorithm, now restores RNG (C5).
- The description no longer links any issue. Add
Closes #4558andCloses #4557. This PR targets #4124's branch, notmain, so GitHub will not close them on merge; close them by hand after #4124 lands.
Follow-up (not blocking this PR)
- The 8-GPU bit-for-bit restart check in the description is good evidence, but no CI test runs a forest save → kill → resume yet. The CC functional script turns checkpointing off (grpo_async_gym_single_controller.sh#L123). Once #4124's Gym pin carries #3368 + #4128, add a context-compaction variant of
grpo_checkpoint_single_controller.sh.
What works well
- The ledger is now the one source of truth for selections (the request-local dict is gone), which is what makes retry and resume possible, and
UnresolvedCaptureAcknowledgementis a clean typed stop. The unit tests are thorough.
Visual explainer: https://terrykong.github.io/gh-pages-poc/terryk/pr-4200-forest-resume.html
Generated by Claude Code
Contributor
Author
|
/ok to test 5fc2fa8 |
Contributor
Author
|
/ok to test a14eed0 |
Contributor
Author
|
/ok to test 00fb150 |
Contributor
Author
|
/ok to test a6f0977 |
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-checkpoint-resume-20260918
branch
from
October 28, 2026 20:45
a6f0977 to
77f5564
Compare
Contributor
Author
|
/ok to test 77f5564 |
Contributor
Author
|
/ok to test 4d4e7dc |
Contributor
Author
|
/ok to test 40a0dbc |
Base automatically changed from
aroshanghias/cc-capture-redesign-20260914
to
main
October 30, 2026 07:31
Persist rollout selections with receipts and reward metadata through retries and cold restart. Restore logical replay ownership with schema-3 compatibility for ordinary recovery and schema 4 for forests. Restore policy RNG during Megatron resume and preserve it across reference-model initialization. Preserve current capture refusal handling, metadata validation, partial batches and setup-time router checks when integrating the foundation. Validate with 1,690 CPU tests covering replay/checkpoint recovery, selection persistence, retries, staging custody, controller setup and RNG handling. Lint and formatting pass; distributed runtime qualification is separate. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Reject incompatible replay settings before restoring rows, including checkpoints with no unfinished groups. Tighten corruption assertions, preserve all saved selection fields, improve recovery diagnostics, and clarify the scope of Megatron RNG restoration. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
aroshanghias-nvd
force-pushed
the
aroshanghias/cc-checkpoint-resume-20260918
branch
from
October 30, 2026 16:29
40a0dbc to
2eb829e
Compare
Contributor
Author
|
/ok to test 2eb829e |
terrykong
approved these changes
Oct 30, 2026
terrykong
enabled auto-merge (squash)
October 30, 2026 20:15
macandro96
added a commit
that referenced
this pull request
Oct 31, 2026
…to 5 Turn-level recovery changes the rollout-recovery ledger's shape: a group records its restore level instead of its recovery granularity, and each attempt records its Gym instance and attempt. Main had meanwhile moved to schema 4 for token-capture receipts (#4124) and schema 5 for forest selections (#4200), so this shape is schema 6. Accepting schema 6 only would fail any run resumed from a checkpoint main wrote; main itself loads schema 2 checkpoints again since #4551. Schemas 2 to 5 now load and are rewritten in the schema 6 shape. A group's recovery_granularity becomes its restore level; the values are the same. Each attempt starts with no Gym turn state, as a new attempt does, because those schemas predate it. An old checkpoint that already carries a restore level, Gym attempt state or the turn level is refused rather than guessed at. Main's per-version rules (receipts before schema 4, the forest selection from schema 5) still apply to the version the checkpoint was written with. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 tasks done
macandro96
added a commit
that referenced
this pull request
Oct 31, 2026
…to 5 Turn-level recovery changes the rollout-recovery ledger's shape: a group records its restore level instead of its recovery granularity, and each attempt records its Gym instance and attempt. Main had meanwhile moved to schema 4 for token-capture receipts (#4124) and schema 5 for forest selections (#4200), so this shape is schema 6. Accepting schema 6 only would fail any run resumed from a checkpoint main wrote; main itself loads schema 2 checkpoints again since #4551. Schemas 2 to 5 now load and are rewritten in the schema 6 shape. A group's recovery_granularity becomes its restore level; the values are the same. Each attempt starts with no Gym turn state, as a new attempt does, because those schemas predate it. An old checkpoint that already carries a restore level, Gym attempt state or the turn level is refused rather than guessed at. Main's per-version rules (receipts before schema 4, the forest selection from schema 5) still apply to the version the checkpoint was written with. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 task done
macandro96
added a commit
that referenced
this pull request
Nov 2, 2026
…to 5 Turn-level recovery changes the rollout-recovery ledger's shape: a group records its restore level instead of its recovery granularity, and each attempt records its Gym instance and attempt. Main had meanwhile moved to schema 4 for token-capture receipts (#4124) and schema 5 for forest selections (#4200), so this shape is schema 6. Accepting schema 6 only would fail any run resumed from a checkpoint main wrote; main itself loads schema 2 checkpoints again since #4551. Schemas 2 to 5 now load and are rewritten in the schema 6 shape. A group's recovery_granularity becomes its restore level; the values are the same. Each attempt starts with no Gym turn state, as a new attempt does, because those schemas predate it. An old checkpoint that already carries a restore level, Gym attempt state or the turn level is refused rather than guessed at. Main's per-version rules (receipts before schema 4, the forest selection from schema 5) still apply to the version the checkpoint was written with. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
yfw
added a commit
that referenced
this pull request
Nov 2, 2026
…kind-advantages Main added rollout recovery schema v4 (token-capture receipts, #4124) and v5 (logical_selection, #4200), so failure_kind moves to schema v6. The ledger still loads v2 to v5, with failure_kind=None. Conflicts kept both sides: failure_kind next to logical_selection in the ledger, SiblingSealResult and both seal calls; infra_failure next to the Forest fields in ReassemblyRequest; the infra metric next to the logical owner counts; the infra sample_mask next to the sampler top-k copy. Main moved row building into _publish_rows, so finalize_group now passes infra_failure in. With forest_training, each segment row takes its rollout's flag, and infra_failure_sample_rate counts rollouts. Tests: the v3 load test is now a v5 load test; the finalizer test sets capture_key, as main's receipts need; a new Forest test checks that the segment rows of a flagged rollout get sample_mask 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
macandro96
added a commit
that referenced
this pull request
Nov 12, 2026
…rest training Turn-level recovery (#4500) continues a restored episode as its next attempt (<rollout_id>-a<N>) and keeps the calls the earlier attempt made, still staged under that attempt's key. Forest training's ownership checks (#4124, #4200) predate this and required every manifest row to be staged under the current attempt's key. So every continued episode that had made a model call before the checkpoint failed with "Forest recovery has foreign staging ownership"; the rollout manager counted a data retry and regenerated the episode from its prompt without logging why. Training stayed correct, but turn (and prefix) recovery saved nothing under forest training. Accept a row staged under the current attempt or an earlier attempt of the same rollout, the rule Gym's rebuild already applies through each carried row's source_capture_key, at all four Forest ownership checks: the recovery ledger, the finalizer request, selected-call planning and logical-row finalization. Rows of another rollout or a later attempt are still refused. Also print each data retry with its error, so a prompt that is silently regenerated shows why in the log. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
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.
CC runs can now resume through the shared SingleController checkpoint path. The recovery ledger persists attempt receipts and selected-call metadata, so restart restores published segment rows and reconstructs unfinished groups without repeating sealed siblings. Logical-owner metadata, execution padding, and replacement reserves survive recovery. Every Megatron training resume, for every algorithm, now loads saved RNG when the parallel layout supports it and preserves it through reference-model and wrapper initialization; fresh runs and PEFT warm starts are unchanged.
This PR targets main and builds on merged #4124. Recovery supports schemas 2 through 5; forest recovery requires schema 5 plus saved forest-mode and execution-padding metadata. Schema 4 contains the renamed capture receipts from #4124, without forest selection. Receipt-free v2/v3 checkpoints remain readable; pre-v4 token-capture receipts are rejected with instructions to restart the rollouts. Restore rejects changes to either setting before replay rows are loaded, including when no unfinished groups remain. Earlier experimental forest checkpoints without the current schema and compatibility metadata require a fresh run; ordinary schema-4 capture checkpoints remain supported. Failed captures may retain empty selections and pending call IDs; healthy empty selections are rejected, and pending calls remain outside attempt cleanup ownership. Forest groups support bounded data retries as well as infrastructure retries, using persisted selection metadata and fresh attempt identities. An unresolved capture acknowledgement now stops ordinary capture runs too, rather than being retried as a data error; uncertain writes are neither cleared nor redispatched.
The refresh preserves mandatory empty replacement-reserve sidecars through the current checkpoint storage helpers and refreshes the worker RNG fixture for current initialization. It also adopts Gym’s
parent_resolutionconfiguration rename. This schema-alignment follow-up does not change dependencies, the Gym pin or the lockfile.Main-merge follow-up at
a6f0977f8: aligned with the refreshed #4124, preserving agent-routing metadata, schema-5 forest state and legacy ordinary recovery. 1,172 Mac CPU tests passed. Focused type, formatting and lint checks passed; the inherited recipe minimize check passed on #4124. No new GPU validation is claimed.Schema-alignment validation at
00fb150d6: 879 CPU tests passed on Mac, including 26 forest-recovery checks, legacy ordinary checkpoints and ordinary schema-4 captured receipts. Focused pinned Pyrefly, formatting and lint checks passed. The stack merge preserves the exact validated source tree.Prior validation: 853 CPU tests passed on the foundation refresh before the configuration rename; the final inherited rename passed 318 focused checkpoint CPU tests. Native TQ continuation exactly matched uninterrupted controls in all four cases: healthy and failed captures at bootstrap and trainer-checkpoint boundaries, with captured media and interrupted publication. Twelve native checkpoint configuration cases also passed.
Eight-GPU trainer validation: model, optimizer, scheduler, and RNG restoration matched exactly. A controlled repeatability check reproduced the next-update divergence with timed Mamba/Triton autotuning (2,262 state-fingerprint differences on the second restart). With kernel choices pinned, both independent restarts matched the uninterrupted next update bit for bit, with zero state or kernel-choice differences. The checkpoint code was identical in both arms; pinning is a private validation setting, not a product change. The inherited parent-resolution rename leaves the tested policy worker, Megatron setup, and runtime pins unchanged. These bounded checkpoint checks are separate from the 20-step harness qualification on #4124 and full repository CI.
Review follow-up validation: 861 CPU tests passed across checkpointing, replay, recovery races, setup, and rollout management. Disabling compatibility validation makes all six mode/padding regressions fail; removing the obsolete-snapshot guard also fails its message-specific test. Both requested GPU resume scripts already belong to the CI:L1 suites; execution on the updated head remains pending.
Closes #4558
Closes #4557