fix(kvb-org-queue): only load the queue causes holds heavy jobs behind an exclusive one, so host load no longer starves them all

0ba6e15 made every non-light job wait behind an exclusive entry that live load holds, 'from the queue or outside it'. Under a load outside the queue that never drops (test_queue_replay's ram45: 45 % RAM used, so a quality-high with its 41 % share never fits under 85 %), the exclusive entry never starts and nothing heavy behind it does either: 70 jobs starved and the mean wait rose from 181 s to 1170 s. loaded_exclusive() now skips an Outside reason: such an entry stays out with the queue empty, so holding others back cannot help it. Once that load drops, the jobs then running turn its reason into the queue's own, the hold applies, and the entry starts when they end, so the starving head of 0ba6e15 (r12) stays covered.

test_queue r4: the two asserts on an Outside reason expect their pre-0ba6e15 verdicts again (the heavy job and the twin pass); r5, r12 and the queue-caused r4 asserts keep the hold.

Tests on the staged bytes (operator-approved runs): test_queue_replay.py 7 passed, 19 subtests (ram45 included; it failed in the full suite on the prior HEAD); test_queue.py 129 passed, 283 subtests.

Security: MEDUSA over the 7 files of the four fix bundles on master: 100, all covered, 0 open findings.

🎯 Fix: 95 %
💥 Break: 3 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-22 23:31:55 +00:00
1 parent 056bc35d69
commit b5cfa6e2c1
2 files changed
+14 -10

No files matched your search

+11 -7
View File
@@ -706,9 +706,9 @@ def evaluate(entries: list[dict], free_gb: float, floor: float, stage: str, memo
hotfix head, and behind any head whose kind is exclusive or that live
load holds while queue jobs run; light ones wait too while load the
queue causes holds a hotfix head. Behind an exclusive entry that only
live load holds, from the queue or outside it, head or not, no later
entry but a light one starts (loaded_exclusive()): it would keep that
entry out once the load drops. An entry never passes an active,
load the queue causes holds, head or not, no later entry but a light
one starts (loaded_exclusive()): it would keep that entry out once the
load drops. An entry never passes an active,
granted or waiting entry enqueued before it that shares one of its
claims (claims(): worktree, compose stack, slot): those form its
line, which runs by enqueue time alone (in_lines()), never by rank,
@@ -870,11 +870,15 @@ def loaded_exclusive(able: list[dict], verdicts: dict[str, str | None], loaded:
"""Returns:
The id of the first entry of able (blocked, not unstartable()) whose
kind is exclusive and that only live load holds back (its verdict is
its loaded reason), whether the queue or something outside it causes
the load; a job of a kind that is not light, started now, would keep
it out once the load drops (alone_reason()). None when there is none.
its loaded reason), the queue's own jobs causing that load; a job of
a kind that is not light, started now, would keep it out once they
end (alone_reason()). None when there is none. An Outside reason
never counts: the entry stays out with the queue empty, so holding
others back would only starve them while that load lasts, and once
it drops, the jobs then running turn the reason into the queue's.
"""
return next((e["id"] for e in able if e["kind"] in exclusive and e["id"] in loaded and verdicts[e["id"]] == loaded[e["id"]]), None)
return next((e["id"] for e in able if e["kind"] in exclusive and e["id"] in loaded and not isinstance(loaded[e["id"]], Outside)
and verdicts[e["id"]] == loaded[e["id"]]), None)
def drained(order: list[dict], verdicts: dict[str, str | None], drain: str | None, could: set[str],