"Refactoring Runaway": Understanding and Mitigating Tangled Refactorings in Coding Agents for Issue Resolution
Zhao Tian, Zifan Zhang, Tao Xiao, Dong Wang, Masanari Kondo, Junjie Chen, Yasutaka Kamei

TL;DR
This study analyzes how coding agents perform refactoring during issue resolution, finding they do so less frequently and with less intensity than humans, and proposes a refactoring-aware approach to improve code quality.
Contribution
It provides the first empirical analysis of tangled refactorings in coding agents and introduces a refactoring-aware refinement method to enhance code compilability.
Findings
Coding agents introduce fewer tangled refactorings than humans.
Refactoring-aware approach improves compilability from 19.34% to 38.33%.
Tangled refactorings are linked to reduced compilability but not to correctness.
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
