From e76a55abdf046707475cb29f8fd56009128de3ef Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Tue, 25 Aug 2026 00:49:24 -0600 Subject: [PATCH] fix(distill): a stale READY marker no longer blocks the lane forever MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tools/distill_scan.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/distill_scan.py b/tools/distill_scan.py index 9212191cc..06d459876 100644 --- a/tools/distill_scan.py +++ b/tools/distill_scan.py @@ -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"