34.8 Mistakes, limits and how today's tools realize it
- Approved by
- Panaversity ·
In everyday life. A pilot's checklist is short, and it is read every time, by pilots with thousands of hours. It exists because the mistakes it catches are the ones experts make when things look normal.
What you will learn. Where Claude Code usually goes wrong in this chapter's code, what Workflows do not promise, and what to check before you rely on today's tools.
Why it matters. This chapter's mistakes do not show up in a single test run. They show up when two things happen at once, or when something dies at the wrong moment.
Where Claude Code usually goes wrong here
Creating the Workflow before saving its ID. The tool calls create with a random ID, then records it. A crash between the two starts a second process on replay. Catch it: ask, "If the object dies on the line after create, what happens on replay?" The answer must be "the same ID, so the same process".
Retrying a payment step with no idempotency key. Claude Code gives every step.do the same generous retry rule. For a step that publishes a report or pays a supplier, a retry after a timeout may repeat an action that actually succeeded. Catch it: list every step that changes something outside, and check that each sends a stable key, for example the process ID plus the step name.
Trusting an approval event as proof. The review endpoint sends whatever arrives straight to waitForEvent, and the next step publishes. Catch it: find the step.do that checks who, what, whether allowed, still valid and not revoked. If there is none, the approval is not checked.
Doing the work in the web event request, skipping the signature check, and setting its own alarm. See 34.3.
Checking revocation only at the start. The run checks the flag once, then runs for a week. Catch it: search for isRevoked and count. It belongs before every step that acts.
The review checklist for this chapter
Add these lines to your REVIEW.md from Chapter 33:
- Every process ID is built from the request, never at random or from the clock.
- Every outbox row is keyed by event ID; every consumer ignores duplicates.
- Every Workflow step that changes something outside sends a stable key.
- Each business step is its own
step.do, with the retry rule from the spec. - Every approval is checked by trusted code in a step after the wait.
- Every model call, in conversations and Workflows, reserves budget first.
- Every consequential step checks the revocation flag.
- Every lock has a holder and an expiry.
- The web event endpoint only checks, queues and replies.
- No code sets the conversation object's alarm except Lifecycle.
The limits
Workflows do not give exactly-once effects outside. A step is saved when it finishes. If it calls a bank and then fails before it is saved, it runs again. The same is true of queues: they deliver at least once. Every outside action needs an idempotency key, just as in Chapter 33. When a step cannot tell whether its action happened, because the outside system has no key and no way to ask, it must escalate to a person, not repeat.
Workflow state is kept for a limited time. After a run ends, its state is kept for 3 days on the free plan, and 7 days by default on the paid plan, up to 30. Your Postgres process record is the lasting history.
Code changes during a long run. A Workflow waiting a week for review may wake up under new code. Change a step's name, or what a step returns, and the saved run may not match. Before a deploy, either keep running Workflows' steps compatible, let them finish first, or give the new code a new Workflow name and let the old one drain: start no new runs on it, and let its running ones finish. The same care applies to the improvement cycle later in this part.
No transactions across stores. Said three times in this chapter, because it is the limit that causes the most incidents. Outbox, unique constraints and the hourly check are how you live with it.
What this chapter leaves out. Orchestration shapes, supervisors and escalation between workers belong to Part V. Using Workflows for the worker's own learning cycle comes later in this part.
How today's tools realize it
Checked on Sunday, 29 November 2026. Products change; check each line before you rely on it.
- Cloudflare Workflows. A
WorkflowEntrypointclass withrun;step.dowith per-step retry rules;step.sleep;step.waitForEventwith a timeout, answered by sending an event to the instance; instances created with your own ID. About $0.02 a month for the paper's medium worker; free while you learn. - Cloudflare Queues for web events; Cron Triggers for worker-wide schedules, in UTC.
agents0.34.1 forLifecycle, which owns each conversation object's alarm and runs its jobs; Pi Durable 1.6.1 inside it.- Durable Objects for conversations and for the per-worker coordinator.
- Neon Postgres for process records, process events and the worker's history.
- Claude Managed Agents and the OpenAI Agents SDK both hand processes to something outside the agent; the handoff rules on this page apply to both.
What we tested, and what we did not. On 30 November 2026 we ran this chapter's patterns on Wrangler 4.169.1's local runtime, with no account and no key:
- A step that failed twice succeeded on its third attempt, under its own retry rule.
- A second
createwith the same ID failed withinstance.already_exists; an ID with a colon was rejected as invalid. waitForEventresumed when the review event arrived, and threw a timeout error when none came. A review sent before the Workflow reached its wait was still received.- A queued web event sent twice was routed once. An event whose consumer stopped after recording its ID was routed on the retry.
- A Cron Trigger fired twice started one Workflow per company.
- Twenty budget reservations at once against room for fifteen: exactly fifteen succeeded with no
awaitin the check, and all twenty with one (34.7).
We did not test a deployed account, the real retention period, or Workflow pricing. Before you rely on any API shown here, check it in the installed documentation, and ask Claude Code to do the same.
The invariant. A Workflow keeps its own steps, not the outside world. Make every outside effect safe to repeat, and keep the lasting record yourself.
Check yourself. A Workflow step pays a supplier through a bank API that has no idempotency key. The call times out. What should the step do? (Not retry. It cannot tell whether the payment happened. It should record "unknown", stop the run at that step, and escalate to a person who can check with the bank.)
Sources
- Building Affordable, Self-Improving AI Workers (Panaversity, 29 November 2026), sections 7.3, 7.7 and 18.3
- Cloudflare Workflows (Cloudflare documentation, verified 2026-11-29)
- Owner
- Panaversity