Live Nov 18 · Cohort 3Nov 18, 19:00 MSK — free hands-on AI agents live workshop · Live Cohort 3 starts Nov 23Join Nov 18 Live →Cohort 3 (Nov 23)
ReleaseAPI / Product · ActionableHabr AI→ original

After a Failure, Agents Roll Back Their Work in Only 47% of Cases, Though They Solve 84% of Tasks

An agent fixed the code and ran the tests. It also changed a timeout in the config and sent out notifications, and git revert restores only files. In the UndoBench benchmark, agents solved 84% of tasks, but after an injected failure they recovered in only 47% of the runs that had succeeded normally. Five talks reach the same conclusion: state snapshots and prohibitions belong in the harness code, not in the prompt. Otherwise a "successful" agent will leave the breakage behind.

AI-processed from Habr AI; edited by Hamidun News
After a Failure, Agents Roll Back Their Work in Only 47% of Cases, Though They Solve 84% of Tasks
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
EvoUndoin 197 of 600 agent improvements, recovery broke; an extended rollback language restored 180
Harveyone bug launched about 900 agents in 4 hours, against a norm of 50 tasks a day
Claude Codeauto mode blocks 89% of dangerous commands, while humans caught about 14%

An agent fixed the code, ran the tests, got a green build and applied a release tag. Then integration fails, and it turns out the agent also changed a timeout in the config, called an external API and sent out notifications. The git revert command restores the repository's files, but not the environment settings and not the emails already sent.

The authors of UndoBench, a test suite for the reversibility of agent actions, measured this gap. In a normal run, agents completed 84% of tasks. When the authors injected an artificial failure into the run, agents recovered in only 47% of the runs that had succeeded normally.

The denominators of the two figures differ, and the authors say so openly, but the gap is still telling. The author of a write-up on Habr studied five talks from recent AI conferences. The practical takeaway for developers: design the ability to roll back around the model, and don't count on it to undo its own work.

UndoBench and EvoUndo: the agent solved the task but can't undo it

UndoBench was tested on 2880 paired trials: a normal run against a run with an injected failure. Git tracks only repository files. Coding agents also edit environment configs, enable middleware, update tool registries and call external services such as deployment or databases. Reverting a commit doesn't touch any of those effects.

The same authors' next project, EvoUndo, showed an even uglier picture. On 600 self-evolution tasks, agents improved their metrics in 478 cases, but in 197 of them (about 42%) recovery broke. The agent got smarter and lost reversibility. Asking the model to fix rollback in the prompt proved useless: four repair strategies with a verifier restored zero of the 197 edits.

Two things helped. The first is state binding: to change a timeout back from 60 to 30, you need to know the old value. When the agent was given that data, recovery rose from zero to 38 of 48 cases.

The second is a richer rollback language. In an isolated experiment, recovery went from zero to 142 of 143 cases, and on the full set 180 of 197 edits were restored (about 92%). Acceptable improvements rose to 461 of 600, from 281.

The procedure works like this: before an edit, the harness saves a snapshot of the original state. In a test environment, the agent makes the change and immediately runs the rollback plan, and an independent verifier compares the result with the snapshot. An edit is accepted only if quality improved and the values returned to their original state.

If rollback is impossible, the agent stops and calls a human.

Timeouts, subagents and quotas: Microsoft and Harvey

A principal engineer at Microsoft, who wrote the open-source MCP bridge MCP Pacemaker (and stresses that he is expressing a personal opinion), points out that a timeout means only that the response didn't arrive, not that the operation failed. In UndoBench, an agent asks a tracker to create a ticket, and the server creates ticket 781, but the confirmation gets lost and the agent blindly repeats the request. When a response was lost, naive retries produced duplicates in 54% of trials.

The second problem is subagents. After a partial failure, they return smooth text with the same confidence as after a full check. The orchestrator sees the output but can't see how much work stands behind it. The author collected his rules into a scheme called SAFE, without claiming it as a universal standard:

  • facts have a source and an expiry date;
  • an external write happens at most once, with a single-use permit that code verifies at the gateway;
  • parallel launches are capped;
  • a subagent returns an explicit status with evidence, and a script double-checks the report.

SAFE does not perform rollback itself. Undoing external operations requires compensating steps following the Saga pattern.

Harvey showed what it costs to have no quotas. In August, a bug generated an alert for every workspace, and instead of the usual 50 tasks a day, about 900 agents launched in four hours. In October, one engineer queued about 950 tasks in three hours and clogged the queue again. Repeat alerts are now attached to an open investigation, launches go through a fair queue that prioritizes humans, and an automation rule switches itself off after five failures in a row. In a test with 300 tasks, startup time dropped, according to the speaker, from almost two seconds to 70 milliseconds.

Prohibitions in code and the autonomy ladder: Anthropic and Meta

Lydia from the Claude Code team said the number of changes grew from 2500 a day in May to more than 30 000 in September. Since August, auto mode has been on by default. It blocks 89% of clearly dangerous commands, whereas humans caught about 14%.

But roughly one in ten dangerous commands still gets through, so the guarantees come from the harness, not the prompt. Irreversible actions, such as reading .env or deleting uncommitted changes, are covered by deny rules and an OS-level sandbox, because an allow rule checks only the command name, not where the process goes once it runs.

There is also a trap: on exit code 1, Claude Code marks the task as completed, and to send the agent back to fix its edit, a hook must return exit code 2.

Meta's incident team (which, by its own estimate, writes about three-quarters of new code with AI) put a single AI partner on call, with an autonomy ladder like a new engineer's. At first it only investigates. Then it writes patches that a human approves. Only after that does it close noisy alerts and duplicates itself, through CI. In an example morning digest of 23 items, the agent closed 18 itself, handled 2 and handed 3 to a human.

What to do in practice

Snapshot state before any mutation that happens outside Git. Require subagents to return an explicit status, and check external state before repeating a request. Move irreversible prohibitions into deny rules and a sandbox. Set limits on parallel launches and auto-disable automations. Grant autonomy by action type, taking into account the cost of a mistake and the track record of success.

Story

Key Questions Answered

What are the key details on UndoBench and EvoUndo: the agent solved the task but can't undo it?

UndoBench was tested on 2880 paired trials: a normal run against a run with an injected failure. Git tracks only repository files. Coding agents also edit environment configs, enable middleware, update tool registries and call external services such as deployment or databases. Reverting a commit doesn't touch any of those effects. The same authors' next project, EvoUndo, showed an even uglier picture.

What are the key details on Timeouts, subagents and quotas: Microsoft and Harvey?

A principal engineer at Microsoft, who wrote the open-source MCP bridge MCP Pacemaker (and stresses that he is expressing a personal opinion), points out that a timeout means only that the response didn't arrive, not that the operation failed. In UndoBench, an agent asks a tracker to create a ticket, and the server creates ticket 781, but the confirmation gets lost and the agent blindly repeats the request. When a response was lost, naive retries produced duplicates in 54% of trials.

What are the key details on Prohibitions in code and the autonomy ladder: Anthropic and Meta?

Lydia from the Claude Code team said the number of changes grew from 2500 a day in May to more than 30 000 in September. Since August, auto mode has been on by default. It blocks 89% of clearly dangerous commands, whereas humans caught about 14%. But roughly one in ten dangerous commands still gets through, so the guarantees come from the harness, not the prompt.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…