The reported bug was a carrier lookup returning 404 because an international phone number never reached E.164 normalization. The traceback pointed at normalizePhone. The agent searched the repo for "normalize", got back normalizeEmail, normalizePhone, and normalizeAddress, picked the first match, and spent the pass rewriting normalizeEmail into a prettier helper. It wrote a few unit tests against that helper, went green, and reported done. The original phone path never changed.

A keyword search returns a naming family, not a call graph. The agent matched tokens, not the failing symbol, and "I edited a function called normalize" became "I fixed the bug."

Why it lands on the lookalike

A broad search ranks by token overlap. Every normalize* function scores well on the same word, and nothing in the loop asks which symbol appears in the failing stack frame. The agent sees three interchangeable helpers and treats the first as the obvious target, because the traceback's exact function name was never pinned to the task as an anchor.

Naming families invite the slip. When normalizeEmail, normalizePhone, and normalizeAddress live near each other and share a similar signature, they read as one generic utility even though their callers, inputs, and failure modes differ. The agent refactors the shared-looking helper rather than the one on the failing path, and its own new tests cover whatever it touched, so green confirms the edited code, not the reported bug.

The human review helps it through: we skim the diff for a sensible-looking cleanup, see tests pass, and miss that the edited function never appears in the original traceback.

The tells that the wrong function got fixed

  • **The edited symbol is absent from the failing stack trace.** Compare the function in the diff against the frame in the original report; if they differ, the edit never sat on the failing path.
  • The failing test references a different symbol.** A green suite built around `normalizeEmail` says nothing about `normalizePhone`; the new tests target the helper the agent chose, not the failure someone filed.
  • The original repro still fails on the exact input.** Feed the reported phone number back after the fix; a silent 404 that still appears means the untouched path stayed untouched.
  • The diff touches a happy path that already worked.** A cleanup of an unrelated normalization function reads as polish, not a carrier-lookup fix.
  • The agent describes the change generically** ("improved normalization") instead of naming the failing endpoint or stack frame.

Anchor the failing symbol before editing

The cheap guard is to pin the exact symbol from the traceback into the task before the agent touches anything: the module, function, and file the stack names are the only legitimate targets. A broad keyword search may surface neighbors, but none of them may be edited until the failing one is resolved.

  • **Require a before/after repro run on the original input.** The agent must run the failing case before the edit and again after, and the second run has to pass on the same reported input. A clean helper with no connection to the repro fails this gate.
  • Check callers against the failing request.** After choosing a symbol, grep its call sites and confirm one matches the reported request path; if none lines up, the match is a near miss.
  • Search from the stack frame, not the keyword.** Start from the frame the traceback names, then walk outward to siblings; do not let a generic token list pick the target for you.
  • Attach the minimal failing case to the agent.** When the repro stays visible through the session, done means that specific input behaves, not that an adjacent helper got cleaner.

Edited is not fixed

Green after a near-match cleanup proves only that the touched function passed its own new tests. Pin the symbol from the traceback, run the original repro before and after, and make sure the edited call site matches the failing request. When the agent patches the first lookalike it finds, the bug did not move; the agent just worked on the wrong page.