"Refactoring Runaway": Understanding and Mitigating Tangled Refactorings in Coding Agents for Issue Resolution

📅 2026-05-21
📈 Citations: 0
Influential: 0
📄 PDF

career value

215K/year
🤖 AI Summary
This study addresses the issue of spurious refactorings introduced by language agents in automated program repair, which often compromise patch compilability and correctness. Through the first systematic empirical analysis of 3,691 agent-generated patches, the work characterizes the prevalence, types, and impact of such refactorings on compilability. Building on these insights, the authors propose a refactoring-aware fine-grained repair approach that detects and selectively removes or corrects unnecessary or unsafe refactoring operations. Evaluated on the Multi-SWE-bench dataset, the method significantly improves patch compilability from 19.34% to 38.33% and additionally resolves 2.79% of previously unsolved bugs, demonstrating its effectiveness in enhancing both the reliability and efficacy of automated program repair.
📝 Abstract
Recent advances in coding agents have shown remarkable progress in software issue resolution. In practice, real-world issues are typically bug fixes or feature requests in which human developers naturally incorporate refactoring as part of the resolution process, resulting in tangled refactoring. Since LLMs are trained on large-scale open-source repositories, coding agents may inherit such behaviors. In this paper, we conduct an empirical study on Multi-SWE-bench, analyzing 3,691 valid patches generated by three agent frameworks with 12 LLMs. We find that coding agents introduce tangled refactorings less frequently (21.43% vs. 36.72%) and with lower intensity (0.66 vs. 1.75) than human developers, although they exhibit a broader diversity of refactoring types. Logistic regression analysis further shows that tangled refactorings are strongly associated with reduced compilability, while exhibiting no significant association with functional correctness. Based on these findings, we propose a refactoring-aware refinement approach that assesses the necessity and safety of tangled refactorings and selectively removes or repairs problematic operations. Our approach improves compilability from 19.34% to 38.33%, and additionally resolves 2.79% previously unresolved issues. Overall, this work presents the first step towards understanding tangled refactoring practices in agentic issue resolution and opens up avenues for future work.
Problem

Research questions and friction points this paper is trying to address.

tangled refactoring
coding agents
issue resolution
compilability
software maintenance
Innovation

Methods, ideas, or system contributions that make the work stand out.

tangled refactoring
coding agents
refactoring-aware refinement
issue resolution
empirical study