Put the spending ceiling into AI-generated code
Prasenjit Sarkar (@stretchcloud) uses the Durable Objects alarm loop to argue that alarms bill without traffic, that a single console cap cannot cover multi-vendor agent work, and that generated code needs execution quotas, idempotency checks and a kill switch.
- Products
- Durable ObjectsWorkers
- Source
- Author experience𝕏
- Author
- Prasenjit Sarkar (@stretchcloud)
Key points
- The author notes that Durable Objects alarms run outside the request path, so a loop keeps billing with zero traffic and no users watching.
- He writes that agents can reschedule, retry and reprocess the same context faster than a human reviews a bill, and that at the time of his post Cloudflare had nothing comparable to other vendors’ spend limits for Durable Objects specifically.
- His view is that a cap in one cloud console cannot cover agent work routed across several vendors; the ceiling has to be in the generated code: execution quotas, idempotency checks and a kill switch that does not rely on someone reading a dashboard.
- He recommends reviewing AI-written infrastructure code for its worst financial outcome, not just whether tests pass.
Original sources
Published
Original post
Read on 𝕏Prasenjit Sarkar (@stretchcloud) uses the Durable Objects alarm loop to argue that alarms bill without traffic, that a single console cap cannot cover multi-vendor agent work, and that generated code needs execution quotas, idempotency checks and a kill switch.
Prasenjit Sarkar
@stretchcloud · Original 𝕏 post
A Durable Objects alarm looped quietly for 23 days before it turned into a $10,811.41 bill. No breach, no bad actor, just a handler that kept rescheduling itself every time it succeeded, reading and writing Cloudflare's storage layer trillions of times before anyone noticed the account was still live. The developer traces the original scheduling logic to a Codex session from late August, with a Claude-authored change three days later as a secondary contributor, by his own account, not an independent audit. Cloudflare's alarms run outside the request path, so a loop like this keeps billing with zero traffic and zero users watching. Support's first move was to decline a credit, pointing at the customer's own code. The reply was partly drafted by Workers AI running Kimi K2.7, which is its own small irony. This is not a one-off. A Claude agent on AWS Bedrock ran up a $30,000 bill through a loop with no circuit breaker and no alert from Cost Anomaly Detection. Another AWS agent hit $6,531 and effectively bankrupted the side project it was running. The pattern repeats because agents can reschedule, retry, and reprocess the same context faster than any human reviews a bill. The platforms are finally responding. OpenAI re-shipped monthly spend limits in September. Google shipped hard monthly caps for Gemini Enterprise on August 26, but by its own design it can only cap what it bills, not the Claude or Codex spend sitting on a different vendor's meter. Cloudflare still has nothing comparable for Durable Objects specifically. My read: a spend cap on one cloud's console was never going to fix an agent economy that routes work across four or five vendors in a single afternoon. The ceiling has to be written into the generated code itself, execution quotas, idempotency checks, a kill switch that doesn't depend on a human reading a dashboard at the right moment. Review AI-written infrastructure code for its worst financial outcome, not just whether it passes tests. Passing tests is exactly what this bug did for 23 days. https://t.co/RCqXyYhkSO
More to read
FlareCost: Free plan limits that fail the request (not bill)
FlareCost’s free-plan-limits page lists Workers, KV, D1, R2, Durable Objects and Queues Free meters in one table: daily Free limits reset at 00:00 UTC and fail the request instead of billing, except R2 which bills past its monthly free tier on any plan. Reviewed against official pricing pages on 2026-11-02.
opsfork: a MeloTTS retry loop produced a $391.50 Workers AI charge; a waiver was requested.
Cloudflare Community user opsfork (newsfork.com) asks for a full waiver of a $391.50 Workers AI charge for the billing period October 21 – November 20, 2026. The author says normal Workers AI spend is about $1–2 per day, but an unexpected incident involving the @cf/myshell-ai/melotts model sharply increased billable usage, mainly on November 18–19. According to the author, MeloTTS was scheduled for deprecation on November 20, 2026, yet repeated model failures began around November 17, before that date; those failures triggered a queue retry mechanism, and a defect in the author’s retry implementation amplified the failures, producing about 3.3 million queued messages. The author says almost all affected inference requests were failed or redundant retries of the same few video rendering jobs and produced no usable output. The author acknowledges responsibility for the retry defect, says the loop has been stopped, and lists safeguards already added, including retry limits, exponential backoff, a circuit breaker, and removal of MeloTTS. Requested resolution includes investigating the pre-deprecation failures, excluding the abnormal usage, waiving the amount attributable to the incident or issuing an equivalent one-time account credit, and a revised invoice; the author is willing to pay legitimate normal-usage charges. A formal billing adjustment request was submitted as Billing Support Case #02445560. Community MVP sjr replied that the author needs to work through the billing ticket and that the Community cannot help with billing issues. There is no Cloudflare staff reply on the public thread.
Duncan (@ephraimduncan): card charged $1,264 while $7,032 in Cloudflare startup credits remained.
Duncan (@ephraimduncan) asks who to contact after Cloudflare charged the card $1,264 while $7,032 in startup credits were still available. Cloudflare social media manager Val Vesa replies that it is probably a glitch, asks for a private message with the account email and a billing ticket number so it can be escalated internally and fixed; Cloudflare developer advocate Harshil asks for a DM with details to forward to the team. The author replies that the details are being sent.