fix(distill): a stale READY marker no longer blocks the lane forever

A marker is a CLAIM on work, not a record of it. axbm.json sat in .run/distill_ready
for 10.5 hours AFTER its waves were distilled into cookbook §269 — the reviewer landed
the sections, updated the mined state, and never removed the marker — and distill_scan's
one-pending-marker-at-a-time rule (correct, it stopped eight overlapping batches) then
refused to raise anything while 18 waves / 315 novel candidates accumulated behind it.

The marker's own waves are checkable against the mined state, so check them: a marker
whose every wave is already mined clears itself and says so. Negative control (R39): a
marker naming any still-unmined wave survives untouched.

Same family as R47 — a stage that consumes work must also consume the token that
represents it.
This commit is contained in:
Drew T
2026-08-25 00:49:24 -06:00
parent 75bfb04226
commit e76a55abdf
+14
View File
@@ -50,6 +50,20 @@ def main():
# the lane wrote a fresh, overlapping marker every five minutes — eight batches queued
# (`bobq`, `bebobq`, `bebjbobq`, …), each a superset of the last, and a reviewer cannot tell
# which one is the work. The next pass will re-offer whatever is still unmined anyway.
# A MARKER IS A CLAIM ON WORK, NOT A RECORD OF IT (P31 S60). A reviewer who distils a batch and
# forgets to remove its marker blocks the lane forever: `axbm.json` sat for 10.5 h AFTER its
# waves were mined into cookbook §269, while 18 waves / 315 candidates piled up behind it. The
# marker's own waves are checkable against `mined`, so check them — a stale claim clears itself.
for mk in sorted(glob.glob(os.path.join(ready_dir, "*.json"))):
try:
waves = json.load(open(mk)).get("waves", [])
except Exception:
continue
if waves and all(t in mined for t in waves) and not any(t == p_t for p_t, _n, _p in pend for t in waves):
os.remove(mk)
print(" cleared a stale marker (%s): every wave in it is mined"
% os.path.basename(mk))
already = glob.glob(os.path.join(ready_dir, "*.json"))
if already:
print(" a batch is already pending review (%s) — not raising another"