HAFixAgent: History-Aware Automated Program Repair Agent
Abstract
HAFixAgent, a history-aware bug-fixing agent, improves automated program repair by incorporating repository history, enhancing effectiveness and efficiency for complex multi-hunk bugs.
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.
Community
HAFixAgent: We gave an AI bug-fixing agent git blame, and it fixed 212% more bugs in Defects4J.
AI agents for code repair are powerful but blind to history. We fixed that.
We found 70.7% of all Defects4J bugs trace back to a single historical commit. So, we built HAFixAgent to inject that blame context directly into its reasoning loop.
It's not just more effective (+212% vs. SOTA agents), it's also efficient: no significant cost increase.
For agentic software engineering, history matters.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- PerfBench: Can Agents Resolve Real-World Performance Bugs? (2025)
- RelRepair: Enhancing Automated Program Repair by Retrieving Relevant Code (2025)
- Improving Code Localization with Repository Memory (2025)
- InspectCoder: Dynamic Analysis-Enabled Self Repair through interactive LLM-Debugger Collaboration (2025)
- Automating Android Build Repair: Bridging the Reasoning-Execution Gap in LLM Agents with Domain-Specific Tools (2025)
- An Empirical Study on Failures in Automated Issue Solving (2025)
- Collaborative Agents for Automated Program Repair in Ruby (2025)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper