Software workflows · Research feature

Study reveals limitations of AI program repair agents in complex bug fixing

The study examines five state-of-the-art automated program repair agents as they tackle 500 real-world software bugs, tracking their full decision-making processes from issue identification to patch validation.

Adapted from research by Ira Ceka, Hailie Mitchell, Saurabh Pujar and colleagues.

arXiv preprint revision · 2026-08-29 · Attribution & reuse
In this article
Editorial illustration of two code revisions.

Editor’s introduction

The study examines five state-of-the-art automated program repair agents as they tackle 500 real-world software bugs, tracking their full decision-making processes from issue identification to patch validation. It finds these agents perform well on simple fixes but falter on logic-intensive problems, often producing verbose, overfitted patches that pass tests without addressing root causes. Test generation and regression test selection remain significant weaknesses, as agents frequently fail to reproduce issues or run relevant tests. The research also notes that most agents rely on basic tools like bash scripts and lack access to debuggers or program analysis tools.

Introduction

Automated program repair (APR) agents are autonomous systems that leverage the reasoning and generative capabilities of Large Language Models (LLMs) to perform complex, multi-step software development tasks. To support such capabilities, APR agents incorporate planning, self-reflection, and external tool use, including web search, file I/O, static analysis, and debugging—enabling them to decompose high-level objectives, assess their own intermediate outputs, and interact with the broader development ecosystem. Recent research has shown APR agents to be successful in fixing real-world bugs, often utilizing sub-agents for tasks like code synthesis from natural language specifications, fault localization, and automated test generation.

Traditional repair systems typically rely on manually crafted templates, predefined transformation rules, or search-guided enumeration of patches. In contrast, APR agents offer a more general and adaptive approach. They can ingest structured or unstructured bug reports, localize faults using lightweight static analysis or test-driven diagnosis, synthesize candidate patches, validate them through iterative compilation and test execution, and ultimately decide when and how to apply a fix. This end-to-end workflow—spanning fault localization, patch synthesis, patch validation, and code integration—broadly mirrors cognitive processes of human developers, highlighting the potential of APR agents to be autonomous repair assistants. A leading benchmark for evaluating automated program repair agents is SWE-bench, comprising 2,294 real-world tasks curated from 12 actively maintained Python GitHub projects. Each task is anchored to a specific repository version and accompanied by a natural language issue description, requiring generation of a patch that resolves the issue. Evaluation is conducted via test execution, including fail-to-pass tests that confirm issue resolution and pass-to-pass tests that check for regression safety. To improve the robustness of the benchmark, OpenAI curated a high-quality subset called SWE-bench Verified, consisting of 500 tasks with well-defined and semantically meaningful test cases.

SWE-bench and its Verified variant have quickly become the de facto standard for assessing LLM-based repair systems. They are widely used in academic research and industrial settings to evaluate models’ code understanding, reasoning, and patch synthesis abilities. As a result, an increasing number of agents—developed across both academic and industrial settings—are being explicitly designed to target this benchmark, with growing emphasis on achieving steady improvements in the number of successfully repaired issues, as reflected in the evolving SWE-bench leaderboard.

While agents have achieved impressive leaderboard scores, such metrics reveal little about how agents reason, why they fail, or how their behavior compares to that of human developers. As agent development accelerates, there is growing need for analyses beyond pass/fail outcomes. This work addresses that gap by tracing agents’ complete decision-making pipelines—from issue description to patch validation—and structuring our investigation through the following research questions.

RQ1: How similar are the agent-generated and developer written patches? We find even when an agent-generated patch passes the given test suite, it often diverges from the developer patch—typically being more verbose and structurally complex. This motivates a deeper study of agent trajectories to explore how agents generate patches and where decision-making breaks down.

Study Methodology

