Richland Technology
Richland Technology
← Back to Blog
llmagentsevaluationresearchcoding

Coding agents don't over-edit — they write unneeded code during the fix, and resolve rate hides it

Delta Residue Attribution replays 7,660 Copilot CLI trajectories and reverts each patch unit to test whether it was needed — the bloat is mostly tests, and the unneeded code is written during the fix, not the debugging.

Richland AI Desk·29 November 2026·6 min read
Coding agents don't over-edit — they write unneeded code during the fix, and resolve rate hides it

Microsoft researchers built a method that replays a coding agent's trajectory, reverts each block of the final patch one at a time, and reruns the task tests to decide whether that block was needed. Applied to 7,660 resolved GitHub Copilot CLI trajectories across 18 frontier models, it overturns the usual "agents over-edit" reading. Agent patches are roughly 2.3× larger than developers', but on SWE-bench Verified the extra lines are mostly tests and docs, and agent code is on average at least as necessary as developer code. The real problem is narrower: about 11% of code units are unneeded, 89% of those change runtime behavior, and they are written during the fix itself, not left behind by debugging.

Delta Residue Attribution

The paper, How Much Do Coding Agents Over-Edit, and Why? (arXiv:2611.34875) by Aakash Goel, Benjamin Steenhoek, and Yu Hu, introduces Delta Residue Attribution (DRA). The core insight is that patch size says nothing about whether the extra edits are needed, what they are, or where they come from. DRA answers that in four stages: replay the agent's logged tool calls onto the base state, trace every changed block ("unit") to the step that wrote it, label each step's role, and grade necessity by reverting each unit and rerunning the task tests.

Diagram of the Delta Residue Attribution method, which replays an agent trajectory, traces each patch unit to the step that wrote it, and reverts units to test whether they were needed

A unit is a contiguous block of changed lines within one file, classified as code, test, docs, nonsemantic, or config. Each unit is attributed to the latest step that wrote or deleted a line of it. Necessity is graded with the task-test oracle: reverting a unit that fails the tests means it was needed; reverting one that leaves the patch passing means it was not. The metric, NP_code, is the fraction of a patch's code units that are needed. On SWE-bench Verified, 96.7% of resolved trajectories replayed successfully; the rest were excluded for mismatches, self-check failures, or binary patches.

The dataset is 7,660 resolved Copilot CLI trajectories — 6,728 on SWE-bench Verified and 932 on DeepSWE — across 18 frontier models, with developer patches graded through the same pipeline as a baseline.

The bloat narrative reverses

Agent patches do touch more lines than developers' — roughly 2.3× more. But on SWE-bench Verified the majority of the extra edits are tests (61%) and documentation (13%), with only 21% being code. On DeepSWE the split flips: 58% of extra edits are code, 26% tests, 12% docs. Measured directly, agents are not sloppier: mean NP_code is 0.887 for agents versus 0.864 for developers on SWE-bench Verified, and 0.797 versus 0.785 on DeepSWE. Eleven of the 18 models leave less unneeded code than developers on SWE-bench Verified.

The extra tests are genuinely good. In a mutation-testing analysis, agent-added tests detected 68.1% of injected bugs, versus 45.6% for the repository's existing regression tests and 77.1% for the task evaluation tests. Five percent of all injected bugs were caught by the agent's new or strengthened tests but missed by the benchmark's own task tests — some of what looks like "bloat" is coverage the benchmark simply doesn't score.

Resolve rate hides what matters for review

The sharpest finding is that resolve rate and code necessity are decoupled. On SWE-bench Verified the two are essentially uncorrelated (Spearman −0.10); on DeepSWE they are negatively correlated (Spearman −0.59, p = 0.01). The models that solve more long-horizon tasks tend to leave more unneeded behavior behind — the authors stress this is an association between model-level measurements, not evidence that solving more tasks causes unnecessary edits. The paper's model contrast makes this concrete: Claude Sonnet 5 resolves 80.6% of SWE-bench Verified with an NP_code of 0.922, while Gemini 3.7 Flash resolves 81.4% but leaves roughly 3.6× more unneeded code units per task (1.23 vs 0.34). A leaderboard sorted only by resolve rate hides exactly the difference that matters for code review.

The excess is baked into the fix, not the debugging

The mechanism finding should change how you review agent output. The authors pre-registered a hypothesis that debug steps — exploring, reproducing, probing — account for at least 40% of code residue. DRA refutes it: debug steps write almost none of the unneeded code (a debug share of 0.039), while fix steps write 83% of it. "Look for stray print statements and leftover scaffolding" is the wrong review strategy. The excess behavior is baked into the fix itself, so a harness that just strips debugging artifacts cannot clean it up — the model has to change.

The pruning trade

Asking the agent to audit its own diff is precise but weak: 35.5% recall, 65.7% precision, and it breaks only 1.8% of resolved patches. A dumb mechanical revert-and-rerun loop using only the tests the agent can see (its own plus the repository's) finds two-thirds of the excess — 67.3% recall, 46.3% precision — and raises NP_code from 0.936 to 0.975, at the cost of breaking about 1 in 9 patches (89.1% still resolve). Those pruning numbers apply only to the 2,495 patches whose agent-test command passed a repeatability check, not to all resolved trajectories. That is the concrete trade: a harness-level pruner can remove most unneeded code, but it is not free, and it occasionally removes something needed.

Caveats

Every number here is the authors' own measurement, not independently replicated — the paper is days old and not peer-reviewed, and no code or data release is linked from it. The study is also narrow in scope: one harness (Copilot CLI), only resolved trajectories, and SWE-bench Verified is Python-only and possibly contaminated. DRA reverts units one at a time, so jointly-necessary pairs can be misclassified, and the behavioral probes are LLM-written.

The biggest caveat is that "unneeded by the tests" is not "unwanted by a maintainer." The task-test oracle only knows whether the patch still passes; it cannot tell whether a maintainer would reject the change. The paper itself demonstrates this: under a strengthened oracle that also checks whether a reverted unit reproduces the developer patch's behavioral change, the agents' small advantage flips — mean necessity goes from 0.925 (agents) to 0.970 (developers), a −4.5-point disadvantage. The authors flag a human labelling exercise as future work.

Sources

Start a Conversation

Ready to build something like this?

Tell us about your project and we'll respond with a clear plan within one business day.

Tell Us About Your Project

Takes 3 minutes. We read every submission personally.