codex icon indicating copy to clipboard operation
codex copied to clipboard

Way to configure location of worktrees

Open adnanjpg opened this issue 9 months ago • 15 comments

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:

  1. configure default paths per project
  2. default to placing worktrees near the repo if the repo is located on a mounted volume.

Additional information

No response

adnanjpg avatar Feb 04 '26 06:02 adnanjpg

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

gmetzker-4c avatar Feb 13 '26 00:02 gmetzker-4c

This is a significant problem.

iamsenseiken avatar Mar 05 '26 05:03 iamsenseiken

This is a significant problem not yet solved.

itsadrianxv avatar Mar 23 '26 06:03 itsadrianxv

Having this would also provide a workaround for #13762

birtles avatar Mar 26 '26 07:03 birtles

come on guys. WSL users are a big and growing market.

richardwhatever avatar Mar 26 '26 14:03 richardwhatever

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/

datalogics-kam avatar Mar 31 '26 14:03 datalogics-kam

I have the same issue... Should be possible to place the worktrees folder in places like: ../<repo-folder-name>.worktrees

diogovalada avatar Apr 19 '26 18:04 diogovalada

Same 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

kevinhorst avatar Apr 19 '26 19:04 kevinhorst

A workaround for this feature is to create a symlink from ~/.codex/worktrees to 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)

MichaReiser avatar May 08 '26 16:05 MichaReiser

+1 Would be great to have this.

pessini avatar May 24 '26 19:05 pessini

+1 it is significant to custom directory for worktrees

frankie325 avatar May 27 '26 09:05 frankie325

+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

hyperlolo avatar Jun 02 '26 08:06 hyperlolo

Setting the env var $CODEX_HOME will at least change the root where worktrees are created. I cannot stop codex from creating remote worktrees, which is also annoying.

brendan-m-murphy avatar Jun 08 '26 14:06 brendan-m-murphy

+1, we need this feature.

invoker-bot avatar Jul 18 '26 13:07 invoker-bot

Come on codex. Poke +1, still necessary

kevinhorst avatar Jul 19 '26 22:07 kevinhorst

Yep, same here +1

pablorxz avatar Jul 22 '26 22:07 pablorxz