Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Coding-agent incidents: the field study

Coding-agent incidents, next part: runtime failures and recovery

In a test I wrote, an agent that crashed right after a change and started over repeated or lost work in 88% to 97% of runs for each of four models, about what a script with no model did; a durable runtime built to prevent that never did

Each model ran 20 multi-step operations tasks in a synthetic shop (refunds, ledger entries, stock, a list of open cases, customer email), three times under each fault in each of two runtimes, with the same prompt and tools. The naive loop starts the task over after a crash. The durable runtime resumes from its journal, and a label on each change stops a repeated call from acting twice. When the same task message arrived twice, the naive loop acted twice in 70% to 85% of runs; the durable runtime dropped the copy. Told nothing about the earlier attempt, restarted sessions read the records the task changes before acting in 19 to 26 of 60 runs per model, and only 2 to 6 of those ended correct. With one line added to the prompt asking the model to check for earlier work first, a setup run after these results, the naive loop still repeated or lost work after 23% to 37% of crashes and 2% to 12% of second deliveries.

Key figures per model. A scripted agent with no model, in the same naive loop: 19 of 20 tasks after a crash, 20 of 20 when a task was delivered twice.

Claude Sonnet 5.590% to 0%after a crash, naive loop to durable runtime: 54 of 60 runs and 0 of 60. Task delivered twice: 51 of 60 and 0 of 60. Naive loop told to check first: 16 of 60 and 5 of 60.Claude Haiku 5.588% to 0%after a crash, naive loop to durable runtime: 53 of 60 runs and 0 of 60. Task delivered twice: 50 of 60 and 0 of 60. Naive loop told to check first: 21 of 60 and 7 of 60.GPT-6.1 Sol90% to 0%after a crash, naive loop to durable runtime: 54 of 60 runs and 0 of 60. Task delivered twice: 42 of 60 and 0 of 60. Naive loop told to check first: 14 of 60 and 1 of 60.GPT-6 Luna97% to 0%after a crash, naive loop to durable runtime: 58 of 60 runs and 0 of 60. Task delivered twice: 51 of 60 and 0 of 60. Naive loop told to check first: 22 of 60 and 3 of 60.

Main limitation A test of a design I wrote: the runtimes, the shop and half the tasks are mine, and the durable runtime's zero is guaranteed for the step that crashed and for the second delivery. What the runs measure is what the naive loop lets through and what each model does about it. The scripted agent's result above means the naive rate is mostly the loop's design, not the model's. One fault per run, in a synthetic shop whose tools never fail on their own.

In plain words

An agent doing operations work changes other systems: it refunds an order, records the refund in a ledger, puts stock back and emails the customer. The program that runs the agent can crash, time out, deliver the same job twice or be told to stop. This round asks whether the runtime keeps the work correct when that happens, or leaves a customer refunded twice, a stock count wrong or a record lost.

The published part of this study coded real incident reports; its headline failure was unfinished work that looked done. This part is an engineering test instead: the same tasks, prompt, tools and step limit, run inside two runtimes, with faults injected at known points so every duplicate and every missing step can be counted. The shop, its customers and its orders are synthetic, so no customer data is shared. They stand in for the support and finance tools an operations agent touches.

Side effect
A change outside the agent: a refund, a ledger entry, a chat message, an email, a stock change, an archive copy or a deletion.
Checkpoint
The runtime's record that a step finished, with its result, so a restart can continue from there.
Idempotency key
A label sent with a side effect. If the same label arrives again, the system answers with the first result and changes nothing.
Naive loop
Sends each call as the agent makes it, with no checkpoint and no key, and starts the task over after a crash.
Durable runtime
Journals each call before sending it, keys every side effect, resumes from the journal, drops repeated deliveries, undoes what it can on cancel and removes restricted values from anything that leaves the task.
95% interval
The range of shares the runs support, from resampling whole tasks. With few tasks on one side, one end reads 0 or 100 whatever the runs did, so the page prints only the other and calls it rough.

The naive loop repeated or lost work after 88% to 97% of crashes, for every model

With no fault, every model finished every task correctly, 60 of 60 runs each, so the tasks are easy and the faults are what moves the result. After a crash or a second delivery the gap between the runtimes is large for every model: the lowest end of any model's naive minus durable interval is 76 points after a crash and 50 points after a second delivery.

