Way to configure location of worktrees
What version of the Codex App are you using (From “About Codex” dialog)?
Version 260203.1501 (523)
What subscription do you have?
ChatGPT Plus
What issue are you seeing?
In the Codex macOS app, when I use the UI flow to create a Git worktree, Codex always creates the worktree under a fixed default location:
/Users/{myuser}/.codex/worktrees/{worktreeid}/{MyProject}
There is no setting or UI option to choose/configure where the worktree should be created.
This is a major issue for workflows where the repo lives on an external/remote-mounted drive (e.g. SMB mounted volume). In my case, the repo lives here:
/Volumes/home/{MyProject}
Since the project is large and needs to run from the mounted volume, worktrees should ideally be created in the same volume (or at least a user-configurable directory). Instead, the worktree gets placed on the local machine under ~/.codex/worktrees/, which breaks the workflow.
What steps can reproduce the bug?
On macOS, open the Codex macOS app.
Open/import a Git repo located on a mounted volume, e.g.:
/Volumes/home/{MyProject}
In Codex, use the UI worktree creation flow to create a new worktree.
Observe that Codex creates the worktree in:
/Users/{myuser}/.codex/worktrees/{worktreeid}/{MyProject}
Confirm there is no setting to configure the worktree root/destination directory.
This occurs 100% of the time.
What is the expected behavior?
Codex should allow configuring the worktree destination directory / worktree root directory, e.g.:
Let the user choose a worktree root directory in Settings (global), and/or
Let the user choose the location during worktree creation (per-worktree)
For example, I should be able to configure worktrees to be created next to the repo on the mounted drive:
/Volumes/home/worktrees/...
Bonus:
- configure default paths per project
- default to placing worktrees near the repo if the repo is located on a mounted volume.
Additional information
_No response_
15 Comments
Agreed this would be nice. I'm running into tooling issues when the parent directory is under a "dot" path. Would be nice to be able to pick your own path.
https://github.com/facebook/pyrefly/issues/2402
This is a significant problem.
This is a significant problem not yet solved.
Having this would also provide a workaround for #13762
come on guys. WSL users are a big and growing market.
Codex should be following a standard like the XDG Base Directory Specification, and especially not mixing config and source code in the same directory root. If anything worktrees should go in a cache directory. It was really surprising to find that an automation to summarize work daily was copying source code outside of the source code work area without asking.
Ref: https://specifications.freedesktop.org/basedir/latest/
I have the same issue...
Should be possible to place the worktrees folder in places like:
../<repo-folder-name>.worktreesSame issue here, I am getting frustrated trying to use Codex with worktrees.
As it is scoped to the sandbox environment, it is unable to commit by default, running into permission issues.
This completely breaks my workflow
A workaround for this feature is to create a symlink from
~/.codex/worktreesto your desired location. However, that's not a very obvious solution.Another motivation for this feature is that companies sometimes have specific directories that are excluded (or have less aggressive) antivirus scanning. Being able to move the worktrees into that directories can significantly help with performance (and battery life)
+1 Would be great to have this.
+1 it is significant to custom directory for worktrees
+1 absolutely need this especially for wsl environment, the default directory when set to work with wsl causes the agents to slow down by around 3-5x. Tested by using the same repo and sending the same simple prompt of checking git status for the repo on the app and in wsl terminal.
Terminal finished in 1min 34 seconds. App finished in 7minutes 8 seconds.
This makes the app useless if you want to work safely using worktrees
Setting the env var
$CODEX_HOMEwill at least change the root where worktrees are created. I cannot stop codex from creating remote worktrees, which is also annoying.+1, we need this feature.
Come on codex. Poke
+1, still necessary