arXiv:2609.10123cs.SESep 2026

Manuscript Offprint

arXiv:2609.10123

If It's Not Buggy, Don't Fix It: On the Dynamics of Iterative Bug-fixing with LLMs

Xietao Wang-Lin, Anton Isopoussu, Louis Mahon

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language models (LLMs) have become ubiquitous in software development, with LLM-based automated program repair tools increasingly used during code review. In this report, we explore the iterative blind use of LLMs as bug-fixers. Across multiple models and repair environments, we find that LLMs consistently claim to detect bugs in entirely bug-free programs while the rate of repair of buggy programs is less than that of the damage to correct programs. We also explore the long-term dynamics of this iterative process, and find that this frequently reaches a pseudo-bug-fixing cycle where the same changes are added and removed again ad infinitum. Lastly, via mechanistic probing, we unveil the existence of a steering vector which controls the editing propensity, suggesting that LLMs have an internal representation of “buggy code”, and that this representation is what is falsely activated to induce pseudo-bug fixing. These results provide insight towards the dynamics of fully autonomous bug-fixing systems, as well as stopping conditions under ambiguous goals.

1 Introduction

Large language models (LLMs) are now ubiquitous in coding tasks. Increasingly, they are used as fully autonomous agentic harnesses, where the user gives little to no supervision and the agent iteratively processes the code, with the stopping condition being determined by the harness [Yang et al., 2024b]. A similar loop arises in multi-agent interactions, where the output generated turns into the input for the next generation [Du et al., 2024, Ko and Geiping, 2026]. However, little is known about the long-term effects of this iterative process, such as code correctness or how and when the agent decides to terminate the iteration, especially when there is no objective measure of task performance.

Bug-finding is an essential part of the coding process. Neither human or LLM code are rarely perfect on the first attempt, and detecting and fixing potential errors is crucial. LLMs often do this via automated bug-fixing agents that operate iteratively, i.e., the LLM searches for bugs, applies patches, then again searches the patched code and potentially applies more fixes, iterating until no more bugs are found [Liu et al., 2024, Bouzenia et al., 2025]. Given the ubiquity and importance of this setup, some natural questions arise: how does code evolve under iterative bug-fixing? Are LLMs aware of bugs under vague conditions? When is the LLM satisfied the code is completely bug-free?

In this report, we particularly focus on iterative bug-fixing using LLMs, where LLMs review and fix bugs on the same piece of code until it finds no more bugs. We consider the case where the prompt does not include history, that is, the agent sees the current state of the code, but not the sequence of states the code has been in through past bug fixes [Xia et al., 2025]. This situation may arise, for instance, when a user approves changes blindly, when including past states would exceed the context window or in multi-agent setups with delegation [Perry et al., 2023, Laban et al., 2026a].

*Work done during an internship at UnlikelyAI.

Preprint.

Our contributions are as follows:

  • We study iterative bug-fixing dynamics and quantify the rate at which it improves buggy code, as well as the rate at which it damages correct code by trying to remove pseudo-bugs;

  • We show that, under relatively standard settings, the damage rate can end up being significantly higher than the repair rate;

  • We document the behaviour of pseudo-bug-fixing cycles, which appear more frequently when using atomic changes compared to whole-file edits.

  • By mechanistic probing, we unveil the existence of a “buggy code” internal representation in LLMs, which is activated when the LLM detects bugs (either pseudo-bugs or real bugs) and not when the LLM thinks the code is bug-free.