arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.16809cs.SEcs.AI
收藏

AI生成代码在开源中的生存状况会怎样?解码AI生成代码的命运

Will It Survive? Deciphering the Fate of AI Agent-Authored Code in Open Source

Concordia University(康科德大学)

Musfiqur Rahman, Mahi Begoug, Emad Shihab

AI总结:

研究发现AI生成代码在开源项目中存活时间更长,但修改特征和预测挑战仍需进一步探索。

摘要:

将AI代理作为代码助手整合到软件开发过程中,引发了关于AI代理生成代码长期可行性的疑问。软件工程界普遍认为这种代码是“可丢弃的”,即被快速合并但随后被丢弃。如果属实,组织将面临将维护负担从生成转向部署后修复的风险。我们通过分析201个开源项目中的生存情况来检验这一假设,追踪了超过20万由AI代理和人类撰写的代码单元。与“可丢弃”叙述相反,代理生成的代码生存时间更长:在行级别,其修改率降低了15.8个百分点,修改风险降低了16%(HR=0.842,p<0.001)。然而,修改特征有所不同。代理生成的代码显示出适度提高的修正率(26.3% vs. 23.0%),而人类代码则显示更高的适应率。然而,效应大小较小(Cramér's V=0.116),且每个代理的变异超过代理与人类之间的差距。转向预测,文本特征可以识别易修改的代码(AUC-ROC=0.671),但预测修改发生的时间仍具挑战性(Macro F1=0.285),表明时间取决于外部组织动态。代理生成代码的瓶颈可能不在于生成质量,而在于管理其长期演化的组织实践。

英文摘要:

AI coding agents such as GitHub Copilot, OpenAI Codex and Devin now open pull requests (PRs) that are merged into open-source projects. Industry reports suggest that AI-assisted code is revised or reverted soon after it is written, which raises the concern that agent code is "disposable". However, little is known about what happens to agent code after it is merged. Knowing how long this code survives, and why it is changed, can help maintainers decide how much review it needs. We performed a survival analysis of the 648,959 lines that 2,794 merged PRs added outside vendored and generated paths in 215 open-source repositories from the AIDev dataset, comparing agent-attributed and human code within the same repositories. Agent-attributed code is not modified sooner than human code. When each PR is weighted equally, agent-attributed lines are modified later (HR = 0.83, 95% CI [0.75, 0.93]). This difference comes from the supervised assistants, mainly Copilot and Codex (HR = 0.76). Code from Devin does not differ from human code over the whole period (HR = 0.95), but among PRs merged after mid-May 2025, code from both the supervised assistants and Devin is modified later. Without PR weighting, the difference is not statistically significant. When agent-attributed code is modified, the intent of the change is similar to that of human code (Cramer's V = 0.080). A file's size and recent changes predict whether agent-attributed code will be modified better than its code tokens do (AUC-ROC 0.78 vs. 0.70), and process features predict when it will be modified only weakly (Macro F1 of 0.31 against 0.25 for a random guess). Our findings suggest that agent code is not disposable, but whether it survives longer than human code depends on the agent, on when the code was merged and on how the comparison is computed.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