Many automation workflows begin simply: receive a form, create a task, send a confirmation email, update a spreadsheet, and notify the team. The first time it succeeds, it feels like saved time.

The real trouble usually appears on the tenth run, the hundredth run, or on a day when an external service fails.

Suppose the workflow has already created a customer record and sent a notification, but the final step that updates payment status fails. You cannot only say “run it again.” A rerun may send a second email, create a second record, or make the half-finished state even harder to understand.

On 2026-06-25, Cloudflare introduced saga-style rollbacks for Workflows. Workflows is Cloudflare’s system for running multi-step, long-running application flows; a saga-style rollback lets developers attach a compensating action to each step.do(). In plain language: do not only write what a step should do. Also write what should happen if a later step fails.

You do not need to learn Cloudflare first to use this lesson. The durable idea is simple: multi-step automation is not safe merely because it can retry. It also needs to know how to clean up after failure.

First separate retry from recovery

A retry means doing the same thing again. For example, if an API is temporarily unavailable, the workflow may try again a few seconds later.

Rollback or recovery means dealing with the effects that already happened. That may mean canceling a reservation, marking an order for human review, sending a correction, or moving a data record back into a processable state.

Both sound like error handling, but they belong in different situations.

If a step only reads data, retrying is usually reasonable. A brief network issue, a busy database, or a temporary third-party timeout can often be solved this way.

But if a step actually changes the world, retrying can create new problems. Examples include:

  • sending an email or text message to a customer;
  • creating an account, ticket, order, or invoice;
  • charging, refunding, issuing points, or changing inventory;
  • changing a CRM record, meaning customer data and interaction history;
  • calling an external tool that starts work in another system.

Once these steps happen, the world has changed. If something fails later, you need a cleanup plan, not only another run.

A compensating action is the next step after failure, not magic undo

In distributed systems, a saga is often used for a chain of local transactions. Microservices.io explains that when one transaction fails, the system must run compensating transactions to explicitly undo the earlier effects. Microsoft Azure’s compensating transaction pattern makes the same point: many recoveries are not simple data reversal. They must follow business rules, such as canceling a reservation or issuing a partial refund.

For everyday workflows, you can think of a compensating action as the next responsible step after failure.

It is not always full reversal. Many things cannot truly be rewound. An email has been read. A customer has seen a wrong notification. An external service may already have created a record that cannot be deleted cleanly.

So compensating actions usually look like this:

  • Cancel: cancel a reservation, task, order, or temporary record.
  • Mark: move the state to “needs human review” so later automation does not continue.
  • Correct: send a correction, add an explanation, or update wrong data.
  • Isolate: keep doubtful data out of official reports or customer workflows.
  • Hand off: notify the responsible person with completed steps, the failure point, and available choices.

The “responsible person” cannot be just a name in a document. Someone must really know who sees the alert, who decides whether to continue, and who handles the customer or internal impact.

Advertisement

Use one table to check whether each step can run automatically

Before writing automation, split the flow into steps and ask how each one should be recovered if it fails.

Workflow stepWhat can go wrongPrewritten compensating action
Create an internal taskThe task is half-created, and the team manually creates another oneStore the external ID; check whether it already exists before retrying; create a new task only if none exists
Send a customer notificationLater data fails, but the customer already received an incomplete messageStop later automatic sends; mark for human review; send a correction if needed
Update payment, points, or inventoryMoney or quantity changes incorrectly, and a rerun changes it againDo not automatically rerun high-impact steps; lock the record and ask the responsible person to confirm the difference
Call an external AI or agentThe AI has already edited files, opened a PR, sent a message, or triggered another toolRequire an action log; after failure, stop in pending-review state instead of letting the next tool continue

This table is only a starting point. Its purpose is not to make the workflow complicated. It forces you to answer: if step 3 fails, what should happen to the traces left by steps 1 and 2?

There is also a general principle worth remembering: steps that “do something” should be designed to be idempotent. You can read that word as “doing the same thing more than once does not create multiple side effects.” For example, if you create a task with the same order number, the second call should return the existing task instead of creating another one. Most workflow-platform documentation, including Cloudflare’s, emphasizes this principle.

If your workflow cannot behave this way, retry cannot be its only protection.

Which workflows need recovery steps first?

Not every automation needs a full saga, meaning a design where every step has a prewritten failure repair action. Renaming files, converting data to a fixed format, or summarizing public information is usually lower risk.

But the following workflows should have recovery steps before they become part of daily work:

  1. Flows that send messages outward: email, text messages, social posts, support replies, customer notices.
  2. Flows that change official data: CRM, orders, payments, inventory, membership state, permissions.
  3. Flows that connect several systems: forms, spreadsheets, project tools, finance systems, external APIs.
  4. Flows that let AI run several actions in a row: reading data, editing files, calling tools, opening PRs, or notifying people. Here, an AI agent means AI that performs multiple steps, not only a chatbot answering one sentence.

These flows share one trait: failure does not affect only one screen. It may leave external traces, wrong data, or follow-on actions.

If you cannot yet describe the recovery path, keep the workflow at “draft output” or “create a review task” instead of letting it act in production.

Three practical changes for small teams

First, add an “already done” record to each automation. At minimum, record the workflow ID, start and finish time for each step, external-system IDs, error messages, and next state. Without a record, recovery is guesswork.

Second, pull high-impact steps behind a human approval gate. Any action that emails customers, changes money, changes permissions, or edits official data should not be left to an AI or script alone.

Third, write one compensation rule for each high-impact step. For example: “If the task was created but email sending failed, do not create another task; notify the owner to resend.” That small sentence turns “we will figure it out later” into “failure has a next step.”

The conclusion of this mini class

The real maturity test for automation is not how smoothly it runs on normal days. It is whether people can understand it, stop it, and repair it when it fails.

Cloudflare Workflows’ saga-style rollbacks are one new reminder of this idea. Whether you use Cloudflare, GitHub Actions, Zapier, n8n, internal scripts, or an AI agent that connects several tools, ask the same questions:

  • Which steps are safe to retry?
  • Which steps need compensating actions once they happen?
  • Which failures must stop for a responsible person to confirm?
  • Which records will let someone know what already happened during recovery?

When these answers are written down first, automation stops being a fast black box that nobody dares touch when it breaks. It becomes a workflow that knows how to move forward and how to stop for cleanup.

Everyday four-panel comic

Four-panel comic: an automation flow first runs smoothly, then a middle step fails, the team uses a planned compensating action, and a human reviewer safely takes over.

  1. A multi-step automation appears to run smoothly, with each step ready to complete on its own.
  2. A middle step fails, and the team stops instead of rerunning the whole flow immediately.
  3. The team uses the compensating action written in advance to organize the effects of earlier steps.
  4. A responsible person takes over, checks the record, and decides what can retry and what needs manual handling.

AI handoff card

Ask AI to organize this article's specific situation

Copy this into your own AI chat tool to turn this mini class into a personal checklist. BMC will not see what you paste into your AI tool.

Advertisement

Share

Share this mini class

If this lesson helps untangle a work bottleneck, share it with someone deciding how to use AI.

References