Manuscript Offprint

arXiv:2610.41433

What Does a Repair Agent Gain from Remembering Its Failure? An Exploratory Study on Real Python Bugs

Wenbo Ye, Yongxi Zhou, Junwei Yao, Jiahui Ge

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

Wenbo Ye

Independent Researcher

ywb6113@gmail.com

Yongxi Zhou

Independent Researcher

zhou.yongx@northeastern.edu

Junwei Yao

Independent Researcher

yao.junw@northeastern.edu

Jiahui Ge

Independent Researcher

jiahuige@alumni.usc.edu

Abstract—When a coding agent fails a repair task, it is often retried with a record of the failure: the transcript, a self-written lesson, or extracted test signals. We ask what such failure memory changes in the retry. On 75 BugsInPy bugs, we retried each of 181 failed attempts of gpt-5.4-mini under five conditions, with a predeclared analysis whose deviations we report. Two predeclared follow-ups repeated the plain-retry, transcript and lesson conditions with the larger gpt-5.4 and added a notice-only control. On the bug-revealing tests, every memory condition gained over a plain retry in point estimate (+5.5 to +9.9 points over 29.8%), but none significantly. Five further findings stand out. First, a model-written lesson showed no advantage over the transcript it summarises (-1.7 points, 95% CI [-8.7, +4.9]; -3.5 for gpt-5.4), although it costs an extra model call. Second, the transcript may do more than tell the agent that it failed. A notice alone produced no significant change (and was 7.1 points below a plain retry on resolution for gpt-5.4), while the transcript resolved 12.2 points more failures than the notice for gpt-5.4-mini (CI [+4.2, +20.0], in a partial run of 156 failures; the only significant one of twelve predeclared contrasts, and not significant for gpt-5.4). Third, post hoc in the main study, fewer retries with memory ended without modifying any Python file, while the share of editing retries that touched a file the fix changes was near ceiling in every condition. Fourth, in a post hoc check against the full test suites, retries that had also seen the previous attempt's test results (the final output for the transcript, an extracted digest for the signal conditions) more often failed other tests that the reference fix passes, which shrinks their apparent gains. Fifth, outcomes varied far more between failures than between conditions, and we give the sample sizes a confirmatory study would need. We report all exclusions, interruptions and post hoc analyses.

Index Terms—LLM agents, program repair, agent memory, reflection, empirical evaluation

I. INTRODUCTION

Language-model agents for program repair work in a loop of inspecting files, editing code and running tests. When an attempt ends with failing tests, a common response is to start again and pass along something from the failed attempt. Reflexion-style agents write a verbal lesson [1]; other systems pass on the previous trajectory, structured test output or curated experience [2], [3]. It is not obvious that such memory pays off. Resampling alone already recovers many failures [4], and self-repair helps less than often assumed once its cost is counted [5]. In ALFWorld and HumanEval, reflexive agents have been observed to store confident but wrong readings of the task and to keep acting on them, while programmatically extracted failure signals helped [6]. We know of no controlled comparison of these forms of memory in repository-level repair, where a failed attempt leaves behind edited files and test output.

We study what failure memory changes when a repair agent retries, for a fixed harness and model family. (A) Compared with a plain retry, does memory of the failure change how often the retry passes the bug-revealing tests, and at what cost? Does summarising the failure into a lesson help compared with passing on the transcript it was written from? What part of the effect is merely the notice that the attempt failed? (B) When the model writes a lesson, where does it point, compared with the reference fix and with simple deterministic baselines? A plain retry is the baseline that any memory must beat, because resampling alone recovers many failures [4]. The transcript and lesson conditions receive exactly the same truncated record, so their comparison is designed to isolate the summarisation step, and a notice-only condition separates the memory from the announcement that the attempt failed.

The study differs from prior work in four ways. Earlier comparisons of self-diagnosis and extracted failure signals used ALFWorld and HumanEval without a resampling baseline [6]; we compare transcript, lesson and digest in repository-level repair against a plain retry, with the transcript and the lesson built from the same record. We separate the failure notice from the memory content with a notice-only control, which we have not seen in studies of agent retries. We check resolved retries against the full test suites, which shows that the usual bug-revealing-test endpoint can reorder the conditions in point estimate. And we report how strongly retry outcomes cluster by failure, which determines how such studies must be sized.

This is an exploratory evaluation, not a new method. It has three parts. A predeclared main study (M1, gpt-5.4-mini, 181 failures) gave inconclusive primary contrasts. Post hoc analyses then showed how the retries differed. Two predeclared follow-ups tested what those analyses suggested: a replication with gpt-5.4 (M2, 85 failures) and a notice-only control on the failures of both models (M3). Our findings are:

  • Lessons showed no advantage over transcripts on the bug-revealing tests. With either model, a model-written lesson did not outperform the transcript it summarises,

despite the extra call; the upper 95% bounds of its advantage are +4.9 (M1) and +8.2 points (M2). On a post hoc full-suite outcome the lesson was slightly ahead.

  • The transcript may carry more than a failure notice. A notice alone produced no significant change. The transcript exceeded it in point estimate for both models, but significantly only on resolution for the smaller model, in a partial run.

  • With memory, fewer retries stop without an edit. Post hoc in M1, fewer retries with memory ended without any change; in M2 this held for the transcript but not clearly for the lesson. Where editing retries edited was near ceiling in every condition.

  • Some apparent gains do not survive the full test suites. Post hoc, more of the resolved retries that had also seen the previous attempt's test output failed other tests that the reference fix passes (an association, not a demonstrated cause).

  • The failure matters more than the memory. Of the 181 failures, 63 were resolved under no condition and 17 under all five, and retry outcomes cluster by failure (ICC 0.40). Detecting effects below about 10 points therefore needs larger task sets than ours; we give a design calculation.

For practitioners, our data show no advantage of a lesson over the transcript on the bug-revealing tests, although advantages up to the upper bounds above are not excluded. For evaluation, comparisons of retry or memory strategies that score only the bug-revealing tests can rank the strategies differently from a full-suite check, because strategies that expose more test output may produce more patches that break other tests. All raw transcripts, code and analyses are released.

References (31)