The Spending Cap That Multiplies When Its Counter Store Goes Down
The configuration line that causes the most expensive AP2 incidents tends to be the one written as a resilience feature: when the shared velocity counter is unreachable, fall back to a local counter on each ingress replica. Reviewers approve it because it keeps agent payments flowing during a store outage. What it actually does is turn a cryptographically signed spending ceiling into a ceiling multiplied by however many replicas happen to be serving traffic. The mandate signature still verifies and the PQC handshake still completes, so every dashboard stays green.
Why the diff looks correct
In a typical AP2Shield deployment the mandate carries the user's ceiling, signed and bound to a tokenized sub-wallet. The ingress terminates a hybrid session using NIST's post-quantum key establishment standards such as ML-KEM, and a velocity limiter checks each authorization against a counter keyed by mandate and window. The fallback block usually reads as two harmless settings, a counter scope of local and an unavailable-store policy of continue, and each one looks fine when you read it alone. Put together, a 300-second velocity window that should allow one ceiling's worth of spend now allows one ceiling per replica, because every replica starts its own count at zero. An autonomous agent that retries against a load balancer is the worst possible client for this, since its retries spread across replicas and spend the multiplied budget in seconds, faster than any human fraud pattern would.
Run this against your authorization log today
Group settled or approved authorizations by mandate and by fixed window, then flag any group whose sum exceeds the signed ceiling: `SELECT mandate_id, floor(extract(epoch FROM authorized_at) / 300) AS win, sum(amount_minor) AS spent, max(cap_minor) AS cap, count(DISTINCT replica_id) AS replicas FROM ap2_authorizations WHERE status = 'approved' GROUP BY 1, 2 HAVING sum(amount_minor) > max(cap_minor);`, and if this returns rows, look at the replicas column first, because a breach spread across several replicas points to the counter fallback rather than to a bad mandate.
Bounding the failure instead of hiding it
Keeping the system up when the counter store fails is a legitimate goal. Free local counting is the wrong way to do it. The design that holds up is budget leasing: each replica reserves a slice of the remaining ceiling from the shared store ahead of time, spends against that slice locally, and goes back to the store for more only when the slice runs out. When the store disappears, each replica can spend what it already holds and nothing more, so the worst-case overrun is the total of the outstanding leases, a number you chose, not the replica count your autoscaler chose. My estimate from deployments I have seen is that leases sized at roughly a tenth of the ceiling keep approval latency flat in normal operation while keeping overrun during an outage tolerable.
The rule to put in review
Any code path that authorizes spend without an authoritative read of the counter or a pre-held lease must decline, and review should treat any config key that relaxes this as a change to the ceiling itself. Write that into the review checklist next to key rotation, because that is how important it is. Then add the query above as a scheduled check that pages on its first row, so you find a misconfigured fallback during a quiet store blip instead of during a regional outage. One trade-off remains, and only product can decide it: declined agent payments during a counter outage are visible to users, while overrun is visible only to finance, weeks later.
Technical FAQ: Does rate limiting at the load balancer cover this?
No. Rate limits count requests, not money, and they reset on their own schedule, so an agent can stay under the request rate while each request moves the full per-transaction amount. The ceiling has to be enforced where the amount and the mandate identity are both known, which means at the velocity limiter, backed by leases.