2.1 Trace Collection For each repair attempt, we collect an execution trace: the set of observable artifacts produced by an agent on a given task. An execution trace comprises of: (1) the agent’s generated patch, (2) the resolution verdict indicating whether the patch passes both the fail-to-pass tests that validate the fix and the pass-to-pass regression tests that ensure no existing functionality is broken, and (3) the action trajectory, the ordered sequence of interactions or actions taken by the agent during repair, capturing tool invocations, reasoning output, confirmations of bug reproductions, verifications of fix, and regression test selections. Together, these traces provide a multi-dimensional view of agent behavior, enabling analysis at both the outcome level (e.g., resolution rates, overfitting) and the process level (e.g., tool usage patterns).

These step-level annotations make lengthy trajectories easier to interpret and verify manually. Although different agents produce distinct trajectories, they often perform semantically similar actions (e.g., retrieving context in step 4). By identifying these common patterns across agents, we manually derived generalized workflow nodes such as “Provide Context.” To ensure correctness and interpretability, we cross-validate extracted trajectories by comparing them against the open-source implementations and workflow diagrams published in each agent’s respective documentation or paper. This validation allows us to confirm the trajectories reflect true agent behavior and that the summarized intents align with the agent’s underlying design. In parallel, we extract agent-generated patch.diff files from traces and retrieve corresponding developer patches from the SWE-bench Verified Parquet dataset. We normalize both sets of patches by removing diff-specific symbols (e.g., ”+”, ”—”) and formatting artifacts, producing clean versions suitable for side-by-side comparison in downstream clone analysis and structural evaluation.

2.2 Constructing a Taxonomy To better characterize each agent’s unique capabilities and workflows, we construct a taxonomy of decision-making pathways based on their execution traces. The annotations of fine-grained agent steps (Section 2.1) are manually reviewed and corrected, beginning with a shared subset for calibration; disagreements are adjudicated by a third reviewer to ensure consistency before continuing independently. Annotators consisted of co-authors and external student annotators. Annotation was performed independently, with the same samples assigned to multiple annotators to avoid any single reviewer dominating the process. After independent annotation, observations were consolidated and disagreements were adjudicated by a third reviewer (a co-author), ensuring no single perspective determined the final taxonomy. All taxonomy nodes were cross-validated against each agent’s published source code and documentation to ground the taxonomy in objective evidence rather than annotator interpretation. This follows a similar annotation methodology to those presented in Ma et al. and Yu et al.. We do not apply automated clustering; instead, we manually identify recurring patterns across agents (Section 2.1). For example, one agent might use a browser-based search after analyzing the repository structure, while another uses an internal-API at the same point. Though superficially different, both represent retrieving external information, so they merge into a single node (e.g., “special commands/APIs”). If a node is rare but critical, we preserve it as a standalone. We cross-check source code and paper details to ensure no decision paths are distorted. Once verified, nodes and edges are added to the final graph, where edge weights indicate how many agents traverse each path.

The taxonomy highlights two strategies: iterative refinement, as in OpenHands, SWE-Agent, and AutoCodeRover, which generate and refine a single patch; and parallel sampling, as in MASAI and Agentless, which produce multiple candidates—only MASAI refines across them. Refinement occurs at multiple points, including file/class selection, context generation, and test generation.

Graph analysis identifies three core components across all agents: (1) Localization, the most connected node type and essential for context setup; (2) Patch Generation, a central phase; and (3) Reproduction Testing, necessary for validating correctness. These three components form the backbone of modern SWE-agent workflows and motivate deeper study, as presented in the following sections. What we refer to as graph analysis involves identifying the frequently visited nodes across the taxonomy. We borrow the term “frequently visited nodes” from graph traversal algorithms to describe nodes that are reached often, which corresponds directly to having many incoming edges (high in-degree). Although identifying frequently visited nodes can be automated, given the manageable size of the graph and to ensure accuracy, we elect to perform this step manually. We count in-degrees of several nodes and note, for example, Special Commands/APIs has an in-degree of 8, Provide Context an in-degree of 6, Select Important Classes/Funcs an in-degree of 6, Edit Snippet an in-degree of 4, and Filter Patches an in-degree of 5. These frequently visited nodes (high in-degree components) indicate core functions around which we define workflow categories, arriving at mappings such as “Localization”, “Patch Generation”, and “Reproduction Testing”. These high frequency nodes are used as a proxy for the core functional roles and represent the components that play a disproportionately important role across agent workflows.

