Abstract
Automated Program Repair (APR) models often struggle to generate correct patches without understanding developer intent. While previous research used post-hoc commit messages as a proxy for intent, this creates a data leakage problem. This paper introduces the Disc-BFP datasets, which link buggy code to the natural language discussions that occurred before the fix. By evaluating various extraction methods—including heuristics, summarization, and attention-based segments—we show that developer discussions provide a realistic and effective signal for bug fixing, outperforming traditional "oracle" baselines.
Introduction
The goal of Automated Program Repair (APR) is to automatically generate code patches. However, code alone often lacks sufficient context to determine the correct fix. For instance, a model may not know if a trailing newline is required or should be removed based solely on syntax.
Historically, researchers used commit messages to provide this "intent." However, commit messages are written after the fix is completed, making them an unrealistic "oracle" for real-world deployment. This paper explores using the discussions developers have in issue trackers prior to the fix as a more authentic source of context.
Methods and Datasets
We utilize PLBART, a sequence-to-sequence model pretrained on code and technical text. To bridge the gap between messy discussions and code fixes, we explored several context extraction strategies:
- Heuristics: Using the discussion Title, the Whole Discussion, or the Last Utterance.
- Solution Descriptions: Summarizing the discussion into a concise instruction using a separate model.
- Attended Segments: Identifying and using the specific parts of the discussion that a summarization model prioritized.
These methods were tested on the new Disc-BFP (Discussion-augmented Bug-Fixing Patches) datasets, which map thousands of GitHub bug-fixing commits to their original issue threads. The datasets are split into Disc-BFP_small (methods < 50 tokens) and Disc-BFP_med (50-100 tokens).
Key Results
Our experiments demonstrate that natural language context significantly boosts bug-fixing performance, measured by Exact Match (EM) scores.
As shown in the results table, adding discussion context improved EM scores by up to 2.4% for small methods and 1.8% for medium methods compared to a baseline with no natural language. Notably, the "Attended Segments" approach on Disc-BFP_small achieved 36.2% EM, outperforming the "Oracle Message" baseline of 33.4%. This suggests that developer discussions often contain richer technical details than the final commit message.
We also found that conciseness is critical; while the "Whole Discussion" can be noisy, heuristics like the Last Utterance or the Title provide strong, focused signals. For medium-sized bugs, the Last Utterance proved to be the most reliable source of truth. Further experiments showed that combining Solution Descriptions with Titles could push performance even higher for smaller methods.
Conclusion
This work highlights that natural language is a vital bridge between problem descriptions and technical implementations. By using pre-fix developer discussions, APR models can achieve state-of-the-art results while remaining applicable to real-world software development workflows. Future research will focus on more sophisticated methods for extracting the most relevant segments from long, complex developer conversations.
Summary updated