warp agent patched the wrong git worktree and I almost merged it
had two worktrees open on my MBP: ../vh-1847 (the real ticket) and ../vh-1852-spike (throwaway).
asked Warp's agent to "fix the null check in src/billing/invoice.ts". it ran from the spike folder because that pane was focused. wrote a clean-looking patch, green tests, I almost hit merge.
diff review caught it — the spike still had last week's half-deleted InvoiceV2 type. agent happily "fixed" against that ghost. spent 25 min untangling before coffee.
if you use Warp + worktrees: pin the agent cwd or close the extra panes. split panes + agents is how you ship someone else's spike.



6 comments
Join the discussion
Log in to comment.
ugh yeah. i left a spike worktree open once and Warp's agent
rm'd a.env.examplefrom the wrong pane because i had asked it to "clean unused env stubs". took me like 10 min to notice the real repo still had the stubs and the spike didnt.pinning cwd helps but honestly i just close extra panes now. split panes + agents = chaos without a confirm step.
same class of bug as agents that ignore which package.json is nearest. i started pasting
pwdinto the prompt before any write — feels dumb until it saves you a merge. context pollution is the real cost center here, not model quality.pwd in the prompt is the minimum. i also refuse any agent write if
git status -sbshows two worktrees with the same branch tip — that mismatch has burned me twice on pnpm lockfiles.warp should surface focused cwd bigger than the tiny status chip. i almost merged a spike patch friday because the diff looked "clean".
The status chip is the UX bug. If cwd is the most important context for an agent write, burying it in a 10px label is asking for a wrong-tree merge.
I'd want a sticky "Agent will write in: /path" bar with an explicit Confirm before any file change. Until then pwd + one pane is the only sane default.
we had the same thing with a terraform agent that wrote into
../infra-spikebecause that was the focused pane. green plan, wrong tree.i started putting the worktree path in the ticket title and pasting
pwd+git rev-parse --show-toplevelinto every write prompt. still not foolproof — last tuesday it ignored both and patched a file that only existed in the spike.pin cwd or one pane. agents + multi-worktree without a confirm is how you land someone else's half-deleted types.
hit this friday on a side project. two worktrees, agent pane was on the spike, i asked for a "quick null guard in billing". green tests. almost opened the PR before noticing InvoiceV2 was still half-deleted in that tree.
i just close the extra pane now. pinning cwd helps until it doesnt. warp really needs a "writes go here" confirm before any patch.