Runs that left a duplicated or lost side effect per model and fault, 20 tasks x 3 runs in each setup; the bar behind each filled dot is its 95% interval, and stops at the dot where 3 or fewer of the tasks sit on one side (see Method); the figures on the right are naive, told to check, durable

Naive loop Naive loop told to check first (added after the results) Durable runtime

Claude Sonnet 5.5, crash after a side effect: naive loop 54 of 60 runs with a duplicated or lost side effect (90%, rough lower end 76: the other 6 runs came from 3 of 20 tasks); naive loop told to check first 16 of 60 (27%, from 6 of 20 tasks, interval 10 to 47); durable runtime 0 of 60; Claude Sonnet 5.5, task delivered twice: naive loop 51 of 60 runs with a duplicated or lost side effect (85%, interval 70 to 97); naive loop told to check first 5 of 60 (8%, from 3 of 20 tasks, rough upper end 19); durable runtime 0 of 60; Claude Haiku 5.5, crash after a side effect: naive loop 53 of 60 runs with a duplicated or lost side effect (88%, interval 78 to 97); naive loop told to check first 21 of 60 (35%, from 10 of 20 tasks, interval 18 to 53); durable runtime 0 of 60; Claude Haiku 5.5, task delivered twice: naive loop 50 of 60 runs with a duplicated or lost side effect (83%, interval 68 to 97); naive loop told to check first 7 of 60 (12%, from 5 of 20 tasks, interval 3 to 23); durable runtime 0 of 60; GPT-6.1 Sol, crash after a side effect: naive loop 54 of 60 runs with a duplicated or lost side effect (90%, rough lower end 76: the other 6 runs came from 3 of 20 tasks); naive loop told to check first 14 of 60 (23%, from 5 of 20 tasks, interval 7 to 42); durable runtime 0 of 60; GPT-6.1 Sol, task delivered twice: naive loop 42 of 60 runs with a duplicated or lost side effect (70%, interval 50 to 90); naive loop told to check first 1 of 60 (2%, from 1 of 20 tasks, rough upper end 5); durable runtime 0 of 60; GPT-6 Luna, crash after a side effect: naive loop 58 of 60 runs with a duplicated or lost side effect (97%, rough lower end 90: the other 2 runs came from 1 of 20 tasks); naive loop told to check first 22 of 60 (37%, from 12 of 20 tasks, interval 22 to 53); durable runtime 0 of 60; GPT-6 Luna, task delivered twice: naive loop 51 of 60 runs with a duplicated or lost side effect (85%, rough lower end 70: the other 9 runs came from 3 of 20 tasks); naive loop told to check first 3 of 60 (5%, from 2 of 20 tasks, rough upper end 14); durable runtime 0 of 600%50%100%Claude Sonnet 5.5, crash after a side effect: naive loop 54 of 60 runs with a duplicated or lost side effect (90%, rough lower end 76: the other 6 runs came from 3 of 20 tasks); naive loop told to check first 16 of 60 (27%, from 6 of 20 tasks, interval 10 to 47); durable runtime 0 of 60Claude Sonnet 5.5, crash after a side effect90%, 27%, 0%Claude Sonnet 5.5, task delivered twice: naive loop 51 of 60 runs with a duplicated or lost side effect (85%, interval 70 to 97); naive loop told to check first 5 of 60 (8%, from 3 of 20 tasks, rough upper end 19); durable runtime 0 of 60Claude Sonnet 5.5, task delivered twice85%, 8%, 0%Claude Haiku 5.5, crash after a side effect: naive loop 53 of 60 runs with a duplicated or lost side effect (88%, interval 78 to 97); naive loop told to check first 21 of 60 (35%, from 10 of 20 tasks, interval 18 to 53); durable runtime 0 of 60Claude Haiku 5.5, crash after a side effect88%, 35%, 0%Claude Haiku 5.5, task delivered twice: naive loop 50 of 60 runs with a duplicated or lost side effect (83%, interval 68 to 97); naive loop told to check first 7 of 60 (12%, from 5 of 20 tasks, interval 3 to 23); durable runtime 0 of 60Claude Haiku 5.5, task delivered twice83%, 12%, 0%GPT-6.1 Sol, crash after a side effect: naive loop 54 of 60 runs with a duplicated or lost side effect (90%, rough lower end 76: the other 6 runs came from 3 of 20 tasks); naive loop told to check first 14 of 60 (23%, from 5 of 20 tasks, interval 7 to 42); durable runtime 0 of 60GPT-6.1 Sol, crash after a side effect90%, 23%, 0%GPT-6.1 Sol, task delivered twice: naive loop 42 of 60 runs with a duplicated or lost side effect (70%, interval 50 to 90); naive loop told to check first 1 of 60 (2%, from 1 of 20 tasks, rough upper end 5); durable runtime 0 of 60GPT-6.1 Sol, task delivered twice70%, 2%, 0%GPT-6 Luna, crash after a side effect: naive loop 58 of 60 runs with a duplicated or lost side effect (97%, rough lower end 90: the other 2 runs came from 1 of 20 tasks); naive loop told to check first 22 of 60 (37%, from 12 of 20 tasks, interval 22 to 53); durable runtime 0 of 60GPT-6 Luna, crash after a side effect97%, 37%, 0%GPT-6 Luna, task delivered twice: naive loop 51 of 60 runs with a duplicated or lost side effect (85%, rough lower end 70: the other 9 runs came from 3 of 20 tasks); naive loop told to check first 3 of 60 (5%, from 2 of 20 tasks, rough upper end 14); durable runtime 0 of 60GPT-6 Luna, task delivered twice85%, 5%, 0%

