R364 · AI-built software and its verification › Test oracles for agent-written code

Agents that write the generators: Ephyra and $4-a-bug property testing

Read the original

agent-testingtest-oraclesproperty-based-testingreward-hackingopen-sourcetoken-cost

Ephyra, a property-based testing library in Rust from Datadog. Repository public 16 Oct 2026 (MIT, 415 stars); paper arXiv:2611.23282v1, Alperen Keles, 23 Oct 2026, to appear at the Future of Property-Based Testing workshop at POPL'27; results write-up 24 Nov 2026.

The division of labour, which is the actual idea

Property-based testing has always had one bottleneck, and it is not the property. Stating a rule the software must keep — sorting preserves the multiset, a parser round-trips, two logically equivalent queries return the same rows — is usually easy. Writing a generator that produces inputs interesting enough to break the rule is the hard part, and it is where most PBT efforts quietly stall: the generator produces valid-but-shallow inputs, the property passes forever, and the suite becomes decoration.

Ephyra's split puts the human on the easy half and the agent on the hard one. An engineer writes the property. A coding agent writes the generator, measures code coverage, and rewrites the generator to reach further. The project describes this as inductive, in contrast to coverage-guided fuzzing's deductive mutation of a seed corpus: rather than mutating inputs toward new coverage, the agent edits the program that produces inputs.

The mechanism is worth stating precisely because it is the transferable part. On the headline case study, a database engine, the loop ran 37 rounds, over which the generator's coverage of the engine's instrumented counters went from 35.9% to 74.1% and the SQL features it could emit went from 79 to 261. That run found 26 bugs. The generator did not get luckier; it got broader, and breadth is a property of source code that an agent can read, diff and extend.

The numbers, and the cost line nobody quotes

Across 26 well-tested open-source systems the project reports 535 unique, previously unknown bugs, every one validated with a minimal reproducer and reported upstream, of which 373 have been confirmed and 313 already fixed. Targets include database engines, query planners, a URL parser, a policy engine, an SQL equivalence prover, Rust reimplementations of standard Unix tooling, and compilers. Bug ages run from under a day to 24 years.

The individual findings are a good advertisement for differential and metamorphic oracles. A 24-year-old compiler bug where a non-exhaustive match crashed instead of raising the language's own match-failure exception. A ~13-year-old case where three deletes corrupted a database file. A 670-byte query that needed close to 100 GB to parse, in a system at least 21 years old. An SQL equivalence prover that proved 0.1 and 0.100000001 equivalent, because it read constants as 32-bit floats. A LIMIT 1 that returned three rows.

But the number to carry into a planning conversation is in the paper's closed-loop table, and it is a cost:

TargetPropertyBugsCoverage
Rust coreutilsdifferential vs. GNU coreutils3033.4%
Rust shelldifferential vs. bash1735.7%
Rust gitdifferential vs. git1427.3%
Analytical DBTLP, NoREC, optimizer toggles1122.4%
Query engineTLP, NoREC, rule toggles834.9%
Total80

Agent spend for those 80 bugs: $67 setup, $195 triage, $68 write-up, $330 total. About $4 per previously-unknown bug in mature, heavily-tested software.

Two readings follow. First, at that price the economics of finding bugs in your own system have changed category, not degree — this is below the cost of a single engineer-hour per several bugs. Second, and more useful for designing your own loop: triage is 59% of the spend. Generation is cheap, coverage is cheap, deciding what a finding means is where the money goes. Any plan that budgets for discovery and not for adjudication has the proportions backwards.

Note also what the oracles are. Three of the five closed-loop targets are differential against a mature reference implementation, and the other two use metamorphic relations over query plans (partitioning a query three ways and requiring the parts to sum to the whole; toggling optimiser rules and requiring identical results). Neither requires anyone to know the right answer in advance. That is why this works on systems nobody has a specification for.

Two things the authors say about their own work that coverage of it drops

The results do not validate the library. From the paper's discussion: the experimental contribution is not unique to Ephyra, any PBT library could be set up with a similar optimisation loop, and similar results would be expected. The 24 November write-up agrees that the work does not yet validate the library's design choices, with reliability, cost and generality still to be measured.

This is unusually honest and it changes what the number is evidence for. 535 bugs is evidence that agent-optimised generators work, not that this library is the way to get them. A team already invested in an existing PBT library should read this as a result they can reproduce in their own stack, and the library as a convenient set of primitives rather than a prerequisite.

Reward hacking is the named open problem. Also from the discussion: given a metric, an agent can optimise the metric rather than the testing power it stands for; designing metrics that resist gaming, and detecting when gaming is happening, remains open. Coverage is the metric here. An agent can raise line coverage with inputs that exercise paths shallowly, or that reach code through degenerate values, without improving the chance of falsifying anything. There is no published measurement of how often this happened, only the statement that it did.

The practical consequence: coverage is a usable optimisation target precisely because bugs found provides the outer check. Coverage alone, with no downstream bug count to validate it, would be the wrong metric to hand an agent and walk away from. The loop is sound because it is two-level — and if you adopt the technique, keep the second level.

Provenance discipline worth copying

The paper publishes a per-bug table: every bug with its upstream report identifier and its status. The status vocabulary includes the unflattering outcomes — fixed, reported, not yet reported (write-up ready but unfiled), won't report (decided against), duplicate (an existing issue already covers it), and declined (upstream closed it as not planned).

A headline bug count is cheap to produce and nearly impossible to evaluate. A per-bug table with upstream ids, duplicates admitted and declined reports counted is a claim a reader can audit. This is the standard to hold any "our agents found N bugs" claim to, including your own: if the declined and duplicate columns are missing, the number is not yet a result.

Tradeoffs and failure modes

Review checklist for an "agents found N bugs" claim

  1. Is there a per-bug table with upstream report identifiers, or only a count?

  2. Does the status vocabulary include duplicate, declined and won't-report? How many fall in each?

  3. How many reported bugs are confirmed, and how many are merely filed? Confirmed and fixed are different numbers.

  4. What is the oracle — differential against a reference, metamorphic over the system's own behaviour, or a human-written assertion? The first two scale without a specification; the third does not.

  5. What is the optimisation metric, and what prevents the agent from gaming it? Is there an outer check that the metric is still buying what it stands for?

  6. What is the cost per bug, split into discovery and triage? If triage is not the larger half, ask what is not being triaged.

  7. Who validates a finding before a maintainer hears about it, and is that step automated?

  8. What is the false-positive rate, and if it is not published, what is the plan for absorbing it?

  9. Would the result survive on a different testing library? If the authors say yes, treat tool choice as a convenience rather than a finding.

  10. For a differential setup: is the reference implementation's behaviour deterministic, and is the comparison sandboxed?

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.