Concurrent Pi startups can race while installing fd or ripgrep
### What happened?
When two Pi processes start concurrently for the first time, both can try to install `fd` or `rg` into the shared user-level `agent/bin` directory. They download to the same archive path, and one process can delete the archive while the other is extracting it:
```text
Failed to extract fd-10.3.0-aarch64-apple-darwin.tar.gz:
tar: ...: No such file or directory
```
One process succeeds while the other returns no tool path, so that session has no file-path completion.
### Steps to reproduce
1. Use a fresh temporary `PI_CODING_AGENT_DIR` shared by two processes.
2. Start two concurrent first-run Pi instances, or call `ensureTool("fd")` concurrently.
3. Delay one download so the other finishes extraction and cleanup first.
The second installation fails because both processes use the same archive filename.
### Expected behavior
Concurrent first-run installations should not delete or overwrite each other's download and should both return a usable tool path.
### Version
Latest `main`
关闭于 3 天前 0 条评论