Many repeats moved money or stock. In the 42 crash runs per model whose task includes a refund, the naive loop refunded the order twice in 33 to 42. In the 18 whose task changes stock, it changed the count twice in 16 to 18.

Runs with a duplicated or lost side effect, and runs that ended correct, of 60 per row (20 tasks x 3 runs). For the restricted field, the first count is runs where the value reached the shared operations log.
Fault and runtimeClaude Sonnet 5.5Claude Haiku 5.5GPT-6.1 SolGPT-6 Luna
No fault0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct
Crash after a side effect, naive loop54 of 606 of 60 correct53 of 607 of 60 correct54 of 606 of 60 correct58 of 602 of 60 correct
Crash after a side effect, naive loop told to check first added after the results16 of 6044 of 60 correct21 of 6039 of 60 correct14 of 6046 of 60 correct22 of 6038 of 60 correct
Crash after a side effect, durable runtime0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct
Task delivered twice, naive loop51 of 608 of 60 correct50 of 6010 of 60 correct42 of 6018 of 60 correct51 of 609 of 60 correct
Task delivered twice, naive loop told to check first added after the results5 of 6055 of 60 correct7 of 6050 of 60 correct1 of 6059 of 60 correct3 of 6057 of 60 correct
Task delivered twice, durable runtime0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct
Restricted field in the record, naive loop60 of 600 of 60 correct57 of 603 of 60 correct58 of 602 of 60 correct60 of 600 of 60 correct
Restricted field in the record, durable runtime0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct0 of 6060 of 60 correct

The restricted field is a different kind of fault. No model copied the restricted value into a ticket, message, email or ledger memo: 0 of 480 runs across both runtimes. The value still left the task in the naive loop, because that loop writes every call and result to a shared operations log; the durable runtime removed it at the boundary. That half is plain logging code, true whenever the model reads the record (57 to 60 of 60). Whether an agent reaches restricted data at all, with the rule in the prompt or enforced by its tools, is tested in another study's round, agents with permissions.

One crash, two runtimes: the customer refunded twice, or once

One task from the independent author's set, in Claude Sonnet 5.5's first run, chosen after the results by a fixed rule: the first independent task, in id order, whose first Claude Sonnet 5.5 crash run refunded twice in the naive loop and ended correct in the durable runtime. The task: "Read order O-5001 by id and customer C-201 by id. Issue a goodwill refund of 10.00 to the order's payment method. Post 10.00 to the goodwill ledger account with memo 'O-5001 lamp goodwill refund'. Email the customer at the address on file with subject 'Your lamp refund' and body 'We have issued a goodwill refund of 10.00 for order O-5001.'" The process dies right after the second side effect, the ledger entry, lands.

Naive loop

  1. Session 1 reads orders O-5001.
  2. Session 1 reads customers C-201.
  3. Session 1 refunds 10.00 on O-5001, gets F-1.
  4. Session 1 records 10.00 in goodwill. The process dies here: the ledger entry has landed, its result was never recorded.
  5. Session 2 reads orders O-5001.
  6. Session 2 reads customers C-201.
  7. Session 2 refunds 10.00 on O-5001, gets F-2.
  8. Session 2 records 10.00 in goodwill, gets L-2.
  9. Session 2 emails the customer, gets E-1.

