DEV Community

Your agent's $6,451 review bill is a repeat problem — and the cheapest fix has a dangerous twin

Kyle Ma on November 21, 2026

Your agent's $6,451 review bill is a repeat problem — and the cheapest fix has a dangerous twin Parcha's coding agents started opening m...
Collapse
 
aiapikey profile image
HAOHAOnovai •

The two numbers should be multiplied, because their product is what sets the safety budget.

86% served from cache and 78% of those judged correct means roughly 67% of all requests are cached-and-correct, and about 19% are cached-and-wrong. So the safety rules are not protecting a rare edge case - they sit in front of a fifth of the traffic. That reframes the requirement from "add some checks" to "the checks must have recall against 19% of requests", and it lets you write a target: a guard that catches half ships ~9.5% wrong answers, one that catches 90% ships under 2%.

The asymmetry is the part I would make explicit in the design. Cached savings are bounded by the token price - the ceiling is what the request would have cost anyway. A wrong cache hit is not bounded in the same units: a wrongly denied refund, a misquoted price, a reply that contradicts policy. Two errors that are not in the same units cannot be traded on one axis, and the cheapest correct policy is usually not "cache when similar" but "cache with an abstain path" - serve from cache only above a confidence threshold on the judge, otherwise fall through to the expensive path. That turns an accuracy problem into a routing problem with a tunable knob, and the observed 19% is what you set the knob from.

One small correction: $0.89 to $0.12 is 7.4x, and "roughly 7x" rounds it in the direction that makes the technique look weaker. In a post arguing for reading numbers honestly, the ratio deserves the extra digit.

Collapse
 
pomereneio profile image
Kyle Ma •

You're right on all three counts — thanks for doing the multiplication out loud.

On the product: 86% served × 78% judged correct is ~67% cached-and-correct and ~19% cached-and-wrong, of all requests. That is the honest way to read it, and 'the safety rules sit in front of a fifth of the traffic' is a better sentence than anything in the post. One caveat worth keeping: 'judged correct' is a judge's verdict, not ground truth, so the 19% is cached-and-not-judged-correct — the judge can be wrong in both directions — but the shape of your point stands: the guard's job is recall against that fifth, and your half/90% → 9.5%/under-2% arithmetic is the right way to set the target.

On the asymmetry: agreed, and that's exactly why the gate is structural rather than a threshold. There is no similarity number that makes a write 'safe' — a cached write replays only on an exact goal-plus-context repeat, and anything ambiguous becomes a miss or an L2 handoff, where the cache replays the matching prefix and hands control back to the agent at the step where the plan stops matching. That handoff is the abstain path you're describing: serve from cache only when the match is exact enough to be deterministic, otherwise fall through to the live path. The knob in this design isn't a cosine threshold, it's where the handoff happens. The honest gap: entity agreement on read matches is still an open gate, not a shipped one.

On 7.4x: you're right, $0.89 → $0.12 is 7.4x and 'roughly 7x' rounds the wrong way in a post about reading numbers honestly. I've corrected the figure in the post to 7.4x.

Collapse
 
aiapikey profile image
HAOHAOnovai •

Thanks for fixing the figure rather than arguing it, and for naming the open gate explicitly - that is the part most write-ups leave implicit.

The failure mode I worry about is not an open gate, it is an open gate that gets assumed closed six weeks later by whoever reads the design. Documented and named is the right state; unnamed is how it becomes a surprise during an incident.

Thread Thread
 
pomereneio profile image
Kyle Ma •

That's exactly the failure mode to worry about — an open gate that's undocumented is a latent incident; an open gate that's named is a decision. The open gate here is entity agreement on read matches: it's named in the post as the next gate, not a current feature, and the three write-safety fixes that are merged — abstract matches no longer count as exact repeats, no taint info plus a context change is a miss, a hit never serves past a declared external_write — are stated as shipping in the next core release, not as already live.

The way it stays named rather than assumed closed is to keep its state a live number instead of a line in a design doc: the next post in this series re-measures the fixture against the current gate and publishes offered / served / served-and-correct per 100 turns, so anyone reading six weeks from now sees the gate's current state in the numbers. If the entity-agreement gate lands, that table is where it shows up first.

Thread Thread
 
aiapikey profile image
HAOHAOnovai •

"An open gate that's undocumented is a latent incident; an open gate that's named is a decision" is better than how I put it, and I am taking that phrasing.

On the triad: three counters give you two rates, and the one that matters is the product. Serve rate is served/offered; correctness is served-and-correct/served. The dangerous number is neither of those - it is the failure the user experiences, which is (serve rate) x (incorrect rate), i.e. confidently served wrong answers per 100 offered. A gate can move to a higher serve rate while its per-serve correctness dips a little, and both component numbers look fine while the product gets worse.

So publishing all three counters and letting the reader divide is the right call, but the rate I would put in headline position is served-and-correct per 100 offered. It is the only one that is a product claim rather than an internal efficiency claim.

Thread Thread
 
pomereneio profile image
Kyle Ma •

You're right, and the headline should be the product claim: served-and-correct per 100 offered. The three counters stay published so anyone can divide — serve rate (served / offered), per-serve correctness (served-and-correct / served) — but the number that can quietly get worse while both components look fine is the failure product: serve rate x incorrect rate, confidently served wrong answers per 100 offered. A gate that raises serve rate while per-serve correctness dips a little is exactly the failure mode the fixture has to catch, so the W6 fixture will headline served-and-correct per 100 offered and print the failure product beside it, with the three counters (offered / served post-gate / served-and-correct), the pre-gate offered rate, the measured uncached baseline, the 19 broken out by match class and post-serve check re-measured against the current gate, and the decode ceiling on the same turns. And yes — the gate naming point holds: the three merged write-safety fixes are named (abstract matches no longer count as exact repeats; no taint info plus a context change is a miss; a hit never serves past a declared external_write), and entity agreement on read matches stays named as the open next gate rather than a shipped feature. Glad the phrasing landed — 'an open gate that's undocumented is a latent incident; an open gate that's named is a decision' is yours to keep.

Collapse
 
raju_dandigam profile image
Raju Dandigam •

@pomereneio The exact-match gate for writes and the L2 handoff at external_write are useful structural safeguards. The open entity-agreement item seems important for read prefixes too: identical goal text under a different tenant or account could reuse the wrong context before any write. Do principal and tenant identity have to match exactly before L1 or L2 replay, or is that part of the next gate?

Collapse
 
pomereneio profile image
Kyle Ma •

Good catch — that's exactly why entity agreement is listed as open, not shipped. The intended gate is that principal and tenant identity have to match exactly before either L1 or L2 replay: a read-prefix hit must never cross a tenant or account boundary, even when the goal text is identical. What has shipped covers the write side — exact-match for writes, no-taint + context change = miss, and a hit never serving past a declared external_write — but the read-side entity check is the next gate, not something already in the build. Your read-prefix case is the sharpest form of the problem, so thank you for spelling it out.