Larger agent patches do not necessarily contain more unnecessary code proportionally
Source → Observed → Interpretation → Model implication
How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches
View source →The study analyzes 7,660 resolved Copilot CLI trajectories from 18 models: 6,728 on SWE-bench Verified and 932 on DeepSWE.
Delta Residue Attribution links final patch units to the steps that wrote them, then reverts each unit individually and reruns task tests. The study applies the same necessity test to developer patches.
Mean code-unit necessity was 88.7% for agent patches versus 86.4% for developer patches on SWE-bench Verified, and 79.7% versus 78.5% on DeepSWE.
On SWE-bench Verified, 61% of extra edits were tests and 13% were documentation; on DeepSWE, 58% were code.
On SWE-bench Verified, 89% of agent code units classified as unnecessary changed behavior. Pruning with only agent-visible tests removed some necessary code, and 89% of the pruned patches still resolved the task.
Patch size does not distinguish test and documentation additions from behavioral changes. Removing a patch unit and rerunning tests gives a more direct measure of what those tests depend on, but passing tests after removal does not establish that the removed behavior was irrelevant or undesirable.
REFINES. Refines Selection by separating task resolution, patch size, and test-measured code necessity. The pruning result shows why this last measure is a diagnostic rather than a safe deletion rule.
What this does not establish
- A higher necessary fraction does not imply fewer unnecessary units in absolute terms.
- Necessity under benchmark tests does not establish semantic necessity, maintainability, or review cost.
- Results from successful benchmark runs do not establish how failed runs or production changes behave.
Does reporting test-measured necessity alongside patch size improve reviewer decisions without discarding valuable behavior that tests do not cover?