AI coding agents get sidetracked by outdated technical debt like old TODO comments and resolved bug references, wasting significant computing resources and time, according to a recent article by Google senior staff software engineer Sam Saccone and senior staff data scientist Madhuri Garikapati. The engineers describe this phenomenon as "agent distraction," where AI systems embark on unrequested "side-quests" after ingesting stale documentation, obsolete specifications, and long-forgotten code comments as context. The report finds that at best, these diversions increase token usage and execution time; at worst, they result in flawed logic and poor decisions.

Google's investigation examined TODO(bug/...) comments that linger in code long after the underlying issues are fixed or abandoned. By analyzing distributed traces from thousands of engineers and hundreds of millions of agent steps, the researchers discovered that roughly 13% of sessions exposed agents to inline TODO or FIXME references. Of those instances, agents took action targeting the referenced bug in 6% of cases. Most of the time, the developer's prompt didn't even mention the bug in question. When agents pursued these unprompted detours, 41% involved tickets that were already closed, while 57% involved open bugs that fell outside the developer's actual request—what the investigators labeled "scope creep." Using a multi-way fixed-effects regression with developer-clustered standard errors, the team calculated that these diversions added 70% more steps, 77% more tokens, and 105% more wait time per session.

The authors warn that obsolete specifications, resolved bugs, and lagging documentation "no longer rest in long forgotten corners of the codebase, but rather are unintentionally ingested as context indirecting and misdirecting the next wave of coders—the agents." By cross-referencing every TODO an agent encounters against the bug's status and the user's prompt, Google can automatically separate valid work from wasted detours at scale. The researchers conclude that tools such as presubmit analyzers, codebase scanners, and automated agents can help reduce agent distraction and improve AI coding effectiveness. X user Ryan White captured the issue succinctly: "This is just junior dev behavior at machine speed."

To tackle the problem, Google built scanner agents to identify and remove obsolete TODOs across its codebase. In some cases, these cleaners had to examine years of git history to confirm that both the TODO and its original intent were obsolete before submitting a pull request to delete the outdated reference. Over the past six months, the TODO cleaner has removed thousands of genuinely obsolete references, achieving more than 95% acceptance from human reviewers. The investigators note that this multi-layer approach demonstrates that cleanup can be automated without sacrificing human judgment. The 95% acceptance rate suggests that organizations can deploy similar tools to prevent their AI agents from chasing ghosts in the code, cutting costs and improving accuracy. As companies integrate AI more deeply into software development, maintaining clean documentation and up-to-date code comments will shift from good practice to economic necessity. The cost of outdated context compounds with every agent interaction, turning forgotten technical debt into real-time inefficiency.