fix(scan): report requests the reserve held back as unasked, not failed

The measured-cost run left 99 taint requests unasked to keep time for
arbitration and reported them as `query_failed` -- an engine that could not
answer -- because they were simply missing from the answer. They are now
`query_budget_reserved`, both as a degradation and as each question's outcome
reason, and are no longer double counted when nothing answered.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
Marius Ciepluch
2026-09-23 08:51:12 +02:00
co-authored by Claude Opus 5.5
parent 1b28465a61
commit d930f5bc69
3 changed files with 37 additions and 4 deletions
+18
View File
@@ -1350,3 +1350,21 @@ def test_the_queue_re_asks_a_killed_remainder_and_terminates() -> None:
# It must stop: "hard" is asked, dropped once it is alone, and never re-queued forever.
assert len(attempts) < 40, len(attempts)
assert attempts.count(["hard"]) <= 1, attempts
def test_requests_held_for_arbitration_are_reported_as_unasked() -> None:
"""A request the reserve kept back was never asked; it must not be counted as an engine failure."""
from openultrasast.model import scan
calls: list[list[str]] = []
def once(kind: str, requests: dict[str, dict[str, object]]) -> dict[str, list[object]] | None:
calls.append(list(requests))
return {"__census__": [], **{rid: [] for rid in requests}}
weights = {f"r{i}": 600 for i in range(4)}
held: list[str] = []
budget = iter([True, False])
merged = scan._batched(once, "taint", {rid: {} for rid in weights}, weights=weights, within=lambda: next(budget, False), unasked=held)
assert merged is not None and len(calls) == 1
assert sorted(held + calls[0]) == sorted(weights), (held, calls)