Experimental Design

3.1 Benchmark Selection SWE-bench is a leading benchmark for evaluating APR agents, comprising 2,294 real-world tasks from 12 actively maintained Python GitHub repositories. Each task specifies a repository version and includes a natural language issue description, requiring a candidate patch that passes both fail-to-pass (bug-fixing) and pass-to-pass (regression) tests.

To improve benchmark reliability, OpenAI released SWE-bench Verified, a curated subset of 500 tasks selected through a human annotation campaign involving 93 experienced developers. Annotators removed 68.3% of tasks due to invalid test harnesses, vague descriptions, or environment dependencies. This subset serves as a high-quality gold standard for evaluating APR agents.

3.2 Agent Selection We use the term “APR agent” to refer to any LLM-based system designed to solve automated program repair tasks—specifically, systems that generate code patches for natural language-described issues. Such agents augment a base LLM with tools for performing concrete actions such as navigating repositories, retrieving context, editing files, and running tests.

Broadly, we observe two kinds of agentic designs: (1) Workflow-based agents structure the repair process into a fixed pipeline of subtasks (e.g., localization, patch generation, validation), relying on pre-defined task flows and explicit module boundaries for modularity and reproducibility; (2) Open-process agents delegate more autonomy to the LLM by exposing it to a flexible interface (e.g., CLI, browser, file system) through which it can issue commands, make decisions interactively, and adaptively control execution, emphasizing flexibility and emergent strategies.

Agent vs. Developer Written Patches (RQ1)

4.1 Motivation To understand how closely agent approaches align with human reasoning, we compare agent-generated patches to developer-written fixes. This moves beyond test-passing correctness to examine the semantic fidelity of agent solutions, whether they reflect the intent and minimalism often seen in human patches or rely on alternative, potentially overengineered strategies.44 4 Consider a motivating example, astropy__astropy-14096: the developer applies a 7-line fix, reverting to default __getattribute__ behavior, while an agent introduces layered fallback logic and explicit attribute checks totaling 53 lines. See motivating example. This divergence motivates a broader investigation: what patterns do agents introduce when solving real-world bugs, and how do they compare to human strategies in terms of complexity, generality, and semantic intent?

4.2 Approach We evaluate similarities between developer and agent-generated patches using multiple complementary methods, analyzing characteristics such as diff size in lines, files edited, files added, reproducer files added, number of hunks, and average hunk size. For all experiments, we use agent trajectories generated with two backbones: Claude-3.5-Sonnet and GPT-4o. Edit-distance and clone analysis require resolved (correct) patches to enable meaningful comparison against developer solutions. For Claude-3.5-Sonnet, we analyze 911 of 918 resolved instances (99.2%), excluding 7 OpenHands outliers exceeding the 200k-token limit. For GPT-4o, we analyze 587 of 588 resolved instances (99.8%), excluding 1 outlier. We exclude very hard issues due to small sample size (3 issues) and near 0% solve rates across nearly all agents and backbones. Edit patterns and hunk analysis examine patch characteristics regardless of correctness, reporting statistics on the maximal common subset of tasks where all agents using a given backbone generate patches. Manual analysis uses the Verified-50 subset and includes both correct and incorrect patches.

A. Manual Patch Analysis. We manually review patches for tasks in the Verified-50 dataset, a representative sample of 50 tasks from SWE-bench Verified. We analyze patches generated by one workflow-based agent (Agentless) and one open-process agent (SWE-Agent), comparing these to the developer-written solutions and to each other.

C. Patch Edit-Distance. To triangulate the LLM-based clone analysis, we compute the character-level Levenshtein distance between each successful agent-generated patch and its corresponding developer patch, grouping results by agent. The Levenshtein distance measures the minimum number of single-character edits (insertions, deletions, or substitutions) required to transform one string into another, providing a quantitative measure of textual similarity between patches.