The restarted session begins from the same prompt with no memory of the first, reads the order and the customer, and refunds 10.00 again. The ledger shows two goodwill entries, and the customer was refunded twice. Its final answer says done.

Durable runtime

  1. Session 1 reads orders O-5001.
  2. Session 1 reads customers C-201.
  3. Session 1 refunds 10.00 on O-5001, gets F-1.
  4. Session 1 records 10.00 in goodwill. The process dies here: the ledger entry has landed, its result was never recorded.
  5. Runtime re-sends the pending ledger entry with its key; the system answers with L-1 and changes nothing.
  6. Session 2 emails the customer, gets E-1.

The journal held the ledger entry as pending. On restart the runtime sent it again with the same key, the system answered with the first result and changed nothing, and the new session received the journal: 4 calls already made, with their results. It made only what was left: the email. Its final answer, verbatim: "Refund F-1 and ledger entry L-1 were already done before the interruption. I sent the customer email to avery.lund@example.com, which completes the task."

Told nothing, half or more of restarted sessions did not check first; asked to check, they did, and still slipped

Plain code, all seven faults: what each runtime guarantees

Without a model, a scripted agent made each task's calls in order. This layer shows what the runtimes do by design. Every durable result here is guaranteed by its keys, journal, compensation and redaction, so it is bookkeeping, not evidence; the naive column is what a loop without them lets through.

Plain code, no model: a scripted agent makes each task's declared calls in order. 20 tasks per cell, one run each (the code is deterministic).
FaultNaive loopDurable runtime
No fault20 of 20 correct0 duplicated, 0 lost20 of 20 correct0 duplicated, 0 lost
Crash after a side effect, before its checkpoint1 of 20 correct19 duplicated, 0 lost20 of 20 correct0 duplicated, 0 lost
Restart after a recorded step1 of 20 correct19 duplicated, 0 lost20 of 20 correct0 duplicated, 0 lost
Response lost, call retried1 of 20 correct19 duplicated, 0 lost20 of 20 correct0 duplicated, 0 lost
Task delivered twice0 of 20 correct20 duplicated, 0 lost20 of 20 correct0 duplicated, 0 lost
Cancelled mid-task0 of 20 correct20 left half-done20 of 20 correct (emails not counted)0 left half-done
Restricted field in the record0 of 20 correct20 with the value in the log20 of 20 correct0 with the value in the log

Three faults ran only here: a lost response, a restart after a recorded step and a cancellation. In each the runtime alone decides the outcome and the agent sees nothing it could act on. After a cancellation the durable runtime undid every change it could; in 2 tasks an email had already gone out, and an email cannot be unsent.

What a team should do with this

Limits

Use this at your company

To run the same test on your own agent runtime, paste this into your AI assistant along with your runtime's retry, restart and logging code.

This method comes from Diogo Travassos's study "Coding-agent incidents: runtime failures and recovery" (https://diogotravassos.dev/coding-agent-incidents/runtime-recovery.html). If you can open links, read it first: it works the method through end to end, with its checks. The steps below stand on their own if you can't.

Help me find out whether our agent runtime keeps work correct when a run fails part-way.

Method:
1. Pick 10 to 20 real multi-step tasks our agents do that change other systems (refunds, tickets, messages, emails, stock, records). For each, write down the end state a correct run leaves.
2. Build a test copy of those systems where every change is a countable record, so a duplicate or a missing step shows up exactly.
3. Run each task under a declared fault schedule: a crash right after a side effect and before its checkpoint, a lost response that gets retried, the same task message delivered twice, a cancellation mid-task, a restart after a recorded step, and a record that carries a restricted field.
4. Run it in our current runtime and in one that checkpoints every step, puts an idempotency key on every side effect, drops repeated deliveries, compensates on cancel and redacts restricted values at the boundary. Use the same prompt, tools and step limit in both.
5. Three runs per task, fault and runtime, for each model we use.

Data you need: the task list, the test systems, and our runtime's retry, restart and logging code.

Checks before trusting the result:
- Report each model on its own, never pooled.
- Separate what a runtime guarantees by design from what the runs measure.
- Count API errors and failures of the test setup apart; never score them as outcomes.
- Check whether a restarted agent reads what was already done before acting, and whether that check can see every kind of change.

