Repository navigation
feat(orchestrator): checkpoint queued samples and open train groups with the dataset cursor - #3970
Open
faresobeid wants to merge 11 commits into
Open
faresobeid wants to merge 11 commits into
faresobeid wants to merge 11 commits into
Conversation
…th the dataset cursor
faresobeid
marked this pull request as ready for review
October 10, 2026 17:06
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b2b4a96. Configure here.
… the main loop starts
faresobeid
added a commit
that referenced
this pull request
Oct 17, 2026
…-replay (#3970) into feat/payload-resume-filter
faresobeid
added a commit
that referenced
this pull request
Oct 17, 2026
# Conflicts: # src/prime_rl/orchestrator/orchestrator.py
…out, outside the curriculum
faresobeid
added a commit
that referenced
this pull request
Oct 24, 2026
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.

The orchestrator checkpoint now saves queued samples and open train groups together with the train-source cursor, so a resume does not lose them.
Why
On main,
progress.ptholds only progress and train-source state. A resume loses accepted samples queued for the next batch, the finished rollouts of open groups, and the groups themselves; the sampler has already moved past their tasks, so those tasks are silently skipped.What
progress.ptalso holds the train sink's state, in one file with the cursor:pending_batch:TrainingSamples plus aQueuedTracerecord each (env, dispatch policy version);out_q(kept inemitted_train_groupsuntil the sink consumes them).pending_batch, the staleness sweep runs against the resumed step, and a full batch ships as soon as the main loop starts.max_off_policy_steps(min_fresh_version, same rule as the queue sweep).TrainSource.resumedasks the dispatcher for the missinggroup_size - keptmembers (same task, same group id) before any new task; pending resume requests are saved too.process_batchsorts the queue oldest-first byQueuedTrace.policy_start(stable; a group stays together) before cuttingbatch_size, so the overflow is the youngest traces, with the most staleness budget left.out_qresults (regenerated).Validation
test_train_sink_resume.py: resume-time staleness drop;test_resumed_group_scores_only_members_within_max_off_policy_steps: scoring of a resumed group.pytest tests/unit/orchestrator tests/unit/test_configs.py tests/unit/utils -m "not gpu"on current main: 418 passed.ruff check,ruff format --checkanduv lock --checkare clean.ckpt.interval=5, SIGKILL ofrlright after v9, thenrl --resume(not rerun after the main merge):Resuming with 0 queued traces and 6 open groups (6 finished episodes kept), trained to v14.3 open groups (1 finished episodes kept), trained to v14.Related
progress.pt, its completeness marker.ckpt.py,train_sink.py).Note
Medium Risk
Changes orchestrator resume semantics and batch assembly (staleness, group scoring, checkpoint I/O); incorrect state could skip work or ship wrong off-policy data, but behavior is guarded by existing
max_off_policy_stepsrules and new tests.Overview
Orchestrator checkpoints now persist in-flight training work alongside progress and dataset cursor state, so
--resumeno longer drops queued samples or partially finished rollout groups.progress.ptgains atrain_sinkblob: compiled samples inpending_batch, per-traceQueuedTracemetadata (env, dispatch policy version), and open train groups (env, task, finished episodes as JSON). Saves usesnapshot_state()on the event loop and async thread pickle with fsync + atomic rename. On load, queued traces are restored (and can ship immediately), stale members are dropped permax_off_policy_steps, andTrainSource.resumedre-dispatches missing rollouts for saved groups before new tasks. The dispatcher tracks fully emitted but not yet consumed groups viaemitted_train_groups; the sink sorts the batch queue oldest policy version first and scores resumed groups only on members still fresh enough.Docs in
training.mddescribe resume behavior; unit tests cover resume staleness and mixed-version group scoring.Reviewed by Cursor Bugbot for commit 7e5b946. Bugbot is set up for automated code reviews on this repo. Configure here.