feat(queue): category round-robin dequeue mode (Codex #4)#17
Merged
Conversation
Strict priority order means one busy category (e.g. dozens of test-failures) is drained completely before the loop ever touches a type-error or vulnerability. Add an opt-in round-robin selection mode. - `DequeueMode = 'priority' | 'round-robin'` (types.ts). - `TaskQueue` gains a `dequeueMode` option. Round-robin walks the category ring in priority order starting just after the last-served category, so each category with eligible work gets a turn per cycle; rotation stays fair even when a category empties mid-cycle (advance forward, never restart at the top). Within a category, the highest-priority task is still served first. - Shared `isEligible()` predicate now backs both modes (queued, under maxAttempts, meets the severity floor). - `ImprovementLoopConfig.dequeueMode` (optional, defaults to `priority`) threads through `runLoop`. - `run:a --round-robin` exposes it; the run summary prints the active order. Default behavior is unchanged: omitting the mode keeps strict priority order. Adds queue tests: full-cycle rotation across categories, fair fallback when a category empties mid-cycle, highest-severity-first within a category, and a priority-mode guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Codex review finding #4 — category starvation. With strict priority ordering, one busy category (say, dozens of
test-failuretasks) is drained completely before the loop ever reaches atype-errororvulnerability. This adds an opt-in round-robin selection mode so each category that has work gets a turn.Changes
DequeueMode = 'priority' | 'round-robin'(types.ts).TaskQueuedequeueModeoption — round-robin walks the category ring (priority order) starting just after the last-served category and returns the first eligible task. Rotation stays fair even when a category empties mid-cycle: it advances forward through the ring rather than restarting at the top. Within a chosen category, the highest-priority task is still served first.isEligible()predicate now backs both modes (queued, undermaxAttempts, meets the severity floor from Fix scanner pnpm-prefix bug + add executor safety guards #3).ImprovementLoopConfig.dequeueMode— optional, threaded throughrunLoop. Defaults topriority→ existing callers unaffected.run:a --round-robin— CLI surface; run summary prints the active order.Test plan
New
task-queue.test.tscases:test-failure → type-error → vulnerabilityonce each instead of draining the three test-failures firstcriticalis served beforelowLocal validation:
asil-improvement-loop188 tests,asil-runners65 tests, build + typecheck clean across both packages.