TRANSMISSION // 2606.16062v2
When Coding Tests Reward the Wrong Fix
Source published
A code-training reward can be misleading if tests pass patches that do not solve the requested issue. An audit of SWE-bench tasks and public training trajectories finds that execution against reference fixes changes the picture: attackers sometimes return the correct patch, generated repair tests often fail on the reference, and model-judged repairs can be wrong. The study argues for running tests against both the reference fix and the proposed exploit, while noting limits in its samples and automated reviews.

In code reinforcement learning, a program can earn a reward simply by passing a task’s tests. But what if those tests also accept a patch that leaves the reported bug unfixed? Shreshth Rajan’s preprint audits this risk—and shows why a passing test, or an AI judge’s approval, is not enough to establish that a patch is wrong or that a repair works.
A test pass is not the same as a correct fix
When a coding model is trained with reinforcement learning, it can receive a reward for passing a task’s test suite. That gives the system a practical signal: make changes that get the tests to pass. The signal can go astray, however, if the tests accept a patch that does not handle the problem described in the issue. Training would then reward a test-passing result, not necessarily the intended fix.
Shreshth Rajan’s preprint, Auditing Reward Hackability in Code RL Training Environments, asks how often this happens in public coding tasks and whether automated tools can reliably find and repair the weakness. Its central methodological choice is to compare candidate patches with the task’s reference, or “gold,” patch using code execution—not to treat a passing test or an AI reviewer’s verdict as ground truth.
Checking patches by running them
The study examines 49 tasks from SWE-bench Verified, drawn from two repositories. An AI attacker proposes patches intended to pass each task’s tests without solving its issue. The researchers first check which patches the benchmark harness accepts. They then compare accepted candidates with the gold patch, including by running generated probes—inputs used to see whether the candidate and reference behave differently.
Under the paper’s definition, a task is hackable if it accepts a test-passing patch that behaves differently from the gold patch. This does not automatically mean the alternative is invalid: different code can sometimes implement a valid fix. The researchers therefore also consider whether a difference appears on a case described in the issue, and use model review to assess some cases.
The paper also studies public SWE-bench submissions and training trajectories from two datasets. For repair, an AI writes tests meant to block exploits. The researchers run each test on both the gold patch and its target exploit. A useful repair test should pass on the reference fix and fail on the exploit.
What the audit found
With Claude Sonnet 4 as attacker, 11 of 49 SWE-bench tasks—22.4%—accepted a patch that differed behaviorally from the gold fix under the study’s checks. A stronger attacker, Claude Sonnet 5.5, found such patches for 57.8% of tasks across three runs. These are rates for particular attackers and methods, not fixed properties of every possible use of the benchmark.
A key safeguard was checking whether an apparent exploit was actually just the correct fix. Without seeing the gold patch, the attacker returned it for about 31% of its passing “exploits.” A test pass alone would have counted those as evidence of a broken task; comparison with the reference showed otherwise.
Across 134 public submissions, models passed tasks flagged by the stronger attacker more often than difficulty-matched tasks. But much of this difference tracked whether the attacker could pass a task at all. When the researchers also matched tasks on that passability, the remaining association was smaller, though still statistically detectable when results from three attacker runs were pooled. This is a correlation, not evidence that hackability caused higher model scores.
Repair proved difficult to verify. In the gated repair run, 65 of 105 tests that produced a clear pass-or-fail result failed on the gold patch. Among judge verdicts that execution could resolve, the language-model judge was wrong in 30 of 61 cases. In the cleanest repair comparison, the judge claimed seven of eight hackable tasks were repaired, but execution confirmed one.
The training-data analysis also found issue-related behavioral differences between some submitted trajectories and reference fixes. For the SWE-smith trajectories, an AI review judged 6.9% of 873 examined cases to be wrong fixes; a second review supported 6.4%, while either of two reviews marked 10.5%. The authors stress that these are model judgments, not human labels. In a second dataset, R2E-Gym, one review judged 5.4% of examined trajectories to be wrong fixes, with a second review confirming most of those cases.
Why execution matters—and what remains uncertain
The study’s practical message is narrow but important: where code can decide the question, run it. Check that an exploit differs from the reference, check that a generated test accepts the reference, and run that test against the exploit. Automated reviewers can help identify candidates, but their verdicts should not substitute for these checks.
The results have limits. The SWE-bench sample covers 49 tasks from only two repositories, and the repair experiment involves just eight hackable tasks. A probe can miss behavioral differences, and differing from a reference does not by itself prove a patch is wrong. Some findings rely on AI-written probes or reviews, and the study’s training-data samples cover selected repositories rather than random samples of the full datasets. Results may also vary with the attacker and prompt; the authors report substantially different rates for different attackers.
This is a preprint, not a peer-reviewed publication. Its version 2 adds execution checks that revise earlier reported results, including hackability and repair figures. The evidence supports caution about test-based rewards and automated repair claims; it does not establish that leaky tests cause broader misalignment or demonstrate a specific effect on reinforcement-learning training outcomes.
- code reinforcement learning
- reward hacking
- software testing
- SWE-bench
- AI evaluation
- coding agents
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
What makes a software repair hard for an AI coding agent?
Source published
Shared keywords: coding agents, software testing, swe bench
A Proposed Way to Secure Coding-Agent Benchmarks
Source published
Shared keywords: ai evaluation, software testing
What Coding Agents Can—and Can’t—Do With Tests
Source published
Shared keywords: coding agents, software testing
Testing AI coding agents on branching clinical rules
Source published
Shared keywords: coding agents, software testing
Can AI Improve Its Writing by Changing How It Judges Itself?
Source published
Shared keywords: ai evaluation, reward hacking