Codex App worktree creation fails for WSL-backed repos with "Failed to resolve worktree git directory"

Open 💬 5 comments Opened Mar 5, 2026 by Pimpmuckl

What version of the Codex App are you using (From “About Codex” dialog)?

26.304.1528.0 - "About Codex" doesn't seem to exist yet on Windows, this is winget list version

What subscription do you have?

Pro

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

When using the Codex App's built-in "create worktree" feature on a repo whose primary checkout lives inside WSL, worktree creation appears to succeed at the Git level, but the app then fails with:

Failed to resolve worktree git directory

In my case:

  • Main repo is in WSL:

/home/jonat/code/nextide-web

  • Codex worktree target is on Windows under:

C:\Users\jonat\.codex\worktrees\...

  • Codex App settings is native Windows/PS7, not WSL

Observed output from the app:

[info] Starting worktree creation
Preparing worktree (detached HEAD 3ab150b)
Updating files: 100% (902/902), done.
HEAD is now at 3ab150b gitignore: ignore codex local files
[stderr] Failed to resolve worktree git directory

After this, Git showed a stale/broken worktree registration like:

```C:/Users/jonat/.codex/worktrees/ce73/nextide-web 3ab150b (detached HEAD)
prunable: gitdir file points to non-existent location


Important detail from local debugging:

For WSL-backed repos, manual `git worktree add` works if the target is passed to WSL Git as a WSL path like:
`/mnt/c/Users/jonat/.codex/worktrees/...`
If the target is handled as `C:/Users/...` in the wrong context, WSL Git can treat it incorrectly or the app later fails to resolve the `.git` indirection.


### What steps can reproduce the bug?

1. Open Codex App on Windows.
2. Set Agent environment to `Windows native"
3. Open a repo whose main checkout lives in WSL, for example:   `/home/jonat/code/nextide-web`
4. Use the built-in Codex App worktree creation feature.
5. Let Codex create the worktree under its default Windows worktree location, e.g.:
   `C:\Users\jonat\.codex\worktrees\...`
6. Observe that Git reports the worktree creation succeeded, but Codex App then fails with:
   `Failed to resolve worktree git directory`


### What is the expected behavior?

Codex App should successfully create and open/manage a worktree for a WSL-backed repo, even if the worktree directory is on the Windows filesystem.

### Additional information

Notes:
- This does not appear to be a repo corruption issue.
- Cleaning up the stale worktree and re-running reproduces the same app-level failure.
- Manual Git worktree creation from WSL works when using /mnt/c/... target paths.

**Per-repo WSL/Windows native settings would be a great feature imo.**

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