Agentic AI
Repository History Boosts AI-Powered Bug Fixing, Especially for Weaker Models
Researchers show that incorporating a codebase's commit history into AI repair agents significantly improves their ability to fix bugs, with gains up to 64% on some models.
Automated bug repair powered by large language models has become a major research focus, but most systems focus solely on the buggy code itself. A new study from arXiv explores whether tapping into version control history—specifically, the context of past commits that modified the same code—can help AI agents fix bugs more effectively.
The Study: HAFixAgent and Repository History#
The researchers created HAFixAgent, a program repair agent that injects blame-derived repository context (which developer modified which lines and why) into its repair logic. They tested it on 854 Java bugs from Defects4J and 501 Python bugs from BugsInPy, comparing performance with and without historical context across three base models.
The results were striking. History-aware repair improved success rates by +4.4% to +64.3% depending on the model strength—smaller gains on the strongest model, but dramatic improvements on weaker ones. HAFixAgent also outperformed existing repair agents like RepairAgent and BIRCH-feedback by 56.6% and 47.1% respectively on the strongest model, demonstrating its overall effectiveness independent of history.
Why History Helps#
The study found that bug-relevant history is widely available across both Java and Python projects. The researchers tested three different strategies for incorporating this historical context, and crucially, discovered that each strategy repairs a different subset of bugs. When combined into a hybrid approach, these methods fixed significantly more bugs than using no history at all (statistically significant at p < 0.001).
Practical Efficiency#
The history-aware approach carries minimal computational overhead. Individual history heuristics generally cost no more agent steps or tokens than baseline repair, even when locating faults in more realistic (spectrum-based) ways. The hybrid method roughly doubles computational cost when run in cascade, but the trade-off in repair success appears worthwhile.
Impact and Implications#
These findings suggest that AI-based program repair can improve substantially by learning from version control—a resource already available in almost every software project. The advantage is particularly pronounced for smaller or earlier-generation language models, potentially democratizing access to effective automated repair tools.

