Repository navigation
fix(orchestrator): one rollout-age definition, staleness enforced per episode - #3816
Closed
faresobeid wants to merge 1 commit into
Closed
faresobeid wants to merge 1 commit into
faresobeid wants to merge 1 commit into
Conversation
faresobeid
marked this pull request as ready for review
October 3, 2026 23:02
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 53dcd07. Configure here.
faresobeid
force-pushed
the
fix/single-age-definition
branch
from
October 4, 2026 00:08
53dcd07 to
1596592
Compare
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.

What
One definition of rollout age, and staleness enforced per episode instead of per group.
rollout_age(start_version, step) = (step - 1) - start_version(orchestrator/utils.py, replacesmin_fresh_version): the version batchsteptrains on minus the version the episode was dispatched at. Queue time counts. The dispatcher early cancel, the sink's insertion check and queue sweep,off_policy/*anddispatcher/off_policy/*all read it.Each episode is stamped with its own dispatch version. Before, every member got
group.policy_version_at_start, even members dispatched several versions later (large G with a bindingmax_inflight).policy_version_at_startnow only sets the group's shared prefix-cache salt.Per-episode enforcement
on_version_pendingcallsdrop_group(gid, reason="stale", stale_only=True)for each group with a stale in-flight episode. That cancels only the group's in-flight episodes past the bound; the rest of the group keeps running.drop_groupre-readsinflightat call time, so an episode that completes while an earlier group's cancellation is being emitted is never double-claimed. Withoutstale_onlyit cancels everything the group still owes, as before.stalecancellation no longer voids the group's arrived episodes. The sink keeps several cancellation markers per group and adds up their counts. When the group completes, arrived episodes that are stale themselves are dropped beforefinalize_groupand the curriculum (counted as cancelled, so they show asstalein the discard warning); the rest is scored as usual.Rule for partial groups
A group with dropped stale members is handled like a group with errored or overload-cancelled members today: it is scored from the fresh members that arrived. GRPO with one fresh member gets advantage 0, so zero-advantage pruning removes it. Stale drops remove the slowest members, so the GRPO baseline is taken over a duration-truncated sample (errors and overload cuts already do this). Before, the stale case avoided that by throwing away the whole group, wasting G-1 finished rollouts. This only changes behavior when members of a group start at different versions.
Also
max_off_policy_stepsdocstring,docs/training.md, and theGroupCancellationdocstring describe per-episode dropping.Checks
pytest -m "not gpu" tests/unit/orchestrator tests/unit/test_configs.py: 291 passed.ruff check/ruff format --check: clean.KeyErrorincancel_episodes; this head emits one marker, keeps permits and group accounting consistent, and a later fulldrop_groupfrees the group.Note
Medium Risk
Changes off-policy bounds and partial-group scoring in the orchestrator train path; mis-tuning or edge cases around mixed-version groups could alter GRPO baselines and batch composition.
Overview
Off-policy staleness is now defined and enforced per episode, not per rollout group.
A shared
rollout_age(start_version, step)replaces the old group-levelmin_fresh_versioncutoff. Each episode is stamped with its own dispatch policy version (policy.versionat schedule time); the group’spolicy_version_at_startis only used for prefix-cache salting.Dispatcher: before weight updates, only in-flight train episodes past
max_off_policy_stepsare cancelled via newcancel_episodes; younger siblings and undispatched group members keep running. Full-group abandonment still goes throughdrop_group.Train sink: queue sweeps and group finalization drop individual stale episodes; stale
GroupCancellationmarkers no longer discard the whole group. Multiple cancellation markers per group are summed. Surviving fresh members are scored like partial groups after errors (e.g. GRPO over remaining rollouts).Docs/config and
/pausemode="keep" comments are updated to match freeze-and-resume behavior (not drain).Reviewed by Cursor Bugbot for commit 53dcd07. Bugbot is set up for automated code reviews on this repo. Configure here.