Live E2E stand: the handbook states the wait-then-refuse admission rule

docs/DEVELOPMENT.md still described the retired contract ("halts scheduling
at the first refusal"); it now states the per-attempt rule the runner
implements (wait while blocked only by reservations in flight, refuse only
what can never fit, manifest keys refusals/first_refused). The RunBudget
docstring names the non-FIFO fairness policy and the on_wait-under-lock
contract the reviewers asked to pin.

Co-authored-by: Ouroboros <311266734+ouroboros-agent@users.noreply.github.com>
This commit is contained in:
Ouroboros 2026-09-05 14:33:49 +00:00 • committed by Anton Razzhigaev
parent 88509e2cea
commit 2f6d6e59c2
2 changed files with 10 additions and 5 deletions

View file

@ -309,7 +309,10 @@ class RunBudget:
def admit(self, job: tuple, root_tasks: int, data_root: pathlib.Path, *,
on_wait: Callable[[str], None] | None = None) -> tuple[bool, dict]:
"""``(admitted, facts)`` — blocks while the attempt cannot fit YET (``on_wait`` is told
"""Admission is not FIFO: a waiting large reservation can be leapfrogged by smaller
attempts admitted from other lanes and may end refused after waiting (bounded: spend only
grows and the job list is finite; cap-safe at every admission). ``on_wait`` runs UNDER the
budget lock — it must not touch the budget itself. ``(admitted, facts)`` — blocks while the attempt cannot fit YET (``on_wait`` is told
once, with the numbers, when the wait begins); ``facts["waited_sec"]`` is how long."""
need, name, waited_from = self.reservation(root_tasks), f"{job[0]}_a{job[1]}", None
with self._lock: