用图分析提前发现代码修改可能破坏的测试,大幅减少AI编程助手出错。
TDAD: Test-Driven Agentic Development - Reducing Code Regressions in AI Coding Agents via Graph-Based Impact Analysis
- 构建代码与测试间的依赖图,预判修改影响范围。
- 在SWE-bench上将回归率从6.08%降至1.82%,降低70%。
- 轻量级技能可复用,比强行教流程更有效。
AI编程助手虽能解决实际软件问题,但常引入回归——导致此前通过的测试失败。现有基准主要关注修复率,对回归行为研究不足。本文提出TDAD(Test-Driven Agentic Development),一个开源工具,为AI编程助手提供变更前的影响分析。TDAD构建代码与测试间的依赖图,使代理在提交补丁前知晓需验证哪些测试,并可自我修正。该依赖图以轻量级代理技能形式提供,为运行时查询的静态文本文件。在SWE-bench Verified上评估,使用两个开源模型在消费级硬件上运行(Qwen3-Coder 30B,100实例;Qwen3.5-35B-A3B,25实例),相比基线,TDAD将回归率从6.08%降至1.82%,减少70%。而仅添加TDD流程指令但无针对性测试上下文,反而使回归率升至9.94%,甚至高于无干预情况。当作为代理技能部署于另一模型与框架时,问题修复率从24%提升至32%,证实提供上下文信息优于强制流程规范。所有代码、数据及日志均公开于https://github.com/pepealonso95/TDAD。
原文摘要 · Abstract (English)
AI coding agents can resolve real-world software issues, yet they frequently introduce regressions -- breaking tests that previously passed. Current benchmarks focus almost exclusively on resolution rate, leaving regression behavior under-studied. This paper presents TDAD (Test-Driven Agentic Development), an open-source tool that performs pre-change impact analysis for AI coding agents. TDAD builds a dependency map between source code and tests so that before committing a patch, the agent knows which tests to verify and can self-correct. The map is delivered as a lightweight agent skill -- a static text file the agent queries at runtime. Evaluated on SWE-bench Verified with two open-weight models running on consumer hardware (Qwen3-Coder 30B, 100 instances; Qwen3.5-35B-A3B, 25 instances), TDAD reduced regressions by 70% (6.08% to 1.82%) compared to a vanilla baseline. In contrast, adding TDD procedural instructions without targeted test context increased regressions to 9.94% -- worse than no intervention at all. When deployed as an agent skill with a different model and framework, TDAD improved issue-resolution rate from 24% to 32%, confirming that surfacing contextual information outperforms prescribing procedural workflows. All code, data, and logs are publicly available at https://github.com/pepealonso95/TDAD.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。