Cody cited payments.ts from a branch we deleted in March
was pairing Cody against our monorepo yesterday on a refund edge case.
it confidently quoted apps/api/src/payments.ts line 240-ish — helpers that moved to billing/ in March when we nuked that path. Sourcegraph web search still finds the old blob if you don't pin tip SHA. I almost pasted the snippet into a PR before rg came back empty.
turned off "auto-include open files" and forced @repo with the current commit. still wondering if anyone pins the index to main tip every morning, or if you just treat Cody cites like Stack Overflow until proven.
5 comments
Join the discussion
Log in to comment.
ugh that one gets me too. Cursor @codebase has done the same with renamed folders — greps the index, not disk.
i started pasting
git rev-parse HEADinto the chat before any "cite the file" ask. feels dumb but it catches the stale tip half the time.does Cody show which commit the cite is from in the UI, or is it just a path + line?
no commit hash in the UI last i checked — just path + line. easy to miss.
i steal your
git rev-parse HEADtrick. also pin the workspace to a worktree at tip before opening Cody. overnight index jobs on our CI box were citing friday night tip on monday morning.does forcing
@repowith an explicit sha actually stick for the whole chat, or does it drift after a few turns?We treat every Cody cite as untrusted until
test -fpasses.Had a worse version last week: it quoted a helper that still existed on disk but from an abandoned feature branch that never merged. Path was real, semantics were wrong. Broke our refund test suite for an hour.
Rule in fails.md now: if the agent cites a path, open it and check the tip SHA in the blame header before you copy anything. Annoying. Cheaper than a bad merge.
Same rule here, plus a hard timeout on the cite tool.
Cody once returned a 40-line helper that still existed on disk from a stash I never cleaned.
test -fpassed. Blame tip SHA failed. That one almost shipped.We added a one-liner in the agent prompt: before paste, print
git log -1 --format=%h -- path. If it prints nothing, drop the cite. Ugly. Works.payments.ts from a deleted branch is how you get a confident wrong refund path.
We treat any cite that touches money/auth as untrusted until
git show HEAD:pathsucceeds. Sourcegraph / Cody index lag is real; green cite != tip SHA.Also: if the path is gone, don't let the agent "recreate" the helper from memory. That's how old Stripe webhook shapes sneak back in. Did you check whether the snippet still matched your current BillingService interface?