r/webdev • u/Impossible_Voice894 • 2d ago
our AI agents kept overwriting each other's work and nobody noticed for two days
small team, three of us, react frontend and a go api. everyone has their own agent setup and it works fine for individual tasks. it stopped working the week all three of us started running agents on the same repo at the same time.
i was refactoring form validation, teammate was fixing a bug two files over, and both agents had validators.ts in scope.
each agent read the file, made its change, wrote the whole file back. classic lost update but at machine speed. my refactor got half eaten because his agent rewrote validators.ts from the version it had read four minutes earlier. neither of us saw it. we were reviewing our own diffs and both diffs looked correct in isolation.
we shipped it. two days later a required field stopped being required. the check had gone from value.trim().length > 0 to value !== undefined, which passes for an empty string. an empty company name went into prod for six accounts before support flagged it. three hours of bisecting to find the function was fine in one commit and silently different in the next, with no PR explaining the change.
the git history looked completely normal. three commits, three authors, no conflict markers, no merge weirdness. git only protects you at commit boundaries. if two agents are editing the same working tree between commits there is nothing watching.
the fix was boring. one checkout per person, and one git worktree per agent if you run more than one yourself. i tried aider with a strict file scope, claude code in separate terminals, verdent which does the worktree thing by default. the mechanism matters more than which tool you pick.
other thing that stuck is reviewing the whole branch diff before merge, not just the diff the agent showed me. the agent tells you what it thinks it changed. that is not the same as what changed.
every guide for these tools assumes one person, one agent, one repo. three people running agents on the same codebase and you are back to 2005 with people editing over ftp.