Build1 distinct publisher3 min readPublished
A dev.to postmortem burned $1,900 against a $600 cap after the alert arrived exactly on time, and the fix it lands on is a reservation that refuses the call before any network I/O rather than a better threshold.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
An alert at 84 percent of a $600 cap means $96 of headroom. What followed the email was roughly $1,396 more in spend, about fourteen times the amount the banner said was left. Moving the threshold to 70 percent changes the size of that ratio and nothing else, because the banner sat in a system that had no way to refuse a request.
The difference between the two code paths is not the arithmetic, it is where the arithmetic sits relative to the network call. In the version the post says almost everyone writes first, the usage ledger is written after the response returns [6], so the freshest number available is always missing exactly the calls that are in flight [c7a]. The reservation version inverts the order. It opens a transaction, takes a row lock on the user's budget, compares spent plus reserved plus the estimate against the cap, and raises a 402 before any network I/O happens [9].
`SELECT ... FOR UPDATE` is doing most of the work here. Twelve workers that would all have read 92 percent in the same second and all passed now serialize instead [10]. That serialization is also the bill. You have installed a per-user lock in front of every model call. If the calls take seconds and the lock is held for microseconds, it is free; if you run thousands of small completions per second against one shared budget row, it is your throughput ceiling, and sharding that row reintroduces the stale read you were trying to kill.
The place I would expect this to break in production is the settle path: commit on success, release in the exception handler [12]. Any exit that misses both leaks a reservation, and a leaked reservation is indistinguishable from spend, so the budget throttles itself until somebody reconciles. Holds need an expiry and a sweeper, and neither is in the sketch.
The behavioral claim deserves the treatment you would give a benchmark table. The post cites Worchel, Lee and Adewole, 1975, in the Journal of Personality and Social Psychology: 200 participants, the same cookie handed over from a jar of ten or a jar of two, with higher value and attractiveness ratings from the two-cookie jar [3], and the highest ratings of all from participants told the supply had shrunk because other people wanted them [4]. That is a rating, not a purchase. For it to transfer to your dashboard, the person reading "16% of your budget remaining" [5] has to be the one who decides whether the job runs, has to decide in that moment, and has to want tokens the way a hungry undergraduate wants a cookie. What actually spent the money in this incident was a retry loop making forty calls in ninety seconds against a one-minute rollup cron [c7c], with the context window growing on every pass [8]. The loop was never going to read the banner.
So the ordering I would defend in review: a hard call ceiling and a token budget per agent run first, because that is a counter and a raise with no ledger involved; the reservation table second, once spend is per-tenant and you need to answer who spent it anyway. The alert keeps its real job, which is telemetry. The post's own description of the soft check is the accurate one: it observes, then gets out of the way, which makes it a very expensive log line [13].
Ranked by verification strength, evidence, and original report placement.
Worchel, Lee and Adewole published a scarcity experiment in 1975 in the Journal of Personality and Social Psychology with 200 participants: the same cookie was handed over from either a jar holding ten or a jar holding two, and the two-cookie jar produced higher ratings on value and attractiveness.
In a disclosure condition, participants explicitly told the supply had dropped because other people wanted the cookies rated the cookie highest of all, so being told the mechanism did not cancel the effect.
The first-draft pattern the post shows reads month-to-date spend, logs a warning and increments a metric when spend exceeds 90 percent of budget, then makes the API call with max_tokens 4096, and records usage into the ledger after the response returns.
Failure mode one: because record() runs after the response returns, the ledger is always behind by exactly the calls that matter, and during a burst the spend you most need to see has not landed yet.
Failure mode two: twelve workers pulling month-to-date spend inside the same second all see 92 percent, all pass the check and all fire, so no single request overshot the cap but collectively they cleared it by 4x.
Failure mode three: a tool-calling agent that hits a malformed schema and retries can make forty calls in ninety seconds, finishing before a one-minute usage rollup cron moves the graph.
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 29, 2026
Follow any of these and your For You feed starts watching them — no settings page required.
build
The prompt never arrived: a Windows batch shim was worth 15 of 24 runs in an agent eval1 distinct publisher
build
Claude's system prompt grew ninefold in two years. Version yours like code.1 distinct publisher
build
Claude's prompt cache dies quietly in agent loops: the 20-block lookback nobody configures1 distinct publisher
build
Your token ratio, not the leaderboard, decides which model is cheap1 distinct publisher
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Self-reported bill, inspectable code
The $1,900 and the $600 cap live in exactly one place: dev.to's author saying so. No invoice, no usage export, nobody else who watched the burn. What survives without trusting him is the engineering — the first code sample really does write usage after the response returns, and a read-then-act check against a shared total really does let a dozen workers through at once — and the cookie study is cited precisely enough (authors, journal, 1975, 200 participants) to be looked up. Strong where it is code, unverified where it is money.
Nothing countable yet
Two artefacts get named and neither arrives with a number: baar-core has an install line but no downloads or dependents, and noburn.dev has a feature list but no customers. The only field deployment described is the author's own account for one week, in the failure direction. We would be inventing uptake to score it.
Framing overshoots, remedy doesn't
"Never stop runaway LLM spend" is a universal claim resting on one alert that one engineer ignored, generalised through a 1975 experiment about how people rate cookies. The recommended fix runs the other way: the post calls a row lock boring, credits databases with inventing it, and treats over-reserving as a rounding error. So the stretch is in the thesis about human behaviour, not in the mechanism — which is why the argument still lands even if you throw out the psychology.
The diagnosis sells the cure
The author maintains baar-core and sells noburn.dev, and the essay walks from Thursday's overrun to a pip install without a pause. That does not make the race condition imaginary — twelve stale reads are twelve stale reads whatever you buy. It does explain the one line that most needs scrutiny: that atomic reservation is the piece you'd get wrong on your own. Nothing outside the author's own code path — provider spend limits, gateway throttles, a ceiling on the retry loop that actually caused the bill — is weighed against it.
Firm on mechanism, thin on the week
We are comfortable with the parts a reader can re-derive: write ordering, lock semantics, a 402 that middleware can distinguish from a transient 500. We are much less comfortable with the parts carrying the emotional weight — an exact dollar figure, and the assurance that the alerting path was flawless so psychology must be the culprit. One publisher, one author, one account of his own system, and no second version of the story anywhere.