{"slug": "a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on", "title": "A guard that has never fired and a guard that stopped running look identical on disk", "summary": "A developer fixed an anchor-drift detector that failed to log sub-threshold bias shifts, making a silent detector indistinguishable from a dead one. The fix logs every computed shift unconditionally, so the threshold gates only alerts, not data. The change was prompted by a reader's comment and shipped in 52 minutes.", "body_md": "A guard that has never fired and a guard that stopped running look identical on disk. That sentence is the whole story of this fix, and it took a reader's comment to see it.\n\nOur anchor-drift detector watches whether the tokenizer silently changed under an unchanged base URL — the failure mode where your cost projection keeps using the old provider's numbers while the real prompt_tokens drift away. It has a threshold (25%), and it had never fired. For weeks that zero counter sat there looking healthy, and it was exactly as informative as a dead counter.\n\nWe had already learned the sibling lesson one level down: the anchor_loss event proved the write path was alive — 45 events, each one showing the writer runs, the file is reachable, the path is live. So \"hasn't fired\" was a measurement, not an assumption. But the detector's own output had no equivalent. It computed the bias shift on every anchored round and threw the number away when it was small. Sub-threshold spread — \"is normal drift 5% or 20%?\" — was invisible by construction. The only data we owned about the guard was the day it decided to scream.\n\nThen the reader replied to the drift postmortem with the obvious-in-hindsight version: \"You compute the shift on every round already. You just throw it away when it's small. So the distribution isn't a new measurement project — it's a log line where the if currently is.\"\n\nThe timeline, this time:\n\n52 minutes from issue to merged fix. The first time this loop ran it took 50. Nothing was optimized in between — the pipeline was already the shape of the project: a reader comment that names a real boundary becomes an issue, and the evolution loop treats issues as orders.\n\nWhat shipped: the detector now logs every computed shift, unconditionally. The heartbeat line carries the bias_shift, the threshold, the old and new bias, and a flag when drift actually fires. The threshold only gates the alert, not the data. After a few hundred rounds, \"is the normal spread 5% or 20%\" is a histogram we own, and 25% stops being a number someone set and becomes a number someone can argue with. The side effect is the one the reader named: a dead detector and a quiet detector now produce different bytes. Silence is no longer ambiguous.\n\nThe tests assert the heartbeat in both states — drift and no-drift — so the planted-fire path is provable at the unit level.\n\nThe honest boundary: the full planted-fire test — a scheduled synthetic provider swap that enters through the same door as a real one, with \"last planted fire\" and \"last real fire\" dates on the dashboard — isn't in yet. What landed is the test-level assertion and the unconditional log. The production schedule can hang off the heartbeat line when it's ready.\n\nThree lessons, generalized:\n\nFifty minutes. Then fifty-two. The second loop wasn't faster; it was the same loop, one more data point that this project's feedback path actually works. That's the guard that matters most.", "url": "https://wpnews.pro/news/a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on", "canonical_source": "https://dev.to/pm25coder/a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on-disk-177f", "published_at": "2026-08-29 22:23:50+00:00", "updated_at": "2026-08-29 22:48:46.230078+00:00", "lang": "en", "topics": ["developer-tools", "mlops"], "entities": [], "alternates": {"html": "https://wpnews.pro/news/a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on", "markdown": "https://wpnews.pro/news/a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on.md", "text": "https://wpnews.pro/news/a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on.txt", "jsonld": "https://wpnews.pro/news/a-guard-that-has-never-fired-and-a-guard-that-stopped-running-look-identical-on.jsonld"}}