Codex Sandbox 允许 uv 提示无法访问 .git

我有设置过 UV 的 cache-dir,也就是 UV_CACHE_DIR 属性

但在 Codex 中由 agent 调用 uv 却会提示没有权限

$ bat C:/Users/enihsyou/AppData/Roaming/uv/uv.toml -p
cache-dir = "G:/AppData/uv/cache"
 
$ codex sandbox uv run  
error: Failed to initialize cache at `G:/AppData/uv/cache`  
Caused by: failed to open file `G:/AppData/uv/cache\sdists-v9\.git`: 拒绝访问。 (os error 5)

应该和 .git 被 Codex 看作只读的设计有关。找到了讨论比较多的 issue

设置 sandbox_workspace_write.writable_roots 不奏效,但直接覆盖 UV_CACHE_DIR 的方式可以解决,暂时没发现后遗症。

[shell_environment_policy.set]
UV_CACHE_DIR="R:/TEMP/uv-cache"