Stale TODOs Derail Coding Agents: Why Old Repo Text Reads as Instructions
Agents read repo text as current intent, so old TODOs and stale bug references pull them off-task.
Reviewed by Abhijith N M · 24 October 2026 · Editorial standards
You give a coding agent a task: add a null check to the login handler. A coding agent typically doesn't just open that file; it searches the repository for related text, and that search can return more than you expected. Imagine, for example, that it surfaces a few TODO comments in nearby files, a reference to a bug tracker ticket that was closed long ago, and a spec doc describing an endpoint that no longer exists. Google senior staff software engineer Sam Saccone and senior staff data scientist Madhuri Garikapati, as reported by InfoQ, describe "agent distraction": AI coding agents get derailed by stale technical debt and go on unrequested "side-quests." Technical debt here means leftover text in the repo that no longer matches reality. An agent has no memory of your team's history. Everything it knows about intent arrives as text in its context window, the block of input it reads before acting. A TODO that says "refactor this before shipping" reads exactly like a fresh instruction. The agent cannot tell an old note from a current requirement, because both are just strings. So a stale TODO isn't inert. It's an unowned instruction sitting in the repo, and the agent may follow it. A reasonable response is to clean or scope the context: delete dead TODOs, repoint bug references at live tickets, and tell the agent which files and docs are in scope. The source reports the problem but doesn't measure how well these remedies work, so treat them as sensible hygiene rather than a proven fix. The practical lesson: your repo is now partly a prompt. Treat leftover text as instructions someone might follow. This is analysis of the general principle, not a description of any specific product's internals.
Stale TODOs Derail Coding Agents: Why Old Repo Text Reads as Instructions — Visual Breakdown
import re
from pathlib import Path
# Matches TODO/FIXME/XXX markers anywhere in a line, including strings and
# docstrings. This finds markers, not staleness: a human still has to judge
# which ones are dead. Expect false positives (e.g. "xxx" in prose).
STALE = re.compile(r"(TODO|FIXME|XXX)\b", re.IGNORECASE)
def find_stale_markers(root: str) -> list[tuple[str, int, str]]:
"""Scan .py files under root for TODO/FIXME/XXX markers.
Files that are unreadable or not valid UTF-8 are skipped rather than
aborting the scan.
"""
hits = []
for path in Path(root).rglob("*.py"):
try:
text = path.read_text(encoding="utf-8")
except (OSError, UnicodeDecodeError):
continue
for lineno, line in enumerate(text.splitlines(), 1):
if STALE.search(line):
hits.append((str(path), lineno, line.strip()))
return hits
if __name__ == "__main__":
for path, lineno, text in find_stale_markers("./src"):
print(f"{path}:{lineno}: {text}")Quick Concept Check
Test your understanding in 15 seconds
Why can a stale TODO comment pull a coding agent off-task?
Related Concepts
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.