Enhancing LLM-Based Bug Reproduction via Code Entity Retrieval and Test Case Repair
Hao Ding, Yanjie Jiang, Yuxia Zhang, Hui Liu
Abstract
Automated bug reproduction from bug reports is a critical yet challenging step in software debugging. While LLM-based bug reproduction shows promise, its effectiveness is often hampered by insufficient contextual awareness of the relevant codebase and a tendency to produce invalid test cases. To address these limitations, we propose a novel approach, called LTER, that enhances LLM-based bug reproduction through fine-grained code entity retrieval and a feedback-driven dynamic repair loop. LTER first identifies specific code entities within bug reports to automatically extract precise contexts, including class definitions, constructors, and method logic. The extracted contexts are then used to guide the LLM in generating reproduced test cases. To further ensure executability, LTER employs an iterative repair mechanism to resolve complex dependencies. Specifically, upon injecting a generated test case into the project, if a compilation failure occurs, the framework forwards the error messages to the LLM for an initial repair. Should this initial repair fail, it empowers the LLM to analyze diagnostic messages to recognize missing context and retrieve indispensable dependencies, subsequently regenerating the test case with the supplemented data. Finally, LTER employs a hybrid cascade ranking strategy to accurately select the most effective reproduction test case from the generated candidates. The experimental results on the widely-used Defects4J benchmark show that LTER substantially outperforms the best performance in automated bug reproduction, increasing the reproduction success rate to 46.2% with successfully identifying a valid reproduction test as the top candidate in 38.1% of the cases. Furthermore, LTER demonstrates strong generalization capability, delivering robust performance on the GHRB dataset containing recent bugs previously unseen by the LLM.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get db63feed-3d66-40a7-a132-7b69142a1734Related papers
- Large Language Models are Few-shot Testers: Exploring LLM-based General Bug ReproductionSungmin Kang, Juyeon Yoon, Shin YooICSE 2023 · 163 citations
- Repair Ingredients Are All You Need: Improving Large Language Model-Based Program Repair via Repair Ingredients SearchJiayi Zhang, Kai Huang, Jian Zhang, Yang Liu et al.ICSE 2026
- iCoRe: An Iterative Correlation-Aware Retriever for Bug Reproduction Test GenerationJunyi Wang, Jialun Cao, Zhongxin LiuFSE 2026
- CausalRepair: Bridging the Causality Gap in Large Language Model-Based Automated Program Repair via Dual-SlicingLinhao Wu, Yizhou Chen, Zhen Yang, Pengyu Xue et al.ISSTA 2026
- Context Matters: Improving the Practical Reliability of LLM-Based Unit Test Generation (Experience Paper)Junjie Chen, Ziqi Wang, Lin Yang, Chen Yang et al.ISSTA 2026
