queue.py hold probes the command's process tree from /proc every poll (standstill.py): the descendants by parent link plus every process still in the command's session, their CPU ticks, rchar/wchar/read_bytes/ write_bytes and the process set. Unchanged for HUNG_SECONDS (3600) it records the stuck processes (pid, comm, state, wchan; never a command line), SIGTERMs the tree and the sessions its members lead, waits KILL_GRACE_SECONDS while recording what appears, SIGKILLs the rest on every pass and exits 124. A tree running docker, podman or ssh, or with a stopped member, is never judged. The history row carries the probe as `hung`, learn() skips such rows, and list marks an active job past three times its longest learned run (at least 30 min) `suspect hung`. Residual: a process that setsids out of the tree and every recorded session between two passes escapes; only a subreaper or a cgroup per job would hold it. 🎯 Fix: 90 % 💥 Break: 5 % 💸 Tokens: 104 % ⏱️ Velocity: 100 % 🛡️ Security: 100 % 🏆 Score: 82 🚦 Gate: ⚠️ tokens 104 % > 100: operator approved the commit (2026-11-15) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.0 KiB
Queue history and learning
Every finished job appends a row (signature such as <repo>: make <target>,
kind, minutes, disk, RAM and CPU) to queue-history.jsonl; the
kvb-org-organize watch hook keeps it across reboots. The row of a run
hold ended for standing still (exit 124, a hung probe) teaches nothing.
From the last 30 days, once 5 runs exist:
- per job, the disk need is p90 disk taken plus 1 GB over the runs of its signature and kind; until 5 exist there, the largest such need its signature and the command's older signature learned over every kind;
- per kind, the slot limit is how many p90 RAM and median CPU shares fit
between the median load at the grant and
load_limits, at least 1; - per job, the footprint is its signature's share over the runs of its kind; until 5 exist there, the largest of its kind's share and what its signature and the command's older signature learned over every kind.
A job of a kind outside light_kinds never books less than the queue before
the per-kind learning: at least the share its older signature learned over
every kind, else its kind's, and at least that signature's disk need once
learned. Only light kinds learn lower.
A pytest or unittest signature counts what the run names and its xdist
workers (pytest files=1, pytest paths=2 workers=auto), so one test file
never learns from a suite; the older signature is <repo>: <command signature>, which older rows carry. A granted job keeps the footprint it
was granted on.
Until then the seeds hold: slot_need_gb[kind] for disk, 1 slot per kind,
the whole budget as footprint.
The optional slot_limits {kind: N} only caps a limit from above.
The optional ram_cap_percent {kind: percent} caps the RAM share a job of
that kind books, its footprint and its ceiling, while the learned shares and
the history rows stay raw; keep it truthful by limiting the job's own memory
to that share, such as a container memory limit. A waiting hold keeps the
code it loaded: hold it again after an install so it books with the cap.