5,003 deliveries. 5,000 records. Three extra.
In a streaming system whose entire pitch is the store is the truth, that's the scariest output a test can produce. Three duplicate deliveries means somewhere, something sent twice. It means exactly-once is once-short. My first annotation in the field test log was: real defect — duplicate deliveries.
The root cause turned out to be three records I put there myself. And the part I want to keep from this isn't the bug — it's that the gate flagged a genuine inconsistency, and the inconsistency was in my test's fence, not the product's.
This is from the agentwatch v0.2.1 release — the agent-security tool in agentic-suite. Full forensics in the v0.2.0 field test report.
What the soak does
The case is FT-STR-2, the drop-consumer reconciliation. The scenario it models is the one that actually keeps streaming systems honest: the consumer — the thing watching the record stream — dies mid-stream. Crashes, loses its place, comes back. What did it miss?
The test streams 5,000 events through the live tail, kills the consumer partway, lets the store keep ingesting, restarts, and then reconciles: what the consumer was told it received versus what the store actually holds. If those diverge, the operator's view is lying about the record. That's the whole trust proposition.
The original assertion on this case was comfortable:
delivered >= records # "no store loss" — the consumer saw everything
Fine as far as it goes. Also — as the hardening pass immediately demonstrated — not the actual contract.
The stricter gate was already in the product
The product has its own reconciliation predicate, within_bounds. Not delivered >= records. delivered == records. Exactly. Because for this store, "I delivered more than I hold records for" isn't a success condition — it's an accounting error. Deliveries that exceed records mean something is being counted that was never recorded, which is a different way of saying the same lie the store exists to prevent.
So the hardening pass did the simplest, most correct thing: throw out my lenient reading and assert the product's own gate.
It went red on the first run. delivered=5003, records=5000, within_bounds=False.
Three records, ambient
The 5,000 test events were all accounted for. The three extras were the daemon's attestation records — the recorder periodically writes "I am the recorder, here's my state" entries into the store it owns. Three of them landed in the store during the soak window.
And the soak wasn't soaking against a store the test owned. It was pointed at the recorder's live store — the real one, with the real daemon writing into it. The delivery count swept up everything the store knew about, which was 5,000 test events plus 3 attestations.
Same class of failure, three times in one hardening week:
| Case | Looked like | Was |
|---|---|---|
| FT-STR-2 | duplicate deliveries (product bug) | soak ran against a shared, ambient store |
| compliance report | nothing written (product bug) |
--out writes a file; my driver globbed it as a directory |
| OTel join | zero joins (product bug) | the fixture is OTel-only — no hook records exist to join |
Two of three, the harness. One pattern: the test environment asserting about state it didn't exclusively own.
The fix, and the retraction
The soak now runs against a fresh temp store it creates and owns — no daemon writing into it, no ambient records, nothing in it that the test didn't put there:
delivered=5000, records=5000, within_bounds=True
Deterministic. Re-run, green — for a reason this time.
And the field test log did something I now consider non-negotiable: it recorded the retraction explicitly. The running-fixes log shows FT-STR-2 first as real defect — duplicate deliveries, then reclassified: harness artifact, not a product defect. Both entries stayed in the report. A defect classification is a hypothesis; root cause is allowed to move it; the journal keeps both so the next reader knows how the reasoning went.
tip: if your test asserts a count against shared state, you haven't written a test — you've written a race with extra steps. Count only against state you created.
Why I keep saying the gate was right
The tempting narrative is "false alarm, waste of time." That's the wrong read, and I want to be precise about why.
within_bounds did exactly its job: it flagged a real inconsistency between deliveries and records. The inconsistency was in the test setup — but it was real, it was material, and under the lenient >= reading it had been passing silently the whole time. The strict gate didn't cry wolf. The strict gate found the first wolf available, and the wolf happened to be standing in my own doorway.
If the ambient records had been fewer records instead of more — if the daemon had rewritten or compacted the store mid-soak — the same fence would have caught that too. The gate doesn't know which side the error is on. That's what makes it a gate rather than a cheerleader.
There's a companion piece in the first season of this series — a soak that found a daemon dropping records behind an O(n) lock. Same instrument, opposite direction: that one caught a real product defect, this one caught a test defect. Two soaks, two verdicts, same lesson both times — the soak doesn't tell you where the problem is. It tells you the books don't balance. The classification work after that is yours.
What I keep from this
- Soak against a store you own. Shared state isn't realism, it's ambient noise with a deadline attached. A fresh temp store made the test deterministic and meaningful in one move.
-
Assert the product's own correctness gate, not a laxer reading of it.
>=had been passing forever.==failed in ninety seconds. The stricter predicate wasn't harder to write — it was just the one the product actually promises. - Classify before you fix. Product defect vs. harness artifact vs. test-environment contamination are three different work items, and only one of them touches the product. Two of my three reds that week wanted zero product changes.
- Retract loudly. The report keeps the wrong classification and the right one, in order. A field test journal that never admits a reclassification is a journal that's editing for optics.
All of it shipped in agentwatch v0.2.1 — on PyPI.
The question worth taking to your own reconciliation tests: what state does your count run against, and did you create all of it? If you can't answer that in one sentence, your next "impossible" failure mode is probably already scheduled.
References
- Release: agentwatch v0.2.1 on GitHub · on PyPI
- v0.2.0 field test report — FT-STR-2, the running-fixes log with the reclassification, and the hardening campaign
- The soak:
stream-probe.py— now runs a fresh temp store - The product's own gate:
within_bounds— exact reconciliation,delivered == records - Season 1 companion: the lock-starved daemon — 02 — My Daemon Dropped 1,000 Records and Reported Success
- Suite: agentic-suite — the full set of agent-security tools
Top comments (5)
The fresh store fixes the count, but it also removes the only writer production always has: the recorder appending its own attestations while the consumer is down. Tagging the soak's 5,000 events with a run id and reconciling only that run keeps the test deterministic without making the store quieter than it ever is in real life.
You've read the trade exactly. The fresh store bought determinism by deleting a writer that is always present in production — the recorder appending its own attestation records — so the test got quieter than reality. Run-scoped tagging is the more faithful fix: keep the live store, tag the soak's 5,000 events with a run ID, and reconcile only that run. Same determinism, without removing the noise that caused the original confusion. That's the direction I want to take it. Thanks for naming it precisely.
A count of 5,000 on each side could still hide one missing event and one duplicate. I'd add a negative fixture with exactly that shape: keep the totals equal, replace one delivered event ID with a second copy of another, and require reconciliation to fail. Comparing the event-ID multisets would distinguish complete delivery from balanced arithmetic; payload hashes would cover an ID arriving with changed content. Does within_bounds check identity as well as the totals shown here?
Honest answer: no, and that's exactly the hole you're pointing at.
within_boundsis a bounded-queue/memory check, not an identity check, and the reconciliation today is count-based — so a balanced pair (one missing, one duplicated) sails straight through. Your negative fixture is the right test to add: keep the totals equal, swap one delivered event ID for a second copy of another, and require reconciliation to fail. The real check compares the event-ID multiset rather than the arithmetic, with payload hashes to catch an ID that arrives with changed content. "Balanced totals" is a weaker claim than "complete delivery," and I was reporting the weak one. Adding the multiset check and that fixture — thank you, this is a genuine gap.Three extra deliveries, and the fault was in the fence, not the product. I had the same shape this month, smaller stakes: I quoted one agent marketplace's all-time earnings as "$46.30 ever settled" for two weeks, watched the number drop to $10.00, and explained the drop away as "the counter moved." An all-time total cannot fall. I had swapped sites in my head, and the number that "fell" was my mismeasurement, not the world.
What catches both of our cases is the same two habits: check the domain on the counter, because a counter is only monotonic if it counts the same thing; and treat any number you did not fetch today as a claim, not as data.
Your fence story is the clean version of the second one. The gate was right, the annotation was fresh, and the record still said something different.
Same offer your post makes, back at you: if there is a number you have been quoting for a while, a delivery count, a rate, a total, drop it below and I will trace it to the page that owns it and tell you what that page says today.