Commit 534500d
committed
🤖 fix: git polling defers to agent commands via flock coordination
Problem: Git fetch polling would hold locks that caused agent git operations
(git add, commit, checkout, etc.) to fail with 'another git process' errors.
Solution: Use flock-based coordination between polling and agent commands:
1. Agent bash commands acquire a SHARED lock on .git/mux.lock
- Multiple agent commands can run concurrently (shared locks compatible)
- Lock acquired at start, released when command exits
2. Git fetch polling tries to acquire EXCLUSIVE lock (non-blocking)
- If agents are running (shared locks held), fetch skips this cycle
- Polling retries on next cycle (3s later with exponential backoff)
This ensures:
- Agent operations are never blocked by polling
- Multiple agent commands can run concurrently
- Polling only runs when workspace is idle
Also adds belt-and-suspenders check for git's own lock files.
_Generated with `mux`_1 parent 59be8be commit 534500d
2 files changed
+44
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
90 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
91 | 117 | | |
92 | 118 | | |
93 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
19 | 35 | | |
20 | 36 | | |
21 | 37 | | |
| |||
242 | 258 | | |
243 | 259 | | |
244 | 260 | | |
| 261 | + | |
245 | 262 | | |
| 263 | + | |
246 | 264 | | |
247 | 265 | | |
248 | 266 | | |
| |||
0 commit comments