acceptodds
Under review as a conference paper at ICLR 2027

Repair Before Regenerating: Scope-Controlled Recovery for LLM Agents

Abstract

LLM agents increasingly solve programming tasks by writing, executing, and revising code. In these workflows, a failed intermediate program interrupts subsequent actions, making efficient recovery an essential part of task execution. Recovery begins with two useful resources: an existing candidate that encodes the current approach to the task, and execution feedback that reveals where its behavior departs from the specification. Existing pipelines often insert reflection or supervision before regenerating a complete module, adding model calls and repeatedly producing code beyond the correction itself. We introduce RepairAgent, an execution-grounded local-repair framework that turns concrete execution discrepancies into targeted changes to the current program. The framework separates two recovery decisions that existing pipelines typically couple: what evidence the model receives and how much of the artifact it regenerates. For supported public equality checks, RepairAgent reads the failed expression and its actual and expected values directly, then proposes exact-text replacements for selected spans. The interface validates replacement targets and the resulting module's syntax, preserving text outside the edited spans while concentrating generation on the correction. Public execution validates each candidate and supplies evidence for further repair, with complete-module generation available as a second-attempt fallback. On executable repair tasks from QuixBugs, MBPP, and HumanEval, RepairAgent reaches a 93.3% held-out pass rate at 14.14 seconds of dataset-macro latency, reducing complete-pipeline latency by 49.5–88.6% relative to adapted SupervisorAgent, Reflexion, and Self-Refine baselines. Matched controls isolate the scope effect: local edits reduce latency by 15.6–18.7% under fixed feedback.

Then back it, or bet against it.

Related papers

Open the market on this paper to see 7 more related papers.