Draft
Conversation
a0f5e26 to
7109576
Compare
Introduces a scheduler with four layered admission constraints: - Total concurrency: hard global cap on running jobs - Priority tiers: weighted share of total concurrency per tier (Priority struct with Level + Weight) - Per-type limits: fraction of tier slots per job type - Conflict groups: mutual exclusion by group + job ID Within a tier, jobs are ordered by accumulated cost per fairness key (lowest first), with cost estimated via EMA of wall time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7109576 to
98127fc
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.
Summary
Adds a weighted fair queuing scheduler with conflict exclusion. All work (foreground and background) flows through a single scheduler that controls admission via four layered constraints:
Config.TotalConcurrency)Priority.Weight / sum(weights) * total). Higher-level tiers dispatch first, preventing background from starving foregroundJobTypeConfig.MaxConcurrency, 0-1)Within a tier, jobs are ordered by accumulated cost per fairness key (lowest first, then arrival time). Cost is estimated via an exponential moving average of observed wall time.
Includes design doc (README.md), flow diagram (scheduler.svg), unit tests, and a soak test.