TRANSMISSION // 2612.01914v1

What Code Do Coding Agents Leave Behind?

Source published

A study finds that coding agents with similar test utility can leave different code footprints. Cleanup during a run reduced static-analysis measures of code slop, but whether cleaner code makes later work easier remains unknown.

AI-generated conceptual illustration for What Code Do Coding Agents Leave Behind?
AI-generated conceptual illustration; not documentary evidence.

Passing tests is only part of a coding agent’s contribution: people also have to review, debug and maintain its code. This study measures that overlooked footprint and tests whether cleanup during a task changes it alongside test performance.

Coding agents are often judged by a simple question: did the program pass its tests? But a working patch can still leave behind unnecessary code, tangled control flow or issues that make maintenance harder. Those costs may matter to the people who inherit the software, even when a benchmark records a successful result.

In a paper published at the COLM 2026 Workshop on Agent Behavior, Shubham Gandhi and colleagues call this extra burden “code slop.” They ask whether code-quality measures reveal differences between coding workflows that test results alone miss—and whether cleanup during a task can reduce those differences.

Measuring more than task success

The researchers tested agents on SWE-EVO, a benchmark in which an agent updates a real Python repository from one release to a later one. They used 42 tasks; six others were excluded because their Docker images failed to build. Three models—Claude Sonnet 4.6, DeepSeek V3.2 and Qwen3-Coder 480B—worked through the tasks using the same shell-based agent setup, with a limit of 100 steps per attempt.

The team ran 2,268 evaluations, varying the model, random seed and cleanup policy. Some agents received no cleanup. Others got a single pass at the end, a pass every 10, 20 or 30 steps, or adaptive cleanup when a monitor judged that the agent had reached a natural stopping point. Cleanup was done by a separate agent instructed to simplify the patch while preserving its behavior.

To assess the resulting code, the authors measured changes in three SonarQube metrics: non-comment lines of code, cognitive complexity (a measure of how difficult control flow is to follow), and estimated effort to fix maintainability issues. They also recorded test performance, strict task resolution, regressions and cost. The authors treat these metrics as proxies for code slop—not direct measurements of how easy a human would find the code to maintain.

Similar test utility, different code footprints

Across the six policies, average fractional test utility ranged from 70.7% to 75.5%. Yet the static-analysis results differed substantially. A single final cleanup pass did little to reduce measured slop. Cleanup during the run was more effective, and the monitor-triggered policy produced the largest reductions across all three metrics in the main comparison.

For example, the monitor policy’s mid-90% mean change in code volume was −79.3 lines, compared with −20.3 for no cleanup. It also reduced cognitive complexity by 13.4 points and estimated maintainability debt by 4.8 minutes. These are changes in repository-wide metrics, not counts of lines or problems proven to be unnecessary in every patch. The authors’ primary estimator excludes the most extreme 5% of runs at each end because some unsuccessful attempts made unusually large edits.

The monitor policy cost an average of $0.91 per task instance, compared with $1.21 for cleanup every 10 steps, the strongest periodic schedule. The authors report that the monitor triggered cleanup about as often as that schedule, but skipped some passes when there was no new diff to clean or the agent appeared to be recovering from an error. Periodic schedules used a fixed cadence, and their effects did not follow a simple pattern in which shorter intervals always worked better.

The model mattered. Claude Sonnet 4.6 changed the repositories relatively little and showed little improvement under monitor-triggered cleanup. Larger reductions appeared with DeepSeek and Qwen3-Coder. The authors caution that Qwen3-Coder’s strict task-resolution rate was low, making its model-specific slop estimates uncertain.

What the results do—and do not—show

The findings suggest that test scores alone can miss differences in the code an agent leaves behind. But they do not establish that the monitor policy is best for every task, model or software project. Strict resolution rates varied between policies, so the authors do not claim cleanup leaves task success unchanged in every sense. Rather, fractional test utility stayed within a similar range while the measured code-quality metrics changed.

There is also a basic measurement challenge: without knowing the minimal correct patch, researchers cannot precisely identify which additions were unnecessary. A smaller repository is not automatically a better one; deletions can remove useful code or damage a solution. The study pairs code-quality metrics with functional measures for that reason. It also reports that large-scale deletion was rare among unsolved runs, but this does not prove that every reduction improved maintainability.

The evaluation covers Python repositories, one agent harness and a particular benchmark setup. Static metrics do not capture every aspect of code quality, such as architecture, naming or test coverage. Most importantly, the study does not test whether a cleaner result saves time for the next developer or agent: each run ends with a single measured repository state, rather than a second round of work. The paper reports a bounded experiment, not a settled verdict on coding agents as a whole.

The practical takeaway is a measurement one: evaluations could report both whether an agent completes a task and what kind of code it leaves behind. Whether those measures predict easier collaboration remains an open question.

Reviewed cross-references

These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.

  • Why AI coding agents struggle to clean up old code

    Supporting evidence: Both studies show why code-maintenance evaluations should pair functional tests with a measure of the resulting code: the origin paper tracks static-analysis changes alongside task outcomes and cautions that a leaner diff may reflect destructive edits, while RepoClean combines tests with deletion coverage because passing tests alone does not establish that obsolete code was removed. The evidence comes from different settings—SWE-EVO release transitions versus Python obsolete-code cleanup—so it supports this bounded evaluation principle, not a direct comparison of results.

    Model review: · openai-codex/gpt-6-luna

    Evidence and provenance

    Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.

    • 2612.01914v1 — Original paper

      Excerpt reference: static/papers/2612.01914v1.md:67-130
      Basis: Paper text
      Source file SHA-256: 90af2f8391b1881c227dce36be55e809107ec119f17d38e392d131fb81fa09b8

    • 2611.30350v1 — Original paper

      Excerpt reference: static/papers/2611.30350v1.md:87-237
      Basis: Paper text
      Source file SHA-256: 19610934d8371be1b1a7e11462b83306f2949494b09bec5f1b7ba9a037c60de7

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.