Repository navigation
feat: pause episodes instead of cancelling on overload - #4807
Open
mikasenghaas wants to merge 5 commits into
Open
mikasenghaas wants to merge 5 commits into
mikasenghaas wants to merge 5 commits into
Conversation
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 901f3a0. Configure here.
When the concurrency controller sheds load (a queue still above 50 % after a drained trim, or a third throughput drop), the dispatcher now pauses the youngest groups' episodes instead of cancelling them. A paused episode sends no new model call, gives back its permit and keeps its progress; paused episodes resume, oldest pause first, before any new episode is admitted. The env worker pool routes a new `pause` request to the worker holding the run, which flips the episode's verifiers `Pause`. The controller's cancelling tier is renamed to shedding, and `overload` is no longer a group cancellation reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump verifiers to stop the box of a paused episode at a memory checkpoint until the episode resumes, so a long pause holds no sandbox compute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pause the worker did not apply (its run was still on the wire) left the episode running without a permit; a resume that failed left it paused on the worker while its group waited for it. Now a missed pause takes its permit back, a pause whose answer was lost is undone with a resume, and a resume is repeated until the worker answers. Paused time no longer counts toward the generation lifetime that the trainer target derives from. Bump verifiers for its review fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pause that missed or lost its answer took the permit back and queued a resume even when a later resume or pause for the same episode was already queued, undoing it. Recover only when no later message follows: a later one sets both the dispatcher's count and the worker's state. Bump verifiers for its review fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mikasenghaas
force-pushed
the
feat/pause-dont-cancel
branch
from
December 3, 2026 21:10
13e1a2d to
390361e
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Summary
Dispatcher.pause_inflight). Shedding happens when a queue is still above 50% after a drained trim, or after a third throughput drop.resume_paused).pauserequest goes throughEnv.pause→EnvClient.pause→ pool → worker, to the worker that holds the run. The worker flips that episode's verifiersPause(feat: pause an episode's model calls verifiers#3284). A pause that arrives before the run's slot exists still applies.QUEUE_SHED,trim(shed=)), andoverloadis no longer a group cancellation reason.dispatcher/paused/train.docs/inference.mddescribes the pause.deps/verifiersto feat: pause an episode's model calls verifiers#3284.Verification
ScaleSWE A/B on Qwen3.6-35B-A3B (
recipes/qwen3.6-35b-a3b/rl.toml+gpu/h200.toml+data/swe.toml, no evals), with the box stop of PrimeIntellect-ai/verifiers#3284. Each arm ran on 1 trainer node + 1 inference node, and both arms ran at the same time. To force an overload, both arms started withinitial_inflight = 1024, about 3x the knee this setup settles at. A bench-only patch (not in this PR) made the controller's first queue trim take the shed tier. The controller climbed to about 1,500 episodes in flight and then cut to about 200 in both arms, 90 s apart. Both runs stopped about 97 min after the cut.main)--- config: themeVariables: xyChart: plotColorPalette: "#257de0, #f47230" --- xychart-beta title "Trainer batches finished after the overload cut" x-axis "Minutes since the cut" [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100] y-axis "Batches" 0 --> 10 line [0, 1, 1, 2, 3, 4, 4, 5, 5, 6, 7] line [0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9]--- config: themeVariables: xyChart: plotColorPalette: "#257de0, #f47230" --- xychart-beta title "Shed episodes that finished (of ~1,300)" x-axis "Minutes since the cut" [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100] y-axis "Episodes" 0 --> 1400 line [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] line [0, 81, 303, 522, 663, 843, 1083, 1209, 1253, 1272, 1282]Blue: cancel (
main). Orange: pause (this PR).--- config: themeVariables: xyChart: plotColorPalette: "#257de0, #f47230, #00b894" --- xychart-beta title "Sandboxes after the cut (about 1,450 running before it in both arms)" x-axis "Minutes since the cut" [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95] y-axis "Sandboxes" 0 --> 1300 line [190, 211, 217, 218, 215, 253, 258, 258, 258, 275, 291, 296, 297, 297, 256, 259, 255, 225, 223] line [194, 207, 218, 223, 194, 168, 194, 195, 204, 220, 222, 205, 196, 171, 169, 148, 147, 169, 177] line [1206, 1098, 948, 807, 706, 628, 532, 468, 372, 248, 128, 40, 0, 0, 0, 0, 0, 0, 0]Blue: running, cancel. Orange: running, pause. Green: stopped at a memory checkpoint, pause. The stopped boxes hold no compute and keep their episodes' progress.
What the A/B shows:
max_staleness = 16, so no token was masked. Under a tighter bound, the oldest resumed tokens would be masked.An earlier run without the box stop (boxes of paused episodes kept running) gave the same picture: 2.99M against 2.31M tokens per trained step, and the 7th batch at +90 against +72 min.
Unit tests:
tests/unit/orchestrator/test_concurrency.py, including the newtest_overload_pauses_the_youngest_groups_and_resumes_them_first. They were run as plain functions on the login node; CI runs the full suites.🤖 Generated with Claude Code
Note
High Risk
Changes overload recovery, permit accounting, and env-worker RPC ordering for in-flight rollouts—core scheduling under load—with behavior that affects trainer throughput and staleness.
Overview
Overload shedding no longer drops train groups: the concurrency controller’s
on_overloadhook callsDispatcher.pause_inflight, which pauses the youngest in-flight train episodes, releases their permits, and laterresume_paused(oldest first) before admitting new work. Paused time is tracked (paused_s) so trainer sizing ignores it, anddispatcher/paused/trainis exposed as a gauge.A full pause/resume wire path is added (
PauseRequest/PauseResponse, env pool routing like cancel, workerPauseonRunSlot,EnvClient.pause/ multi-replica routing). Terminology shifts from cancel to shed (QUEUE_SHED,trim(..., shed=)), andoverloadis removed as aCancelReason.Docs in
docs/inference.mddescribe pause semantics (progress kept, no new model calls, permit returned). Tests rename shed expectations and add dispatcher pause/resume edge-case coverage.Reviewed by Cursor Bugbot for commit ebd1852. Bugbot is set up for automated code reviews on this repo. Configure here.