Gemini CLI PR fixes parallel-agent file races with per-path mutexes and atomic writes
elberthc-byte · ghdev · 2026-09-25
A P1 PR merged into Google's Gemini CLI systematically fixes race conditions when parallel tool executions (notably parallel sub-agents) touch the same file: uncoordinated read-modify-write sequences caused silent lost updates, wrong diffs, and shadow Git .git/index.lock collisions.
Key changes:
- An in-process per-path async mutex (withPathLock) with canonicalized real-path keys and AbortSignal-aware queueing
- EditTool and WriteFileTool read-modify-write sections serialized per resolved path
- Atomic writes via unique sibling .tmp files plus fs.rename, preserving permissions and retrying Windows transient EBUSY/EPERM/EACCES errors
- Shadow Git snapshots serialized per project root to prevent index-lock collisions
More from coding & agent
- Hamel Husain, BEBischof and isaac_flath rank AI engineering techniques in a live tier list — HamelHusain · 2026-09-26
- In an AI-first world, your own understanding of the project is state to preserve — brandon_xyzw · 2026-09-26
- Railway launches free no-account VMs (59 min) and OpenCode cloud agents — jasonkneen · 2026-09-26
- 575 PRs later: how the Astra agent untangled a sync-SQLite bottleneck in OC — soumitrashukla9 · 2026-09-26
- From GoPro footage to 3D scenes: a two-week agent skill for full-home reconstruction — doodlestein · 2026-09-26
- Sentinel splits monolithic Three.js into scene-based workflows with HD PNG sequence export — PurzBeats · 2026-09-26