Workstreams starting together no longer lose a workspace

The flaky Coordinator test was hitting a real bug. When several cards of a repository started at once (all the workstreams of a project, say), git sometimes failed to create one card's worktree. That card went back to planned and its conversation showed this error:

The workspace could not be prepared: git worktree add --quiet -b obeya/titel-w3-7722e1 …/ws/7722e187 main:
fatal: failed to read .git/worktrees/6128b0c2/commondir

Git can't fully handle two worktrees being added to the same repository at the same moment. One add reads the list of worktrees while the other is still writing its own entry. It finds that entry half-written and gives up. Under the load of the full test suite this happened often enough to break the test now and then.

The fix

When a worktree add fails with this specific error, it now waits briefly and tries again, up to five times. Pauses are 50, 100, 150 and 200 ms. Any other git error still fails straight away. Worktrees still get created in parallel. Creating them one at a time would have made every start wait for the slowest checkout before it.

Measured on this Mac

The test alone, run 40 times at once and repeated, while 14 extra processes kept all 14 cores busy:

CodeRunsFailedRetries that saved a start
Before (main)6405–
After96007

Full bun run test after the fix, three times in a row:

RunPassedFailed
124410
224410
324410