TL;DR
DPIAgent is a novel framework that significantly improves how AI agents automatically write reproduction tests for software bugs. By breaking down the task into distinct exploration and test-writing phases with restricted toolsets and a strict handoff protocol, it prevents the agent from getting confused or distracted. DPIAgent achieves a state-of-the-art 81.76% success rate on the SWT-Bench Verified benchmark using GPT-5, jumping to 86.17% when paired with an advanced test selection strategy.
What Problem Does This Paper Address?
When a software bug is reported, developers need a "reproduction test"—a test case that fails on the buggy code but passes once the fix is applied. Automating this process using Large Language Models (LLMs) is incredibly valuable but notoriously difficult.
Existing AI approaches usually treat this as a single, continuous loop where the agent simultaneously tries to understand the bug and write the test. This "monolithic" approach suffers from compound-objective ambiguity and goal drift: the agent often starts writing code before fully understanding the root cause, gets distracted by having too many tools available at once, or loses track of its original objective.
Methods
The authors introduce DPIAgent, which enforces structural boundaries on the agent using three core principles: Divide, Protocol, and Isolate (DPI).
- Divide: The monolithic loop is split into two sequential, single-objective phases: Defect Exploration (Phase 1) and Test Generation (Phase 2).
- Protocol: The agent cannot silently transition between phases. It must invoke a specific tool (
ready_to_write_test) and generate a structured 6-field handoff summary. This summary details the bug location, root cause, expected vs. actual behavior, reproduction strategy, reference tests, and a concrete test plan. - Isolate: To prevent "tool distraction," the agent's action space is strictly gated. In Phase 1, it only has access to code-graph navigation and file-reading tools. In Phase 2, these exploration tools are completely removed and replaced strictly with file-editing (
edit) and test-execution (bash) tools.
Additionally, the framework incorporates a Test Selection mechanism. It generates five stylistic rewrites of the bug report to create a diverse pool of candidate tests, then ranks them based on how well they perform against automatically generated "surrogate" code patches.
Datasets
The framework was evaluated on SWT-Bench Verified, a benchmark consisting of 433 real-world GitHub issue instances. This dataset is a curated subset of SWT-Bench, specifically filtered to ensure reliable ground-truth patches and to eliminate flaky tests, making it a highly reliable benchmark for comparing LLM capabilities.
Key Insights and Ideas
- Structure vs. Scale: One of the most striking findings is that architectural structure and model scale are complementary. Implementing the DPI framework on a smaller, weaker model (GPT-5-Mini) allowed it to outperform a much larger model (GPT-5) running a standard monolithic loop.
- The Danger of Premature Editing: Monolithic agents often begin editing files within their very first steps, interleaving test writing with exploration. DPIAgent forces the model to commit to a complete diagnosis before writing a single line of a test.
- Action-Space Distraction: LLMs frequently misuse tools if given too many options. Removing search and navigation tools during the test-writing phase keeps the agent strictly focused on crafting and verifying the test.
Key Results
DPIAgent was tested across three major backbone models (GPT-5-Mini, GPT-5, and Claude-Opus-4.5) and compared against seven baseline architectures.
- State-of-the-Art Performance: With DPI alone, the framework achieved an 81.76% success rate on GPT-5, the highest reported among open-source methods. Adding the test selection mechanism pushed this to 86.17%.
- Massive Gains on Smaller Models: On GPT-5-Mini, DPIAgent achieved a 74.28% success rate, outperforming the strongest baseline (OpenHands) by 11.88 percentage points.
- Efficiency Boost: DPIAgent doesn't just perform better; it's faster. The structured exploration tools and phase isolation reduced the median number of agent steps by approximately 29% across all tested backbones.
Limitations and Future Work
While the DPI principles are inherently language-agnostic, the current evaluation was restricted entirely to Python repositories within SWT-Bench. Future work is required to validate its performance on other programming languages like Java or C++.
Additionally, because the framework relies on multi-turn agent loops and an ensembling/diversification strategy for test selection, the inference cost scales with repository size. The authors note that developing more selective context management strategies will be a critical next step to improve cost efficiency.
Summary updated