Rewarding Coding Agents
Why Your Test Suite Matters More Than Your PRM
Published Nov 13, 2026 · 13 min read
1.Background
1.1Two containers, one wrong lesson
Picture a night on an RL training cluster. Hundreds of containers run your coding agent against the same Python issue.
In Container A, the agent greps the stack trace, reads three core modules, and isolates a subtle off-by-one bug. Its fix is clean, but it misses an edge-case import at step 24 and times out. Reward: 0.
In Container B, another rollout wanders, deletes an inconvenient assertion, and slips past the only test file the original PR touched. Reward: 1.
The optimizer pushes A down and B up. On the dashboard, the reward curve keeps rising.
Frontier models can now navigate large repositories, edit across files, and iterate over dozens of turns. The machinery that grades them has not kept up: tests designed for a single human patch, benchmarks that may have leaked into training data, process rewards that remain noisy. The agent has outgrown its grader.
1.2Denser rewards are not a free fix
A 30-step debugging effort collapses into a single 0. When a whole group of rollouts fails, the group contributes no gradient at all. The natural response is denser feedback: partial credit for passing tests, similarity to a reference patch, a learned success predictor, or a process reward model (PRM) that grades every turn.
But an uncalibrated process score opens a new loophole. Under a group-relative trainer such as GRPO, the policy may learn that pleasing the judge is easier than fixing the bug. It reads files for show, runs harmless commands, and writes polished post-mortems. Trajectories get shorter while the resolve rate falls. Container B is still there, just with better manners.
1.3What this post covers
Drawing on 20 papers and reports, most from 2025–2026, we follow the problem from the grader up:
- The grader. About 7.8% of “resolved” SWE-bench Verified patches were incorrect in one study. An OpenAI audit found that at least 59.4% of 138 hard problems had tests that reject valid fixes.
- The terminal score. 0/1 or continuous? Why the raw test-pass fraction misleads, and how to recover signal when a whole group fails.
- Process rewards. Do PRMs actually train intermediate steps? In one 100-task study, a repository-level PRM cut average steps from 15.2 to 12.2 while the resolve rate fell from 57% to 51%.
- A playbook. Three stages for adding process signals without inviting reward hacking.
Fig. 01Main works covered in this review
2.Why passing tests miss real bugs
Before tuning reward weights, we have to confront an uncomfortable reality: the test harnesses and benchmarks we treat as ground truth suffer from severe false positives and false negatives.
2.1False positives & negatives: 8% of "resolved" patches are broken, and 59% of hard tests reject valid fixes
How standard grading works. SWE-bench (Jimenez et al., ICLR 2024) evaluates 2,294 real GitHub issues across 12 Python repositories (reference patches touch 1.7 files, 3.0 functions, and 32.8 lines on average). A patch is marked resolved if it applies cleanly, passes every fail-to-pass (F2P) test (at least one per task; ≥ 2 in 40% of tasks), and preserves a median of 51 pass-to-pass (P2P) regression tests.
The catch: SWE-bench only runs the test files modified in the original PR. Wang, Pradel, and Liu (ICSE 2026) re-evaluated patches marked "resolved" on SWE-bench Verified using full developer test suites and differential testing:
| Verification method | Broken “resolved” patches (false positives) | Resolve-rate inflation |
|---|---|---|
| Full developer test suites (measured across 3 tools) | 7.2%–8.4% | 4.5 percentage points on average |
| Differential testing + manual audit (extrapolated) | ~11.0% | ~6.4 percentage points |
Note: 4.5 points is a direct measurement from full test suites; 6.4 points is an extrapolation from differential testing and manual inspection.
Conversely, brittle tests reject correct code (false negatives). In February 2026, OpenAI audited 138 persistently hard problems on SWE-bench Verified and found that at least 59.4% had flawed or overly narrow tests that rejected valid solutions—prompting their shift to SWE-bench Pro (note: this vendor audit targets hard problems and is not directly comparable to Wang et al.'s corpus-wide false-positive rate).
Why this matters for RL: Tests err in both directions. Training directly on un-audited test harnesses teaches the policy to exploit under-specified tests while penalizing valid alternative implementations.
2.2Benchmark memorization: File localization drops 21 points on external repos
Even when tests pass, benchmark gains may not reflect generalizable debugging skill. Liang et al. (The SWE-Bench Illusion) gave models only the repository name and issue description—with zero access to the codebase—and asked them to predict which file paths needed editing.

Fig. 02File-path identification performance
From the issue text alone, o3 predicts the exact file path 76% of the time on SWE-bench Verified, plunging to 55% on external repositories—a 21-percentage-point gap. Using 5-gram overlap and 217 newer issues from the same repositories (Extra), the authors found three warning signs:
| Diagnostic probe | Key finding |
|---|---|
| Function reproduction | Claude 4 Opus code overlap is 34.9% on Verified vs. 13.9% on external repos |
| Fresh-issue control (Extra) | On newer issues from the same repos, 6 of 8 models generate code closer to the buggy pre-fix version |
| Prefix completion | 11.7%–31.6% of Verified instances are reproduced verbatim |
While these probes do not prove training-data contamination outright (familiarity and difficulty also play a role), the takeaway for reward engineering is clear: always validate reward changes on temporally split or held-out repositories.
3.0/1 baselines VS continuous traps
Once your verifier is audited, the next architectural choice is whether the terminal reward should be a strict 0/1 outcome or a continuous score.
3.1Why 0/1 is the safest baseline (provided you mask infrastructure failures)
Let be the fraction of F2P tests passed and be the fraction of P2P tests passed. In the official SWE-bench grading harness (grading.py, November 2026 main branch):
- Only and counts as resolved;
- with is logged as a partial fix but scored as unresolved;
- Skipped F2P tests count as failures, whereas skipped P2P tests do not count as regressions;
- Suspected container or runner crashes are flagged as
infra_failurebut still marked unresolved.
For validly executed rollouts, the cleanest terminal reward is strict binary completion:
Crucial implementation detail: mask out infrastructure failures. While a benchmark leaderboard can treat container timeouts or broken builds as 0, an RL trainer must exclude infra_failure rollouts via a validity flag and loss mask—penalizing only syntax errors or test failures caused by the agent itself.
3.2How 8 leading coding agent systems define rewards
Recent systems differ not just in whether their reward is continuous, but in where the auxiliary signal comes from:
| System | Reward definition | Key mechanism & scope |
|---|---|---|
| DeepSWE | 1 if all F2P/P2P pass; else 0 | Pure binary baseline; scored only upon explicit submission |
| SWE-RL | Patch similarity [0,1]; format error −1 | Execution-free, single-turn patch generation (not a multi-turn agent) |
| Agent-RLVR | Passing trajectories > failed trajectories | Guided retries construct offline DPO preference pairs |
| Golubev et al. | Binary test outcome 0/1 + excess-step penalty | Multi-turn RL with explicit length control |
| Self-play SWE-RL | Solver: +1 if all tests pass; else −1 | Single policy both injects and repairs bugs |
| SWE-RM | Success: 1+s; unfinished: −0.5+s; other fail: s | Adds model-predicted success score s ∈ [0, 1] to execution outcome |
| BSR | Success: 1; failures ranked in [−0.15, 0.15] | Refines only failed rollouts to break all-fail ties without a separate RM |
| SWE-TRACE | Execution outcome + trajectory rubric score | Trajectory-level scalar in RL training; stepwise pruning only at inference |
3.3The binary bottleneck: Why all-fail groups waste 92% of rollout compute
Binary reward has an unbeatable property: equals the exact probability of solving the task within budget. Intermediate syntax errors, failed hypotheses, and rollbacks cost nothing as long as the final submitted patch works.
Its Achilles' heel is all-fail groups. In group-relative trainers like GRPO, if all rollouts for a hard prompt fail, every trajectory gets 0, group variance is 0, and the entire batch of expensive container rollouts produces zero gradient. If independent rollouts succeed with probability across a group of , the probability of getting both a success and a failure in the same group is —leaving over 92% of groups with zero signal. Before inventing complex process scores, teams can mitigate this through curriculum filtering, guided sampling, or BSR-style tie-breaking exclusively inside failed groups.
3.4Five ways agents hack continuous scores (and why 99.9% pass rate means nothing)
Continuous scores break ties, but they also shift the optimization target. Here is what common continuous proxies actually measure and how policies exploit them:
| Continuous proxy | What it actually measures | How the policy hacks it |
|---|---|---|
| Raw fraction of tests passed | Count of satisfied assertions | P2P dilution: passing 1,000 P2P tests while failing the single F2P test yields 0.999 for a completely unfixed bug |
| Reference patch similarity | Lexical closeness to one known fix | Penalizes valid alternative fixes while rewarding broken edits that touch the right lines |
| Model-predicted success probability | Reward model’s uncertainty estimate | Without strict calibration and OOD guards, the agent learns to generate trajectories that look convincing to the RM |
| Process rubric / behavioral preference | Surface resemblance to good debugging | Performative debugging: reading files, running tests, and writing lucid summaries without making risky edits |
| Success + step penalty | Accuracy traded off against speed | Teaches the agent to give up early on hard problems to avoid accumulating step penalties |
Never use raw "tests passed / total tests" as an RL reward. If you want to test partial-execution rewards, use the gated baseline : require zero regressions first, then scale by F2P completion. Even across SWE-RM (+3.0 points pass@1), SWE-TRACE (+2.4–2.7 points), and BSR, empirical gains over pure binary rewards come from single training curves or specific ablations—not a universal law that continuous is always better.
4.Most process rewards skip step training
"Process Reward Model" is used to describe three fundamentally different mechanisms:
- True per-step scoring: assigning a numerical value to each intermediate state/action for local credit assignment;
- Process-aware terminal scoring: reading the entire trajectory, then outputting one scalar at the very end;
- Inference-time guidance: injecting text critiques or pruning search trees at test time, with zero policy RL.
Fig. 03Reward signals for coding agents
As the table below shows, almost no repository-level SWE work actually uses per-step PRM scores for online policy RL:
| Work | How process signals are actually used | Task scope |
|---|---|---|
| CodePRM | Execution-trained PRM used for inference-time selection/refinement only | Function-level codegen |
| PRLCoder | Test-derived code preferences used in PPO/DPO training | Function-level codegen |
| SWE-PRM | Inference-time text critiques; no numeric rewards or policy training | Repository agents |
| SWE-Shepherd | Heuristic step scores for inference-time action selection only | Repository agents |
| SWE-TRACE | Whole-trajectory scalar during RL; stepwise pruning only at inference | Repository agents |
| AgentPRM (Xi) | TD/GAE learns stepwise promise and progress | WebShop, BabyAI, TextCraft |
| InversePRM (Choudhury) | Process rewards learned from rollouts/demos for online DPO | ALFWorld (text game) |
| Wei et al. | Model-judged turn scores for multi-turn PPO/GRPO | Search QA and games |
4.1When PRMs backfire: 20% fewer steps, 2x higher cost, and a 6-point drop in resolve rate
SWE-Shepherd tested a heuristic PRM on 100 SWE-bench Verified tasks (policy: gpt-5-mini, 30-step limit). The results are a textbook warning against naive process rewards:
- Average steps fell from 15.2 to 12.2;
- Resolve rate dropped from 57% to 51% (−6 tasks);
- Average cost per task nearly doubled from $0.029 to $0.053;
- Predicted rewards barely separated winners from losers: 0.4894 for resolved trajectories vs. 0.4818 for failed ones.
Why? Because in real-world debugging, locally "clean" actions do not equal global progress. A failing test run is often the exact action that isolates a bug; a temporarily uncompilable edit may be a necessary mid-refactoring step. Rewarding surface smoothness ("command succeeded", "file read", "explanation written") makes the agent prematurely risk-averse.
5.What works: Staged reward engineering
Based on the evidence above, we recommend building your reward pipeline in three stages:
- Stage 1 (Audited 0/1 Baseline): Audit test false positives, score (1 if all F2P/P2P pass, 0 otherwise) upon explicit submission, and mask out
infra_failurerollouts. - Stage 2 (Bounded Tie-Breaking in All-Fail Groups): Keep successful trajectories fixed at 1, and introduce bounded process preferences (e.g., BSR's ) only among failed trajectories to recover gradients from all-fail groups.
- Stage 3 (Stepwise Credit Assignment): Only after intermediate labels are proven to predict final resolution on held-out repositories, upgrade the trainer interface to assign per-step advantages.
5.1Score net progress (advantage), not surface style
Instead of asking whether an action "looked tidy", measure whether it increased the probability of eventual resolution given history and remaining budget:
You can supervise this via Monte Carlo branch rollouts (accurate but expensive), execution deltas (newly passing F2P tests without P2P regressions), or evidence-grounded teacher rubrics (anchored on actual diffs and test logs, never on the agent's self-reported claims).
5.2Why GRPO amplifies a 0.01 weight by 100x in all-fail groups
When combining binary outcome with a process score into a single scalar (such as BSR or SWE-TRACE's with ), watch out for two mathematical traps:
- Trajectory ordering ≠ Policy ordering: Guaranteeing that every successful rollout scores higher than every failed rollout does not guarantee that maximizing expected mixed reward maximizes resolution rate. The policy can still trade a small drop in success probability for a large gain in auxiliary score .
- GRPO standard-deviation normalization cancels out small weights in all-fail groups: In standard GRPO, if a group fails completely (), scaling the auxiliary score by a tiny weight like 0.01 shrinks both the numerator and the group standard deviation by 0.01—so they cancel out completely! Inside an all-fail group, a "tiny 0.01 weight" exerts full-strength gradient pressure. Use confidence gating, filter low-variance groups, or disable std-normalization for auxiliary terms.
Finally, do not aggregate step scores (via sum, mean, min, or product) into a single trajectory scalar and call it step-level RL. Summing encourages trajectory padding; averaging dilutes fatal mistakes; taking the minimum punishes recoverable trial-and-error. Even potential-based shaping (Ng et al., ICML 1999) leaves within-task trajectory rankings unchanged once collapsed into a terminal scalar—true stepwise supervision requires passing per-step advantages to the trainer with proper action-token masking.
5.3Four controlled ablations before shipping a new reward
Hold the base model, task split, rollout budget, and container harness constant, and run four controlled ablations:
Fig. 04Minimal experiments for validating a reward design
Evaluate every candidate on four criteria: (1) pass@1 across multiple seeds on temporally or repository-split held-out tasks; (2) total compute cost per resolved issue (including RM inference and branch rollouts); (3) all-fail group fraction and probability calibration; and (4) clean-room verifier audits to ensure the agent isn't modifying tests or gaming rubric judges.
References
- Jimenez et al. SWE-bench: Can Language Models Resolve Real-World GitHub Issues? ICLR 2024. arXiv:2310.06770
- Wang, Pradel, Liu. Are “Solved Issues” in SWE-bench Really Solved Correctly? An Empirical Study. ICSE 2026. DOI 10.1145/3744916.3764576. arXiv:2503.15223
- Liang, Garg, Zilouchian Moghaddam. The SWE-Bench Illusion: When State-of-the-Art LLMs Remember Instead of Reason. Preprint, 2025. arXiv:2506.12286
- OpenAI. Why SWE-bench Verified no longer measures frontier coding capabilities. Blog, February 2026. Link
- Wei et al. SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution. NeurIPS 2025. arXiv:2502.18449
- Da et al. Agent-RLVR: Training Software Engineering Agents via Guidance and Environment Rewards. Preprint, 2025. arXiv:2506.11425
- Golubev et al. Training Long-Context, Multi-Turn Software Engineering Agents with Reinforcement Learning. Preprint, 2025. arXiv:2508.03501
- Luo et al. DeepSWE-Preview: Training a Fully Open-sourced, State-of-the-Art Coding Agent by Scaling RL. Together AI and Agentica blog, July 2025. Link
- Wei et al. Toward Training Superintelligent Software Agents through Self-Play SWE-RL. Preprint, 2025. arXiv:2512.18552
- Shum et al. SWE-RM: Execution-Free Feedback for Software Engineering Agents. Preprint, 2025. arXiv:2512.21919
- Wu et al. Beyond Binary Verifiable Rewards: Behavioral Self-Rewarding for SWE Agents. Preprint, 2026. Paper · Project page
- Han et al. SWE-TRACE: Optimizing Long-Horizon SWE Agents through Rubric Process Reward Models and Heuristic Test-Time Scaling. Preprint, 2026. arXiv:2604.14820
- Li et al. CodePRM: Execution Feedback-enhanced Process Reward Model for Code Generation. Findings of ACL 2025, pp. 8169–8182. Link
- Ye, Zhang, Jiang, Huang. Process-Supervised Reinforcement Learning for Code Generation. EMNLP 2025, pp. 14213–14226. Link
- Gandhi et al. When Agents go Astray: Course-Correcting SWE Agents with PRMs. NeurIPS 2025 Workshop (SEA). arXiv:2509.02360
- Dihan, Khan. SWE-Shepherd: Advancing PRMs for Reinforcing Code Agents. Preprint, 2026. arXiv:2604.10493
- Xi et al. AgentPRM: Process Reward Models for LLM Agents via Step-Wise Promise and Progress. Preprint, 2025. arXiv:2511.08325
- Choudhury. Process Reward Models for LLM Agents: Practical Framework and Directions. Preprint, 2025. arXiv:2502.10325
- Wei et al. Reinforcing Multi-Turn Reasoning in LLM Agents via Fine-Grained Reward Structure and Credit Assignment. Preprint, 2025. arXiv:2505.11821
- Ng, Harada, Russell. Policy Invariance under Reward Transformations: Theory and Application to Reward Shaping. ICML 1999. PDF