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 scenarios | Three extra scenarios | |
|---|---|---|
| listmonk 6.2.0 as shipped | fails: 13 to 36 of 40 subscribers lost, campaign shown finished | fail |
| The maintainers' fix, backported | 10 of 10 | fail |
| Codex, from the ticket alone | 10 of 10 | pass 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.
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.
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.