4.3 Results Manual patch analysis trends. When both SWE-Agent and Agentless successfully resolve an issue, Agentless often produces a shorter solution. However, Agentless struggles with multi-file edits or complex code changes like updating data structures, sometimes generating correct patches in one location while missing other bug locations. Conversely, SWE-Agent’s tendency toward larger structural changes enables it to resolve tasks requiring extensive edits (e.g., adding new methods), but its patches are often unnecessarily complex, longer than developer solutions, and span more files. For tasks with simple fixes, SWE-Agent’s verbose patches are harder for developers to interpret, evaluate, and maintain if merged. These observations confirm quantitative findings: SWE-Agent generates longer, multi-file edits (partly due to test additions and added complexity), while Agentless generates shorter, localized single-file edits more similar to developer solutions.99 9 Full Verified-50 annotations.

Agent Effectiveness in Validating Patches through Testing (RQ3)

6.1.1 Motivation RQ2 showed that fail-to-pass tests prevent agents from generating incorrect but plausible patches by providing clear failure signals that enforce semantic correctness. However, such tests are often missing when a bug is reported, requiring agents to generate them during repair. This motivates us to study how effectively agents generate issue-reproducing test cases. We explore how often agent-generated reproducers trigger bugs, pass with agent-generated patches, and lead to task resolution. We then experiment with design choices informed by our taxonomy (Section 2.2), as in RQ3.2, which explores the impact of bug localization on test generation.

6.1.2 Approach To identify agent-generated reproducers, we analyze each trajectory step and automatically extract any newly created Python files the agent executes. Workflow agents follow explicitly formatted, pre-defined workflows, enabling direct parsing of generated reproducers; for open-process agents, we treat any newly created Python file the agent runs as a reproducer, even if it fails to trigger the bug. Manual trajectory inspection confirms these files are reproducer tests generated during the ‘‘Issue Reproduction’’ phase of our taxonomy, and we compute reproducer-generation rates across all agent—LLM combinations. To determine whether reproducers trigger the bug and are later resolved by a patch, we focus on Agentless1414 14 All Agentless RQ3 trajs sourced from ByteDance-Seed due to format requirements in our pipeline. and SWE-Agent: Agentless prints designated marker strings (e.g., “Issue reproduced”, “Issue resolved”) when the buggy behavior is observed or fixed, so we detect reproduction by checking for these markers in execution output, while for SWE-Agent we extract analogous reproduction/resolution flags from its trajectory logs.

RQ3.2 Inference time scaling with Bug Localization. Enabling bug localization significantly improves test-generation.1717 17 Verified-50 bug localization results. On Verified-50, localization increases reproduction success in 54% of issues (27/50), raising successful reproductions from 614 to 697 of 1,500 samples (13.5% relative). It converts seven previously unreproduced issues (0/30) to reproduced ones, with some improving dramatically (1/30 to 30/30). Localization does not harm stable cases: eight issues remain at 30/30 with or without localization, and only three show minor declines. Each test requires costly API calls and execution; localization improves odds of early success, boosting speed and resource efficiency.

6.2.1 Motivation Unlike issue-reproducing tests, large projects typically have regression tests validating existing functionality. To resolve a bug, patched code must fix the issue and pass the test suite to preserve existing functionality. Here we explore how often APR agents run regression tests and their test selection accuracy—how often selected regression tests are relevant to the issue. We perform this analysis for all our combinations of agents and LLM backbones across task difficulties.

6.2.2 Approach To identify regression tests, we extract Python filenames run throughout trajectories. For workflow agents, explicitly formatted trajectories enable automatic parsing of agent-run tests. For open-process agents, we consider any execution of a pre-existing repository file as a regression test. We define gold (relevant) regression tests as the pass-to-pass tests in the SWE-bench evaluation; other project tests are non-gold. Analysis is done at the file level: we compile files containing gold regression tests and check whether agent-executed filenames match this list.

Agent Tooling (RQ4)

7.1 Motivation Agent actions take the form of tool APIs invoked to perform specific functions, and these tools are often specialized for each agent, resulting in diverse action spaces. We classify such tools into common categories to compare usage across OpenHands, SWE-Agent, and MASAI with all available LLM backbones, considering only tools used on SWE-bench (which excludes OpenHands web browsing). We exclude Agentless and ACR because their workflow implementations preclude LLM action selection.