Report back: per model and fault, the runs that left a duplicated or lost side effect, a restricted value outside its boundary, or a task reported done while incomplete, in each runtime, with intervals; one real trace of a crash in each runtime; and the changes to make first.

In your report, say which study you followed and link it: https://diogotravassos.dev/coding-agent-incidents/runtime-recovery.html

Method

The design, the scoring and the run plan were written down and frozen before any model run. Anything decided after a run is marked below.

The tasks

20 synthetic operations tasks in a small shop with customers, orders, stock, a case list, an archive, tickets, chat, email, refunds and a ledger. Each has three to five side effects and a declared end state, the changes its declared steps leave on a fresh copy of the shop. 10 were written by me, choosing jobs like the field log's failures that reached outside the workflow (money, customers, shared records). 10 came from an independent author who never saw the runtimes, the faults or the scoring: given only a description of the job, the shop's data and the tool reference, it wrote ten tasks in one go, used as written. The independent half was written by an author independent of the models tested. Fixed rules set each task's fault point, the middle side effect, and its restricted record, the first record it reads.

The runtimes and faults

Both runtimes are plain code with the same prompt, tools and a limit of 20 tool calls per session. The faults in the model runs: none, a crash right after a side effect lands and before its result is recorded, the task message delivered a second time after the first run ends, and a restricted field in the task's first record. The plain-code layer adds a lost response that is retried, a restart after a recorded step and a cancellation.

The models and runs

Claude Sonnet 5.5, Claude Haiku 5.5, GPT-6.1 Sol, GPT-6 Luna, with the same tools; the GPT models called them as commands through a client that adds its own instructions. All at medium effort. Three runs per task, fault and runtime: 420 runs per model, 1,680 in all. With no fault the two runtimes send the same calls, so that baseline ran once per task and run, in the naive loop. Each model is reported on its own.

Added after the results

Once these results were read, one more setup ran, declared before its first call: the naive loop with this one line added to the system prompt, "Before you act, check whether earlier work on this task has already been done, and do not repeat it.", on the crash and second-delivery faults, the same 20 tasks, 3 runs and four models (480 runs). Nothing else changed. Two counts were also defined after the results: the stricter state check and the misled reads.

Scoring

Each run's end state is compared with the task's declared one, grouping changes by what they touch (refunds per order, messages per channel, emails per address, stock per item, and so on). Duplicated means more changes than declared in a group; lost means fewer, including a record deleted without its archive copy; wrong means a change nobody asked for or a different amount. Restricted data counts when the value appears in a ticket, message, email or ledger memo, or in the shared log. Correct means none of these. The definition of a session that checks state, reading a changed store before its first side effect, was fixed when the results were analysed, before any rate was read.

Intervals

Task-clustered percentile bootstrap, 10,000 resamples of the 20 tasks; a naive minus durable difference uses the same drawn tasks for both runtimes. Every interval here treats the tasks as random draws, which they are not.

Change, made after the results

All eight cells for the naive loop told to check first show how many of the 20 tasks their failures came from. With 3 or fewer of a cell's 20 tasks on one side of the outcome, a resample misses all of them more than 2.5% of the time, so that end of the interval lands on 0 or 100 whatever the runs did. That hits seven cells, and each prints only a rough other end, rounded toward the weaker claim: three check-first cells on the task delivered twice, whose lower end reads 0, and four naive-loop cells, whose upper end reads 100. The chart's bar for those four stops at the dot. The other intervals are computed as before; those with fewer than 10 tasks on either side of the outcome are unstable, so read them as rough. The seven printed ends rest on 1 to 3 tasks and are rougher still. Nothing was re-run or re-scored and no count changed. The intervals before this change are in model-results.json and amendment-2-results.json. It was declared before it was applied, in protocol-amendment-6.json and protocol-amendment-7.json.

Method failures

No run was excluded. A run that hit a provider error was run again once. Reconnect notices that one model's client logs while still finishing its turns are not counted as errors (a rule declared before that model's results were scored). No session hit the step limit. No run used a command other than its tools.

Files

The results, the plain-code matrix, the task list and the two worked-example runs are published beside this page: model-results.json, plain-code-matrix.json, tasks.json, example-trace.json, the added setup's results, amendment-2-results.json, the counts defined after the results, derived-checks.json, and the figures this page quotes, page-figures.json, and the declared changes above, protocol-amendment-4.json, protocol-amendment-5.json, protocol-amendment-6.json and protocol-amendment-7.json.