ChatPaper.aiChatPaper

HAFixAgent: 履歴を考慮した自動プログラム修正エージェント

HAFixAgent: History-Aware Automated Program Repair Agent

November 2, 2025
著者: Yu Shi, Hao Li, Bram Adams, Ahmed E. Hassan
cs.AI

要旨

自動プログラム修正(APR)は近年、大規模言語モデルとエージェントベースシステムへと移行しつつあるが、ほとんどのシステムはリポジトリ履歴を軽視し、ローカルスナップショットの文脈に依存している。先行研究では、バグを含む行を最後に変更したコミットがバグ導入の原因であることが多いため、リポジトリ履歴が単一行バグの修正に有効であることが示されている。本論文では、リポジトリ履歴が複雑なマルチハンクバグを含む大規模なエージェント型APRシステムの改善にも寄与するかどうかを検証する。我々は、blame情報から導出されたリポジトリ発見的手法を修正ループに組み込む履歴認識型バグ修正エージェント「HAFixAgent」を提案する。Defects4Jの実世界バグ854件全体に対する予備調査により、バグ関連履歴が広く利用可能かつ高度に集中していることが明らかになり、本設計の妥当性が示唆された。HAFixAgentと2つの最先端ベースラインとの実証比較により以下が明らかになった:(1)有効性:HAFixAgentはエージェントベースベースライン(212.3%向上)およびマルチハンクベースライン(29.9%向上)を大幅に上回る。(2)効率性:履歴利用によるエージェントステップ数の大幅な増加はなく、トークンコストも同等を維持。複雑なマルチファイル・マルチハンクバグでは中央値コストが顕著に低い。(3)実用性:異なる履歴発見的手法の組み合わせにより修正可能なバグ数が増加し、明確な費用対効果のトレードオフを提供する。HAFixAgentは、バージョン管理履歴へのエージェントの接地、差分ベース履歴文脈の優先順位付け、必要に応じた相補的発見的手法の統合という、履歴認識型エージェントAPRの実用的な設計指針を提供する。
English
Automated program repair (APR) has recently shifted toward large language models and agent-based systems, yet most systems rely on local snapshot context, overlooking repository history. Prior work shows that repository history helps repair single-line bugs, since the last commit touching the buggy line is often the bug-introducing one. In this paper, we investigate whether repository history can also improve agentic APR systems at scale, especially for complex multi-hunk bugs. We present HAFixAgent, a History-Aware Bug-Fixing Agent that injects blame-derived repository heuristics into its repair loop. A preliminary study of all 854 real-world bugs from Defects4J motivates our design, showing that bug-relevant history is both widely available and highly concentrated. Empirical comparison of HAFixAgent with two state-of-the-art baselines shows: (1) Effectiveness: HAFixAgent significantly improves over the agent-based baseline (by 212.3%) and the multi-hunk baseline (by 29.9%). (2) Efficiency: history does not significantly increase agent steps and keeps token costs comparable, with notably lower median costs for complex multi-file-multi-hunk bugs. (3) Practicality: combining different historical heuristics repairs more bugs, offering a clear cost-benefit trade-off. HAFixAgent offers a practical recipe for history-aware agentic APR: ground the agent in version control history, prioritize diff-based historical context, and integrate complementary heuristics when needed.
PDF32December 2, 2025