Daily AI Paper
Every day, our AI scans the latest arXiv submissions, picks the most notable one, and narrates a video introduction — automatically.
How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches
Aakash Goel, Benjamin Steenhoek, Yu Hu
arXiv:2611.34875v1When people talk about coding agents over-editing, they usually mean something simple: the agent changes a lot more code than a human developer would. But that alone does not tell us whether those extra changes are actually wasteful. A large patch might be messy, or it might include necessary tests, documentation updates, cleanup, or debugging leftovers that only look excessive at first glance. This paper is about separating those possibilities. That distinction matters because in software engineering, patch size is not just an aesthetic issue. Bigger changes are harder to review, more likely to introduce unintended behavior, and more likely to be rejected by maintainers. A patch that fixes a bug by rewriting far more than needed may still pass tests, but it can create maintenance risk and reduce trust in the agent. So the real question is not just, “Did the agent change more?” but “Which of those changes were actually necessary, which were extra, and where did they come from?” To answer that, the authors introduce a method called Delta Residue Attribution, or DRA. The core idea is to replay the agent’s whole trajectory, break the final submitted patch into small independent units, trace each unit back to the step that introduced it, and then test whether removing that unit still lets the patch pass. If the patch still passes after removing a unit, that unit is treated as unneeded. If removing it breaks the task tests, it is treated as needed. This is a delta-debugging style counterfactual test: remove one piece, rerun the oracle, and see what happens. The background here is important. Prior work has shown that coding models often over-edit on small function-level tasks, and at the repository level their successful patches can be much larger than developers’ patches. But patch size by itself is a blunt instrument. It cannot tell you whether the extra lines are code, tests, docs, or comments. It also cannot tell you whether the extra code was written during debugging and later left behind, or whether it was part of the final fix. DRA is designed to answer those finer-grained questions. The method starts from a resolved trajectory, meaning a task where the final patch passes the benchmark tests. The authors replay the agent’s structured file-editing actions on the base repository until they reconstruct the final patch exactly. They exclude trajectories that do not replay cleanly. Then they split the patch into units: contiguous blocks of changed lines in a file, with nearby blocks merged if they are separated by at most one unchanged line. A new file or deleted file counts as one unit. Each unit is then classified by file type. Code units are the main object of study, while test, documentation, configuration, and comment or formatting changes are treated separately. That distinction matters because on SWE-bench Verified, the benchmark’s grading resets test files, so test edits do not affect whether a patch passes. In other words, test changes may be useful in a real repository, but they are not part of the benchmark’s success criterion. The paper therefore reports code necessity as the primary measure, and treats test and documentation changes as extra edits rather than as needed or unneeded in the same sense. DRA also attributes each unit to the step that most recently wrote it. That lets the authors ask not only what was unnecessary, but when it entered the trajectory. They divide steps into broad roles: debug steps, which include exploring, reproducing, and probing; fix steps, which include the actual fix and refinement; and cleanup steps, which revert earlier changes. A unit first written during debugging but later revised during the fix is attributed to the fix, not to the debug phase. To decide necessity, the authors revert each unit one at a time and rerun the task tests. If the reverted patch still passes, that unit is unneeded; if the revert breaks the tests, it is needed. Because benchmark tests do not cover every behavior, they also validate unneeded code units with behavioral probes. These probes are generated to exercise the changed code and compare behavior under the agent patch, the reverted patch, and the developer patch. That gives a stronger notion of necessity, while still keeping the benchmark tests as the main oracle. A particularly important part of the paper is that the authors do not just analyze agent patches. They also grade developer patches with the same method. That provides a baseline for how much “unneeded” code exists even in human-written fixes. This is crucial, because no test-based notion of minimality is perfect. A patch can be technically unnecessary under the benchmark oracle and still reflect a reasonable implementation choice. So the authors treat unneeded units as an upper bound on true excess, not a perfect measure of bad editing. The study is large. It covers 18 models from four providers, evaluated through the GitHub Copilot CLI coding agent on two benchmarks: SWE-bench Verified and DeepSWE. SWE-bench Verified has 500 Python tasks, while DeepSWE has 113 longer-horizon tasks across several languages. In total, they analyze 6,728 resolved SWE-bench Verified trajectories and 932 DeepSWE trajectories, plus developer baselines on both benchmarks. They also report that the replay success rate is very high for SWE-bench Verified trajectories, and they use a second judge to check the reliability of the role labels. So what do they find? First, yes, agent patches do change more lines than developer patches. But the composition of those extra edits differs by benchmark. On SWE-bench Verified, the majority of the extra changes are not code at all: 61% are tests and 13% are documentation. On DeepSWE, by contrast, most of the extra edits are code, at 58%. That already suggests that “over-editing” is not a single phenomenon; it depends on the task setup and what the agent is being asked to do. Second, when the authors focus specifically on code, the picture is more nuanced than the patch-size headline suggests. On SWE-bench Verified, 11 of the 18 models leave less unneeded code than developers do, on average. The mean code necessity is 0.887 for agents versus 0.864 for developers. That means agent code is, on average, at least as necessary as developer code, and sometimes more so. On DeepSWE, agents and developers are much closer: 0.797 versus 0.785. So the common assumption that agent code is intrinsically sloppier than human code is not supported here. Third, even though agent patches are larger, only a modest fraction of their code is actually unnecessary. On average, 11% of an agent patch’s code units on SWE-bench Verified are still unneeded. And among those unneeded code units, 89% change behavior, according to the behavioral probes. That is an important result: most of the residue is not harmless whitespace or cosmetic cleanup. It often affects program behavior, which means it is the kind of extra code that can matter in real maintenance and review. Fourth, the source of residue matters. Debug steps write almost none of the unneeded code. Most of the residue comes from fix steps. That tells us that over-editing is not mainly a case of agents leaving behind obvious debugging detritus. Instead, the extra code is usually part of the final repair itself. In other words, if you want to reduce unnecessary code, you probably cannot solve the problem just by trimming exploratory steps after the fact. Fifth, the relationship between over-editing and solve rate is not what you might expect. On SWE-bench Verified, code necessity differs substantially by model, but it does not track resolve rate in a meaningful way. Better success on the benchmark does not automatically mean cleaner, more minimal edits. On DeepSWE, the relationship is actually negative: models with higher resolve rates tend to leave less necessary code, with a Spearman correlation of minus 0.59. That suggests that on the harder benchmark, the strongest models may also be the more disciplined editors, but this is not a universal pattern. The paper also tests whether unneeded code can be removed automatically. They try two approaches on SWE-bench Verified. One is self-audit: ask the agent to inspect its own diff and identify removable code. That method is fairly precise, but it only finds a minority of the unneeded code. The other is harness-level pruning using the agent’s own tests plus the repository’s regression tests. That approach finds more of the unneeded code, but it is less precise and sometimes removes needed code too. Still, many of the pruned patches continue to resolve the task, which suggests that there is real room for automatic cleanup. The main limitation, and the authors are explicit about this, is that test-based necessity is not the same as true semantic necessity. If the tests do not cover a behavior, a unit may look unneeded even though a developer intended it. That is why the behavioral probes and the developer baseline are so important. The paper is careful to frame its measure as an upper bound on excess, not a perfect ground truth. Another limitation is that units are reverted one at a time, so the method measures single-unit necessity, not whether a group of units could be removed together. And the results are tied to the specific benchmarks and agent harnesses studied here. The practical takeaway is straightforward. Benchmarks should report code necessity alongside resolve rate, because success alone hides a lot of variation in edit quality. And if we want coding agents to become more maintainable, the solution likely has two parts: better model training that discourages unnecessary edits, and better harnesses that can prune or catch extra code before it reaches a human reviewer. The broader message is that “passes tests” is not enough. For coding agents, how they get to a passing patch matters almost as much as whether they get there at all.
Also spotted that day
Previous daily papers