billflare.

Durable Object alarm rules for agents.md

Viking (@vikingmute) shares the AI-generated Durable Object alarm rules he keeps in agents.md and suggests having another model review changes.

Products
Durable Objects
Source
Author experience𝕏
Author
Viking (@vikingmute)

Key points

  • The author describes an alarm as a durable timer that wakes the object even without requests and is billed per invocation. He writes that there appears to be no account-level hard cap, only alert emails.
  • Prohibited in his rules: calling setAlarm in the constructor, calling setAlarm at every exit of alarm(), refreshing before expiry so a chain never ends, and self-renewal shorter than 60 seconds unless the user explicitly asks and states a limit.
  • Required in his rules: return without setAlarm when no work remains, state a termination condition (count, deadline, or an active flag in storage) before renewing, test that alarms stop when there is no work, and explain in the commit message how the chain stops.

Original sources

  1. Original post

    Read on 𝕏

    Viking

    @vikingmute · Original 𝕏 post

    和我之前的观点一致https://t.co/A4vwxe9f4a 不管用什么云服务一定要注意啊,Vibe Coding 别写出什么死循环了,尤其是用 Durable Objects,要不直接天价账单了,而且好像它没有价格上限,只能发告警邮件,所以要格外小心。 如果用,可以加一个 规则,同时最好改动要另外一个模型… https://t.co/lHsTeWDfJ9
  2. The earlier post the author links to: quoting yvonuk, he writes that cloud platforms carry a chance of very large bills, especially with Durable Objects, while a VPS under attack at worst maxes out and takes the site down.

    Read on 𝕏

    Viking

    @vikingmute · Original 𝕏 post

    说的很中肯,虽然我是无脑 CF 吹,但是假如要做一个量大的产品的话,VPS 肯定比 serverless 贵,用云平台就会有天价账单出现的概率,尤其是用 Durable Objects,VPS 被刷,最坏是机器打满 站点挂掉。 而且 CF 的服务大多数都是 vendor locking,迁移不太方便,而且现在 VPS 配合 AI 加上类似 Coolify… https://t.co/2cNZZ58RPM
  3. Reply from another user, JasonC (@JasonC_Dev): each setAlarm() is billed as one row write; he suggests removing Durable Object bindings from preview environments and writing a budget circuit breaker.

    Read on 𝕏

    JasonC

    @JasonC_Dev · Original 𝕏 post

    补个更阴的:每次 setAlarm() 本身就按一次 row write 计费。 HN 上那个 8 天 $34k 的案例,炸点是 60 多个 preview 部署各自起了一套 DO,onStart 里无脑 setAlarm。 preview 环境先把 DO binding 拿掉,再自己写个预算熔断。别指望平台提醒你。
  4. Reply from another user, Kenny Chen (@KennyChinaTech): add a test that triggers the alarm once more after disabling; calling deleteAlarm() inside alarm() does not guarantee retries are stopped.

    Read on 𝕏

    Kenny Chen|AI 实战

    @KennyChinaTech · Original 𝕏 post

    停用后再触发一次的测试得补上,alarm() 里调 deleteAlarm() 也不保证阻止重试。
Community resourceDurable Objects +1

cloudflare-cost-guard

Louis Cai’s open-source rules and TypeScript base class for keeping Durable Object alarms and Worker schedulers from runaway loops.

D1

D1 status writes: an author reports a 150-dollar charge and refund.

@wofuhuola describes a generated tool writing Reddit post statuses globally every five minutes and deleting expired rows. The author says one month cost 150 dollars, went unnoticed for three months, and was later refunded after an appeal.

Author experienceWorkers +4

Cloudflare billing pitfalls thread

The author organizes Cloudflare billing risks by product and shares experience with budget alert emails.