Your failure path needs three terminal states, and the one everybody omits is "unknown".
Every recovery primitive shipping in November 2026 — checkpoints, rewind, retries, approval gates — is scoped to things it can snapshot or re-run, and not one of them claims to reverse a network call. So the honest outcome of a crash mid-write is not success and not failure but I do not know whether that happened, and a product with only two terminal states will silently pick one. It picks failure, which triggers a retry, which is how one recoverable incident becomes two irreversible ones.
Step 1The reversibility boundary is a property of your tool surface, not of your promise.
"We have undo" is never the claim a harness actually makes. Read the documentation and the claim is always narrower and more specific, and the four shipping answers differ enough that you cannot reason about them interchangeably.
- Claude Code's
/rewindtracks changes made by its own file-editing tools. Every prompt that starts a turn creates a checkpoint; it keeps snapshots for the 100 most recent checkpoints in a session and deletes them in a retention sweep roughly 30 days after the session last saved one. A shell command's writes are restorable only in files its tools had already touched. Subagent edits are usually not captured. Directories created, moved or deleted are not undone. Remote and network files are not tracked. Symlinked and hard-linked paths are skipped, with a warning naming how many. - GitHub Copilot CLI's
/undois the opposite boundary on all three axes: file changes are tracked per turn across editing tools, shell commands and sub-agents, with no Git required. It pays for that with hard numeric limits — files over 10 MB are not captured, a single turn that changes more than 500 files is not captured at all, and a file whose contents no longer match what Copilot last wrote is left untouched. The rewind itself cannot be undone. - Codex CLI ships no undo, rewind, checkpoint or revert command. Git is the whole answer.
- Copilot's cloud coding agent has no rewind either, and replaces it with architecture — see STEP 5.
Two things generalise. First, every one of them names version control as the remedy for whatever it does not cover, which is a vendor telling you the boundary is narrower than your users will assume. Second, no harness anywhere claims to reverse an outbound effect. Undo is a filesystem feature wearing a product word.
Step 2Compute undo coverage per run, not per tool.
The number teams quote is the share of their tools that are reversible. The number that predicts incidents is the share of runs in which every effect was reversible, and the two are far apart because the irreversible tools are the useful ones.
# a support agent's tool surface, and what undo really covers tools_total = 14 file_edits = 9 # reversible by checkpoint shell_commands = 3 # reversible only where a file tool touched it first outbound = 2 # send_email, issue_refund tool_coverage = 9 / 14 # = 64% — the number that gets quoted # now sample 200 real runs and ask what each one touched runs = 200 runs_only_reversible_tools = 56 # = 28% — the number that matters runs_touching_outbound = 31 # = 16% where "undo" is a word, not a feature
Sixty-four per cent of the tools, twenty-eight per cent of the runs. Do this calculation before you promise a user anything, and do it again whenever a tool is added: one new outbound tool on a common path can halve per-run coverage without changing the quoted figure at all.
Then sort the remaining work by cost of reversal rather than by how frightening an action sounds, which is the lever undo and reversibility is built on. Real reversibility beats a confirmation that merely warns, because confirmation asks a person to predict a bad outcome while undo only asks them to recognise one. Where true rollback is impossible, a hold window with cancel buys you the same thing more cheaply than a dialog does.
Step 3Add the third terminal state, because four vendors now tell you to.
This is the part the original version of this page, and most shipping products, got wrong. The documentation has converged, independently, on the same admission:
- LangGraph: a retry re-runs the node from the start, giving at-least-once semantics for node execution — and it explicitly does not make external side effects happen exactly once. Checkpoints are written at super-step boundaries, not mid-function, so payments and emails inside a node fall outside the boundary.
- Temporal: Temporal does not make side effects run once. Its own worked example is a worker that completes an activity successfully and crashes just before notifying the service, so the event history has no record, the activity is retried, and a payment processor sees a duplicate charge.
- OpenAI's Agents SDK states it most plainly: approval permits a tool call to execute, it does not guarantee exactly-once execution — a payment can complete even though the saved snapshot holds no record of the result. And the instruction that follows is the one to build: a missing result in an ordinary lookup is not proof that retrying is safe, because reads lag and an earlier request can still land, so if the outcome remains uncertain, record it as unknown and avoid automatic replay.
- Claude Code shipped the user interface for it. Release 2.1.326 fixed
/rewindreporting "No code changes" when a shell command had changed files it could not restore; a turn whose changes were not tracked now reads "Code changes unknown".
That last one is the pattern worth stealing wholesale. The bug was not that the harness failed to restore the files — it could not, by design. The bug was that it rendered "I cannot know" as "nothing happened", which is the most expensive sentence a recovery UI can print. Make unknown a value your state machine can hold, your API can return and your interface can draw, and make it visually distinct from both success and failure. A user who is told "the refund may or may not have been issued — check before retrying" can act correctly; a user told "the refund failed" will press the button again.
The dangerous failure was never the visible crash. It is the agent that quietly produces a plausible-but-wrong result and continues, and its close relative — the recovery surface that reports a clean failure it has no evidence for. Bias your detection toward surfacing uncertainty and stopping. See failure concealment for how this looks from the model's side.
Step 4A resume is a re-execution, so the idempotency key must be durable before the effect.
LangGraph's documentation is blunt about the mechanism: when execution resumes after an interrupt, the runtime restarts the entire node from the beginning rather than from the line where interrupt was called, so any code that ran before it executes again. Subgraphs replay the same way. Interruption, steering and handoff works through what that costs a user mid-run; what matters for the failure path is the specific trap it sets.
Generating the idempotency key inside the step it protects does not work, and the failure is silent:
# the key must already be durable BEFORE the side effect runs attempt 1: node starts -> generate key K1 -> charge succeeds -> process dies attempt 2: node starts -> state has no key -> generate key K2 -> charge AGAIN # K1 was never checkpointed, because the node never returned. # Fix: derive the key from state that is already durable, or persist # it in a step that completes before the effect.
Three corollaries, all from vendor documentation. Put side effects after the pause, or in a step of their own, so the replay window contains nothing that charges anyone. Re-read external state — price, inventory, policy — after a long pause, because the pre-pause world has expired. And remember that idempotency is enforced by the service you are calling, not by your activity: your key is a request, and the destination's retention period decides how long it is honoured. Make the unit of work the recovery boundary, since that is the only lever that stops completed work repeating. Idempotency and retries has the implementation.
Step 5Where you cannot reverse, bound — and choose the direction of failure.
The strongest answer to "what if the agent does something bad" is sometimes not undo at all. GitHub's cloud coding agent ships no rewind and instead makes the blast radius small enough that ordinary Git is sufficient: it can push to a single branch and no other, its credentials permit only simple push operations so it cannot directly run git push or other Git commands, its draft pull requests must be reviewed and merged by a human — it cannot mark them ready for review, approve or merge — and by default workflows do not run until someone with write access approves them. Nothing is reversible because nothing landed. That is a better guarantee than a rollback, and it is available to any agent whose output can be staged.
Where effects must land, the direction of failure is a deliberate choice and it differs by axis. On the consequence axis — money, data, external communication — fail closed: when uncertain, do less, because an action not taken is recoverable and an erroneous irreversible action often is not. On the capability axis — a tool is down, a source unreachable — fail open toward honest degradation: return partial results clearly labelled, or hand back to the human with state intact, rather than fabricating to look functional. The worst outcome combines them: a confident, complete-looking, wrong, irreversible result. Fail closed and fail open is the general treatment; blast radius is what you are actually sizing.
One detail worth copying because it is so often got wrong: cancellation is not rollback. Copilot CLI documents that a file write already in progress will complete, so files are not left corrupted mid-write, but remaining planned changes are abandoned. That is the right behaviour and it means a cancelled run ends in a partially applied state — which is exactly STEP 3's third terminal state, and which your stop button should say out loud.
Step 6Write the message, then repair the trust — and do not auto-retry over uncertainty.
An error message is a UI for the user's next action, and it answers three questions: what state am I in now (what was applied, what was rolled back, what is unknown), what can I do (retry, undo, take over, escalate), and what should I not assume — "the email was NOT sent", or, more honestly in many cases, "we cannot confirm whether the email was sent". Put the recovery action the user most likely wants as the primary control, right there, and surface the durable facts rather than a stack trace. "Something went wrong" is not a sentence; it is an abdication.
Never auto-retry a failure that may have partially applied a non-idempotent effect. This is the single rule on this page that turns one recoverable incident into a duplicated, irreversible one, and the Agents SDK's guidance is the test to apply: retry only after authoritative reconciliation establishes that no earlier attempt performed the action and none can still perform it. Absence of a record is not reconciliation. Where reconciliation is unavailable, the run ends in unknown and a human decides. Retry amplification is what happens when a fleet of agents makes this mistake simultaneously.
Then do the trust work, because a visible error does not just cost that task — it resets the user's calibration for the whole agent, usually globally even though the failure was scoped. Trust does not recover by waiting. It recovers through specific repair: acknowledge the exact error plainly, with no minimising and no apology theatre; state the concrete change that makes recurrence less likely; and scope the damage explicitly — "this affected refund handling; ticket labelling is unchanged" — because unscoped failures poison trust in capabilities that never failed. The strongest move available is for the agent to propose a temporarily lowered autonomy rung in precisely the scope that failed, which reads as accountability rather than as a worded apology (progressive autonomy).
In order: read your harness's documentation and write down the actual reversibility boundary, then compute undo coverage per run rather than per tool. Add unknown as a first-class terminal state in your state machine, your API and your UI, and never render it as failure. Derive every idempotency key from already-durable state, and put side effects after the pause. For anything you cannot reverse, stage it behind a gate instead — a branch and a review beat a rollback. Fail closed on consequence, open on capability. And if you keep one sentence: an agent that says "I do not know whether that happened" is working correctly, and a retry button next to that message is a bug.