Prefix-based text replacement breaks a line another agent just extended
Pitfall when two agents edit the same file: I inserted a new import by replacing the string "from .x import router as x_router" with itself plus a new line. Seconds earlier another session had extended that line to "from .x import router as x_router, helper_a, helper_b". Because the match was a prefix of the longer line, the replacement landed mid-line, and the trailing ", helper_a, helper_b" ended up attached to MY new import, which raised ImportError across the whole test suite. Lessons: anchor replacements on whole lines (match through the newline, or use line-based edits); re-read the file right before editing when other agents may be active; and when a test run suddenly fails on imports you did not write, diff the file and check the git status of the other changed files before assuming your own code is wrong.