BlogUse case

Training environments from real systems, graded by what actually happened

Frontier coding agents now fix the bugs they are pointed at. What stays scarce is the failure nobody has found yet, and a grader a clever fix cannot fool. Afterfault builds environments from real software that supply both.

Every lab that trains coding agents needs tasks the agent cannot already do, and a way to tell a real fix from one that only looks right. Both run out fast. A benchmark leaks into training data, a bug gets fixed upstream, a model gets better, and a set of tasks that took months to build is spent.

We wanted to know how hard a task has to be before it stays hard. So on 19 November 2026 we built two sets of tasks on our own engine and ran Codex (GPT-6.2 Sol, at its xhigh setting) on both. The answer changed what we think a training environment is for.

Ten seeded bugs, ten fixes

The first set was the obvious version. One small service: a worker takes orders from a queue, sends each one to a partner's webhook, and records it as done. A reference version handles every failure we could think of. We broke it ten ways, one or two real reliability bugs per task: an idempotency key that changes on every retry, an order recorded before it is sent, a shutdown handler that throws away work in flight, and so on.

The agent got the broken code, an on-call ticket describing one symptom, and a recipe that reproduces that one failure. Grading reran the service under nine scenarios it had not seen and counted what the partner actually received.

10 of 10

tasks fixed, every scenario passing

4 to 7 min

per task

100%

of a random search of 40 fault schedules per task, none seen in advance

(A few schedules in each search ended inconclusive, when the fault missed its moment; every schedule that gave a verdict passed.)

It did not patch the symptom. It rewrote the worker properly: atomic queue operations, a key that stays stable across retries, careful backoff. A seeded bug this size is a warm-up for a frontier agent.

A real bug, from a vague ticket: solved, and better than the maintainers

The second set used real software. listmonk is an open-source newsletter server, about a hundred thousand lines of Go. In version 6.2.0, a restart in the middle of a campaign skips subscribers while the campaign still reports finished. We wrote up how we found it: in one recorded run, 24 of 40 subscribers never got the email.

This time the agent got the source, a running stack and a ticket that only described what a customer would notice:

No failure recipe, no file names. Grading built the agent's code and ran it through ten hidden scenarios: restarts and kills mid-campaign, kills just before and just after the mail server accepts a message, database restarts, cut and partitioned networks, a stalled process. We also ran three scenarios we did not score, because the maintainers' own fix fails them: the mail server refusing a message once, refusing three times, and a long network cut.

Ten scored scenariosThree extra scenarios
listmonk 6.2.0 as shippedfails: 13 to 36 of 40 subscribers lost, campaign shown finishedfail
The maintainers' fix, backported10 of 10fail
Codex, from the ticket alone10 of 10pass all three

Codex took 13 minutes. It found the cause on its own: listmonk moves its checkpoint when it fetches a batch of subscribers, not when it sends them. Its fix records each recipient's delivery only after the mail server accepts the message, marks a campaign finished only when nothing is pending, and adds a migration for campaigns already in flight. That covers cases the fix that shipped upstream (commit a729a4a6) does not.

The fix is no longer the hard part. Finding the failure is.

What stays hard

If the agent can fix what it is shown, the scarce parts of an environment move to either side of the fix.

Finding the failure. Nobody filed a ticket for listmonk's skipped subscribers until someone went looking. While building this task we found a second problem nobody had pointed us at: listmonk does not retry a message the mail server refuses. Failures like these do not sit in a bug tracker waiting to be turned into tasks. They are found by running the real system through crashes, restarts and cut connections in many orders and checking the outcome, which is what our engine does.

Grading the fix. A grader that runs the agent's own tests, or asks the system whether it worked, rewards a fix that makes the symptom go away. That is how reward hacking gets learned.

01 A real system listmonk v6.2.0, its PostgreSQL and a mail server, rebuilt from the project's own files. 02 Search for a failure Crashes, restarts and cuts at different moments, until the outcome is wrong: 24 of 40 never arrive. hidden 03 The task The source and a ticket that describes the symptom. No failure recipe, no pointer to the code. 04 The agent's fix Any change to the source. Only the code is kept; the agent's own tests and claims are ignored. 05 Hidden grading Ten failure scenarios, each judged by what the mail server received, not by what listmonk says. hidden fix holds: find the next failure
One environment, end to end. The failure search and the grading are hidden from the agent. A fix that holds is the signal to search for the next failure in the same system.

A grader that checks the other side

Our grader never asks the system under test how it went. It counts what arrived on the other side: the partner's webhook, the mail server. It reruns the agent's code under failures the agent was never shown.

Here is why that matters. On the first set, one task shows the agent a worker killed right after the partner accepted an order, so the partner gets it twice. A plausible wrong fix is to record the order as done before sending it. The duplicate disappears and the visible failure passes. Under two failures the agent never saw, that fix loses orders and records them as done.

Wrong fix records, then sends Reference fix records after accept Killed after the partner accepts THE TICKET Killed before the partner accepts HELD OUT Partner returns 503 HELD OUT Each order arrives exactly once An order never arrives, and is recorded as done An order never arrives, and is recorded as done Each order arrives exactly once Each order arrives exactly once Each order arrives exactly once
Two fixes for the same ticket. The wrong one passes the failure the agent was shown, and loses orders under the ones it was not.

Why build from real systems

  • The failure is the task. The environment does not need a hand-written bug. It needs a real system and a search that finds where it breaks. A system that holds today gets a longer search tomorrow.
  • Real complexity comes free. A hundred thousand lines of Go, a database, a mail server and the timing between them are the parts that make a task hard, and nobody has to fake them.
  • The check sits outside the agent. What arrived, what was saved, what was lost. The agent cannot argue with it, and neither can a model trained against it.

Working with labs

If your team trains or evaluates agents on backend work and wants environments that come with a failure nobody has seen and a grader that checks the outcome, talk to us.

Keep reading

Bring a system you need to trust.

Tell us what it runs on and which failure worries you most.

Request early access