Larger coding-agent patches can still contain needed code
How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches · arXiv:2611.34875
In plain words
Delta Residue Attribution (DRA) is a method for finding which step in a coding agent’s work added each block to its final code patch.
On tested Python repository tasks, the task tests judged agents’ code at least as necessary as developers’ code on average: removing a larger share of developers’ code blocks made the tests reject the patch.
DRA checks blocks one at a time by undoing each and rerunning the task tests. This tells what those tests need, not necessarily what a developer intended.
The research
Patch length can make a coding agent’s work look wasteful, but it cannot show which changes are unnecessary. The distinction matters when interpreting a large patch: task-test evidence suggests that much of its code may be needed, while extra tests and documentation can also contribute to its size.
Delta Residue Attribution traces each patch block to the agent step that wrote it, then tests whether removing it makes task tests fail.
On SWE-bench Verified, a set of Python tasks whose tests check whether patches resolve the task, DRA judged code units by removing them one at a time and rerunning those tests. The average share whose removal made tests reject the patch was 88.7% for agents and 86.4% for developers.
This supports a narrower conclusion: larger agent patches did not mean less test-needed code on average.
DRA’s necessity labels depend on the task tests, which may miss behavior that matters to a developer. Reverting one unit at a time can mislead when units interact or a block mixes changes, and the study covers resolved patches only.
What the evidence shows
- Measure need, not size
Delta Residue Attribution (DRA) traces each block in a coding agent’s patch to the trajectory step that wrote it, then checks whether removing it makes task tests fail. SWE-bench Verified is a set of Python repository tasks scored by whether patches pass issue tests.
Under those tests, mean code necessity precision was 0.887 for agents and 0.864 for developers: the share of code blocks whose removal made the tests reject the patch.
- Extra edits vary by type
The comparison changes how patch size should be read: more changed lines do not by themselves mean more unnecessary code. On SWE-bench Verified, extra edits included test-file changes, which the task tests do not grade, as well as code judged unneeded by those tests.
Across the extra edits, 61% were test-file edits; the measure therefore separates patch composition from code necessity.
- A second task collection
The pattern also depends on the task collection. DeepSWE contains longer coding tasks in several languages, and each task is judged with its own tests.
Code made up 58% of extra edits there, unlike the predominance of test-file edits on SWE-bench Verified. The categories describe shares of extra edits, not shares of all changed lines.
- Test- unneeded can still matter
A second check suggests that task tests miss some behavior. GPT-6.1 Sol wrote behavioral probes for code units the task tests had judged unneeded, comparing the full patch with versions missing one unit.
The probes found that removing many of these units changed behavior. This confirms they could affect behavior, but does not show whether the change was useful or intended.
- Most residue came with fixes
Trajectory attribution locates most task-test-unneeded code in the steps that build the fix, with little attributed to debugging in this cohort. This points to fix steps as the main source here, though the role labels were assigned automatically and had no human audit.
Deep
- Original paper authors
- Aakash Goel, Benjamin Steenhoek, Yu Hu
- Submitted to arXiv
- License
- arXiv non-exclusive