在最近的一篇文章中,谷歌高级软件工程师 Sam Saccone 和高级数据科学家 Madhuri Garikapati 指出了智能体分心的代价:AI 编码智能体会因陈旧的技术债务(如过时的 TODO 注释、已废弃的 Bug 引用和过时的规格说明)而偏离正轨,从而开始执行用户没有要求的“支线任务”。
过时的规格说明、早已解决的 Bug 以及过时的文档,不再只是沉睡在代码库中那些被遗忘的角落里,而是被无意间引入了上下文中,间接地误导了下一代编码者,也就是这些智能体。
按照作者的说法,在最好的情况下,智能体分心会增加令牌消耗和执行时间;在最坏的情况下,则可能会导致智能体产生“错误的逻辑和决策”。为了研究其影响,他们将研究重点放在了 TODO(bug/...) 注释上——正如他们所指出的那样,这类注释“往往在底层缺陷被修复或放弃后仍然长期地保留了下来”。
通过将智能体遇到的每个 TODO 与该 TODO 的 Bug 状态及用户提示词进行交叉比对,我们可以大规模地自动区分有效的工作与无谓的绕路。
通过分析来自数千名工程师的分布式跟踪数据以及数亿次智能体操作,谷歌发现,在约 13% 的会话中,智能体遇到了内联的 TODO/FIXME 引用,而在其中 6% 的案例中,智能体针对被引用的缺陷采取了行动。在大多数情况下,提示词甚至没有提及被引用的缺陷。此外,在这些没有提示的“绕道”操作中,在 41% 的情况下,智能体处理的是已经关闭了的工单;在 57% 的情况下,它们处理的是仍然处于开放状态但超出了开发者请求范围的缺陷,调查人员将此归类为“范围蔓延”。
研究人员采用多向固定效应回归模型(标准误差按开发者分组),发现这些冗余操作给每次会话带来了额外的开销:步骤增加了 70%,token 消耗增加了 77%,等待时间增加了 105%。
为了解决这一问题,谷歌开发了扫描智能体,用于识别并清理代码库中已经过时的 TODO 项。在某些情况下,这些智能体需要检查长达数年的 Git 历史记录,才能确认某个 TODO 及其背后的意图均已过时。不过,只有在确认这一点后,它们才会提交拉取请求(PR),从代码库中移除过时的引用。
得益于这种多层级的方法,我们的 TODO 清理工具在过去的 6 个月中成功地移除了数千个真正过时的引用,并且人工审核员的认可率超过 95%。
研究人员得出结论:提交前分析器、代码库扫描器和自动化智能体等工具有助于缓解“智能体分心”现象,从而提高 AI 编码智能体的效率。
针对这一发现,X 平台用户 Tulasiram 评论道:“这提醒我们,注释也是上下文的一部分。” Ryan White 强调:
这不过是初级开发者的行为在以机器速度重演。留下一个误导性的注释,就会有人为此耗费一整天。只不过现在,这种情况每小时会发生 40 次,而你还要为此支付 token 费用。
在 LinkedIn 上,用户 Awais Raza 对缓解智能体分心的可能性表示乐观:
TODO 清理工具获得了 95% 以上用户的认可。这一事实颇具启示意义:这表明清理工作可以实现自动化,同时又不失人类的判断力。
最后,Muhammad Zohaib 进一步拓展了这一观点,他指出:“网站可能也是如此:过时的页面和相互矛盾的信息会让 AI 系统更难选出正确的答案。”
声明:本文为 InfoQ 翻译,未经许可禁止转载。
原文链接:https://www.infoq.com/news/2026/11/google-agent-distraction/
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
In a recent article, Google Senior Software Engineer Sam Saccone and Senior Data Scientist Madhuri Garikapati highlighted the cost of AI agent distraction: AI coding agents can be sidetracked by stale technical debt—such as outdated TODO comments, deprecated bug references, and obsolete specifications—and begin executing "side quests" the user never asked for.
Outdated specs, long-resolved bugs, and stale documentation are no longer just forgotten artifacts buried in corners of a codebase; they are inadvertently pulled into context, indirectly misleading the next generation of coders—the agents themselves.
According to the authors, at best, agent distraction increases token consumption and execution time; at worst, it can lead agents down "erroneous logic and decision-making." To study the impact, they focused on TODO(bug/...) comments—noting that such annotations "tend to persist long after the underlying defect has been fixed or abandoned."
By cross-referencing every TODO an agent encounters with its associated bug status and the user prompt, they were able to automatically scale the distinction between productive work and aimless detours.
Analyzing distributed tracing data from thousands of engineers across hundreds of millions of agent operations, Google found that in approximately 13% of sessions, agents encountered inline TODO/FIXME references—and in 6% of those cases, the agent took action on the referenced defect. In most instances, the prompt did not even mention the referenced defect. Moreover, among these unprompted detour actions, 41% involved tickets that had already been closed, and 57% involved defects still open but outside the scope of the developer's request—a category the researchers labeled "scope creep."
Using a multi-way fixed-effects regression model (with standard errors grouped by developer), the team found that these redundant operations imposed additional overhead per session: step count increased by 70%, token consumption rose by 77%, and wait time grew by 105%.
To address this, Google built scanning agents designed to identify and clean up outdated TODO items in the codebase. In some cases, these agents must inspect Git history spanning several years to confirm that a given TODO—and the intent behind it—is genuinely stale. Only after confirming this do they submit a pull request (PR) to remove the obsolete reference from the codebase.
Thanks to this multi-layered approach, the team's TODO cleanup tool successfully removed thousands of genuinely stale references over the past six months, with a human reviewer approval rate exceeding 95%.
The researchers concluded that tools such as pre-commit analyzers, codebase scanners, and automated agents help mitigate the "agent distraction" phenomenon, thereby improving the efficiency of AI coding agents.
In response to the findings, X platform user Tulasiram commented: "This is a reminder that comments are part of context too." Ryan White emphasized:
This is just junior developers' behavior replaying at machine speed. Leave behind a misleading comment and someone will waste a whole day on it. Only now, it happens 40 times an hour, and you're paying for tokens.
On LinkedIn, user Awais Raza expressed optimism about the feasibility of mitigating agent distraction:
The TODO cleanup tool gained approval from over 95% of users. This fact is quite telling—it shows that cleanup can be automated without sacrificing human judgment.
Finally, Muhammad Zohaib expanded on this point, noting: "The same could apply to websites: stale pages and contradictory information make it harder for AI systems to choose the right answer."
Disclaimer: This article is a translation by InfoQ and may not be reproduced without permission.
Original link: https://www.infoq.com/news/2026/11/google-agent-distraction/
Auto-fetched and translated by AI Atlas. All rights belong to the original author.