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.
Naive loop Naive loop told to check first (added after the results) Durable runtime
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.
| Fault and runtime | Claude Sonnet 5.5 | Claude Haiku 5.5 | GPT-6.1 Sol | GPT-6 Luna |
|---|---|---|---|---|
| No fault | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct |
| Crash after a side effect, naive loop | 54 of 606 of 60 correct | 53 of 607 of 60 correct | 54 of 606 of 60 correct | 58 of 602 of 60 correct |
| Crash after a side effect, naive loop told to check first added after the results | 16 of 6044 of 60 correct | 21 of 6039 of 60 correct | 14 of 6046 of 60 correct | 22 of 6038 of 60 correct |
| Crash after a side effect, durable runtime | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct |
| Task delivered twice, naive loop | 51 of 608 of 60 correct | 50 of 6010 of 60 correct | 42 of 6018 of 60 correct | 51 of 609 of 60 correct |
| Task delivered twice, naive loop told to check first added after the results | 5 of 6055 of 60 correct | 7 of 6050 of 60 correct | 1 of 6059 of 60 correct | 3 of 6057 of 60 correct |
| Task delivered twice, durable runtime | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct |
| Restricted field in the record, naive loop | 60 of 600 of 60 correct | 57 of 603 of 60 correct | 58 of 602 of 60 correct | 60 of 600 of 60 correct |
| Restricted field in the record, durable runtime | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 of 6060 of 60 correct | 0 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
- Session 1 reads orders O-5001.
- Session 1 reads customers C-201.
- Session 1 refunds 10.00 on O-5001, gets F-1.
- Session 1 records 10.00 in goodwill. The process dies here: the ledger entry has landed, its result was never recorded.
- Session 2 reads orders O-5001.
- Session 2 reads customers C-201.
- Session 2 refunds 10.00 on O-5001, gets F-2.
- Session 2 records 10.00 in goodwill, gets L-2.
- 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
- Session 1 reads orders O-5001.
- Session 1 reads customers C-201.
- Session 1 refunds 10.00 on O-5001, gets F-1.
- Session 1 records 10.00 in goodwill. The process dies here: the ledger entry has landed, its result was never recorded.
- Runtime re-sends the pending ledger entry with its key; the system answers with L-1 and changes nothing.
- 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
- Told nothing, half or more of restarted sessions did not check first. A session counts as checking when it reads a store the task changes (refunds, tickets, messages, emails, ledger, archive, stock) before its first side effect. After a naive restart following a crash, Claude Sonnet 5.5 checked in 26 of 60, Claude Haiku 5.5 checked in 21 of 60, GPT-6.1 Sol checked in 22 of 60, GPT-6 Luna checked in 19 of 60; of those, 6, 4, 5, 2 ended correct, in the same model order. After a second delivery, 30, 21, 30, 21 of 60 checked and 8, 2, 18, 3 of those ended correct, so GPT-6.1 Sol's checks worked in 18 of 30. A stricter count, decided after the results, leaves out stock reads and reads the task instruction itself names: then 12, 10, 4, 3 of 60 crash restarts and 22, 15, 19, 5 of 60 second deliveries checked.
- This shop shows no stock history. A stock count shows the level, not whether this task already moved it. Of the 71 crash restarts across the four models that checked and still went wrong, the duplicated or missing change was a stock change in 59 runs, a refund in 48, an archive copy in 28, a ledger entry in 23, a chat message in 10 and an email in 2 (a run can have more than one). Some checks were also misled by the shop: asking a store for a record by an id it does not use, such as refunds by order id, returns not found even when the refund exists. That happened in 16 naive crash restarts, 12 of which then repeated or lost work, 2 of them GPT-6 Luna runs of the same return task.
- Told to check first, they looked, and the damage fell without vanishing. In a setup run after these results, one line added to the system prompt asked the model to check for earlier work before acting; nothing else changed. Restarted sessions then read state first in 60 of 60 runs per model, and the naive loop repeated or lost work after 16, 21, 14, 22 of 60 crashes and 5, 7, 1, 3 of 60 second deliveries, in model order, against 0 for the durable runtime. After a crash, the changes still duplicated or missing were a stock change in 58 runs, a chat message in 8, an archive copy in 7, an email in 6 and a deletion in 1 (a run can have more than one). Checking also lost some work: in 13 of these runs a step went missing, and 2 of them ended with the agent reporting the task done.
- Given the journal, no model repeated a recorded call. Across the 60 durable crash runs per model, none left a duplicated or lost effect. For the call that crashed this is the key's doing; for the calls before it, no durable run repeated an effect the journal listed, which is measured, not guaranteed. Durable restarts that still read state first: Claude Sonnet 5.5 8 of 60, Claude Haiku 5.5 0 of 60, GPT-6.1 Sol 0 of 60, GPT-6 Luna 0 of 60.
- In the main design, lost work was rare and never hidden. In 15 naive crash runs across the four models a step went missing (a chat message in 14 runs, a deletion in 2 and an email in 1); 15 of the 15 ended with the agent reporting the task incomplete. Across all 1,680 runs of the main design, 0 reported done while a declared step was missing. That is the opposite of the field log's headline failure, on tasks this short. A duplicate was another matter: most naive crash runs that duplicated a change ended with the agent reporting the task done, 49 of 54, 44 of 50, 51 of 52, 51 of 56 in model order.
- Repairs were rare. In 3 runs a model undid an extra effect with the undo tool.
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.
| Fault | Naive loop | Durable runtime |
|---|---|---|
| No fault | 20 of 20 correct0 duplicated, 0 lost | 20 of 20 correct0 duplicated, 0 lost |
| Crash after a side effect, before its checkpoint | 1 of 20 correct19 duplicated, 0 lost | 20 of 20 correct0 duplicated, 0 lost |
| Restart after a recorded step | 1 of 20 correct19 duplicated, 0 lost | 20 of 20 correct0 duplicated, 0 lost |
| Response lost, call retried | 1 of 20 correct19 duplicated, 0 lost | 20 of 20 correct0 duplicated, 0 lost |
| Task delivered twice | 0 of 20 correct20 duplicated, 0 lost | 20 of 20 correct0 duplicated, 0 lost |
| Cancelled mid-task | 0 of 20 correct20 left half-done | 20 of 20 correct (emails not counted)0 left half-done |
| Restricted field in the record | 0 of 20 correct20 with the value in the log | 20 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
- Do not count on a model that is told nothing to notice. Told nothing about the earlier attempt, the models looked before acting in at most 26 of 60 restarts. One prompt line asking them to check, run after these results, cut the damage to 23% to 37% of crashes, still well above the durable runtime's zero, and a check cannot see what the shop does not record. Put the protection in the runtime, and tell the agent when a run is a retry.
- Checkpoint every side effect, and write the entry before the call. A record written only after the call is exactly what a crash between the two loses.
- Key every side effect by run and step. The systems an agent changes should honour the key; for one that cannot, the runtime looks up the effect before it retries.
- Drop repeated deliveries by message id, before an agent starts on the copy.
- Write a compensation for every reversible effect, and put irreversible ones last. Emails and external notices go after the money moves are done.
- Redact at the boundary, logs included. No model in this test leaked the restricted value; the debug log did.
- Test it like this before trusting it. Owners: the platform team owns the runtime and its fault tests; each team that gives agents a tool lists its side effects and their compensations; finance and support reconcile refunds and emails sent by agents each week, and a duplicate goes to the platform owner the same day.
Limits
- A test of a design, mostly self-written. I wrote both runtimes, the shop, the scoring and half the tasks. The other 10 tasks came from an independent author who never saw the runtimes or the faults. After a crash the naive loop went wrong in 28 to 30 of 30 runs per model on the independent tasks and 23 to 28 of 30 on mine, so the naive loop's failures do not come from tasks I wrote to break it.
- The durable zeros are largely by construction. Only the models' behaviour after resuming from the journal is measured there.
- Short, easy tasks. With no fault every model finished every task; each has three to five side effects. Longer tasks, flaky tools and several agents on one job are untested.
- One fault per run, at a fixed point: the middle side effect of each task.
- The shop has no guards of its own: a refund beyond the order total goes through, and stock history cannot be read. A read by an id the store does not use answers not found, which misled some checks.
- Small numbers per cell. 60 runs per model and fault over 20 tasks; the intervals resample whole tasks and are wide where a model is between the extremes.
- The prompt named restricted fields. With the rule in the prompt no model copied the value; without it, the result could differ.
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.