Skip to content

feat(queue): category round-robin dequeue mode (Codex #4)#17

Merged
telivity-otaip merged 1 commit into
mainfrom
feat/category-round-robin
Jun 18, 2026
Merged

feat(queue): category round-robin dequeue mode (Codex #4)#17
telivity-otaip merged 1 commit into
mainfrom
feat/category-round-robin

Conversation

@telivity-otaip

Copy link
Copy Markdown
Collaborator

Summary

Codex review finding #4 — category starvation. With strict priority ordering, one busy category (say, dozens of test-failure tasks) is drained completely before the loop ever reaches a type-error or vulnerability. 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).
  • TaskQueue dequeueMode option — 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.
  • Shared isEligible() predicate now backs both modes (queued, under maxAttempts, meets the severity floor from Fix scanner pnpm-prefix bug + add executor safety guards #3).
  • ImprovementLoopConfig.dequeueMode — optional, threaded through runLoop. Defaults to priority → existing callers unaffected.
  • run:a --round-robin — CLI surface; run summary prints the active order.

Test plan

New task-queue.test.ts cases:

  • a full cycle visits test-failure → type-error → vulnerability once each instead of draining the three test-failures first
  • fair fallback: after a single-item category empties, rotation continues forward and later returns the leftover top-category task
  • within a category, critical is served before low
  • priority mode (default) still drains the top category first

Local validation: asil-improvement-loop 188 tests, asil-runners 65 tests, build + typecheck clean across both packages.

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>
@telivity-otaip telivity-otaip merged commit 0f8a257 into main Jun 18, 2026
2 checks passed
@telivity-otaip telivity-otaip deleted the feat/category-round-robin branch June 18, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant