TRANSMISSION // 2611.30350v1

Why AI coding agents struggle to clean up old code

Source published

RepoClean tests whether coding agents can remove obsolete code across Python repositories without breaking existing functionality. The best result was 23% task resolution.

AI-generated conceptual illustration for Why AI coding agents struggle to clean up old code
AI-generated conceptual illustration; not documentary evidence.

Software cleanup sounds simple: remove what is no longer needed. But old code can be tangled with current features. RepoClean tests whether AI coding agents can identify what to delete while preserving what still works—and finds that reliable cleanup remains difficult on this benchmark.

A software project can accumulate code that once served a purpose but no longer belongs in its current design. Removing it safely is not just a matter of spotting old-looking functions: other parts of the project may still rely on them. A cleanup tool must work out what is obsolete, what remains necessary and whether its edits preserve the software’s behavior.

The RepoClean study asks whether today’s AI coding agents can perform that kind of cleanup across an entire repository. The researchers introduce a benchmark designed to isolate removal of obsolete historical code from tasks such as adding a new feature.

Turning software history into cleanup tests

RepoClean contains 200 tasks drawn from 34 open-source Python repositories. The researchers started with current versions of projects and automatically reinserted code that had been deleted in earlier versions. They kept a candidate task only when this reintroduced code caused at least one previously passing test file to fail. Removing the inserted code provides a reference cleanup patch that restores the current version.

For each task, agents received a repository, a runtime environment and cleanup instructions. They could inspect and edit code and run tests, but could not see the final validation tests or search online. The evaluation checked whether their changes restored failing tests without breaking tests that had already passed. It also measured deletion coverage: the share of lines removed by the reference patch that the agent deleted too.

These measures capture different aspects of success. An agent can delete much of the targeted code without restoring functionality; passing tests alone does not show that obsolete code was fully removed. RepoClean therefore tracks both functional results and deletion coverage.

Low resolution, and a prompt-dependent gap

The researchers evaluated seven models using the same agent framework. The highest task-resolution rate on the full benchmark was 23%, achieved by GPT-6 Astra. Its mean deletion coverage was 76.2%: on average, it deleted many of the lines in the reference patches, but that did not mean it completed most tasks successfully. The contrast shows why deletion and functional correctness need to be assessed together.

The study also tested whether agents clean up old code when asked only to repair functionality. On a 40-task subset, deletion coverage fell by about 28 to 37 percentage points for three models when the explicit cleanup request was replaced with a general repair instruction. In this experiment, functional repair alone did not reliably prompt agents to remove the historical code.

More deletion was not automatically safer. Across the seven models, the researchers recorded regressions—cases where test files that passed before an agent’s edits failed afterward. In 72 of the 115 runs with regressions, at least one initially failing test file also began passing. Repair and damage could therefore happen in the same run. Examples in the paper show agents retaining outdated code or deleting an interface still needed by the current version. In one case, an agent’s own test checked that a method was absent, while a validation test failed because it still called that method.

What the benchmark can—and cannot—show

RepoClean’s contribution is a way to evaluate historical code cleanup as its own repository-level task. Its results describe performance on this benchmark, not a universal measure of coding-agent ability. The tasks come from Python projects, and the authors say their extraction pipeline relies on Python syntax analysis; other languages are not covered. The benchmark also selects historical code that can be reintroduced to trigger failures in available tests. It therefore represents a particular, testable kind of cleanup, not every reason developers remove code.

Passing tests cannot establish correctness in paths those tests do not cover, a limitation the authors acknowledge. The reported work is an arXiv preprint; the materials available here do not establish peer-reviewed publication. The findings are best read as a proposed benchmark and an evaluation of seven models in its setup, rather than settled evidence about all coding agents or real-world maintenance.

The study’s central distinction is useful: deleting code is not the same as maintaining software. On RepoClean, agents sometimes removed substantial amounts of targeted code while still failing to restore behavior reliably or avoid regressions. As an editorial recommendation, teams considering automated cleanup should review changes and verify behavior against their own requirements; that advice was not itself tested by this study.

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.

  • What counts as success in AI software migration?

    Supporting evidence: Both papers caution against treating test-based success as a complete measure of software-task success. RepoClean pairs functional tests with deletion coverage because passing tests alone does not show obsolete code was removed; the migration survey argues that builds, tests and other proxies establish distinct, scope-limited properties. This is a complementary point about evaluation, not a comparison of agent performance: the survey covers migration studies, while RepoClean evaluates Python cleanup tasks.

    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.

    • 2611.30350v1 — Original paper

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

    • 2611.29942v1 — Original paper

      Excerpt reference: static/papers/2611.29942v1.md:16-67
      Basis: Paper text
      Source SHA-256: b792d40667c352278f326b7304160e183fb68e5a4530ebf15bde0dcd96ff7ede

    • 2611.29942v1 — Original paper

      Excerpt reference: static/papers/2611.29942v1.md:191-319
      Basis: Paper text
      Source SHA-256: b792d40667c352278f326b7304160e183fb68e5a4530ebf15bde0dcd96ff7ede

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