HAFixAgent: History-Aware Automated Program Repair Agent

  • 2025-11-05 17:04:35
  • Yu Shi, Hao Li, Bram Adams, Ahmed E. Hassan
  • 0

Abstract

Automated program repair (APR) has recently shifted toward large languagemodels and agent-based systems, yet most systems rely on local snapshotcontext, overlooking repository history. Prior work shows that repositoryhistory helps repair single-line bugs, since the last commit touching the buggyline is often the bug-introducing one. In this paper, we investigate whetherrepository history can also improve agentic APR systems at scale, especiallyfor complex multi-hunk bugs. We present HAFixAgent, a History-Aware Bug-FixingAgent that injects blame-derived repository heuristics into its repair loop. Apreliminary study of all 854 real-world bugs from Defects4J motivates ourdesign, showing that bug-relevant history is both widely available and highlyconcentrated. Empirical comparison of HAFixAgent with two state-of-the-artbaselines shows: (1) Effectiveness: HAFixAgent significantly improves over theagent-based baseline (by 212.3%) and the multi-hunk baseline (by 29.9%). (2)Efficiency: history does not significantly increase agent steps and keeps tokencosts comparable, with notably lower median costs for complexmulti-file-multi-hunk bugs. (3) Practicality: combining different historicalheuristics repairs more bugs, offering a clear cost-benefit trade-off.HAFixAgent offers a practical recipe for history-aware agentic APR: ground theagent in version control history, prioritize diff-based historical context, andintegrate complementary heuristics when needed.

 

Quick Read (beta)

loading the full paper ...