arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2511.01047cs.SEcs.AI
收藏

HAFixAgent:基于历史的程序修复代理

HAFixAgent: History-Aware Agentic Program Repair

Queen's University(女王大学)

Yu Shi, Hao Li, Bram Adams, Ahmed E. Hassan

AI总结:

本文提出HAFixAgent,通过注入历史衍生的仓库启发式方法,提升大规模多补丁bug修复的效率与鲁棒性,实验证明其在Defects4J和BugsInPy上均优于现有方法。

摘要:

自动程序修复(APR)近期转向大语言模型和基于代理的系统,但大多数系统依赖局部快照上下文,忽视仓库历史。先前研究显示,仓库历史有助于修复单行bug,因为最后一次修改bug行的提交通常是引入bug的提交。本文研究仓库历史是否能提升大规模代理APR系统,尤其是复杂多补丁bug。我们提出HAFixAgent,一种基于历史的bug修复代理,将blame衍生的仓库启发式方法注入其修复循环。对854个Defects4J(Java)和501个BugsInPy(Python)bug的初步研究表明,bug相关的历史在两个基准上广泛可用。使用相同的LLM(DeepSeek-V3.2-Exp)进行所有实验,包括重复基线,我们显示:(1)有效性:HAFixAgent在Defects4J上优于RepairAgent(+56.6%)和BIRCH-feedback(+47.1%)。历史上下文进一步在Defects4J上提高修复效果+4.4%,在BugsInPy上提高+38.6%,尤其在单文件多补丁(SFMH)bug上。 (2)鲁棒性:在噪声故障定位(+1/+3/+5行偏移)下,历史提供增加的鲁棒性,维持SFMH bug的成功率40到56%,而无历史的基线崩溃至0%。 (3)效率:历史不会显著增加代理步骤或令牌成本。

英文摘要:

Automated program repair (APR) has recently shifted toward large language models and agent-based systems, while prior work shows that repository history can help repair single-line bugs. We conduct a large-scale empirical study of whether, how much, and under what conditions repository history improves agentic APR beyond this setting. We present HAFixAgent, a history-aware program repair agent that injects blame-derived repository context into its repair loop. Across 854 Defects4J (Java) and 501 BugsInPy (Python) bugs, we first show that bug-relevant history is widely available. We then evaluate HAFixAgent across three base models under perfect fault localization. The best history heuristic improves over non-history from +4.4% on Defects4J and +1.1% on BugsInPy with the strongest model to as much as +64.3% with weaker models. HAFixAgent also outperforms RepairAgent by +56.6% and BIRCH-feedback by +47.1% on the strongest model, showing that it is a strong repair agent independent of history. The three history heuristics are complementary: each repairs a different subset of bugs, so their hybrid significantly repairs more bugs than non-history (McNemar's test, p < 0.001), and this advantage persists under realistic spectrum-based fault localization. Individual history heuristics are generally no more expensive than non-history in agent steps or tokens under either localization setting, while the hybrid costs roughly twice a single run in a cascade setting.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