Codex Desktop managed worktree creation reports AGENTS.override.md failure even though git worktree add succeeds and no ls-files command is spawned
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.616.71553 • Released Jun 22, 2026
What subscription do you have?
Corporate
What platform is your computer?
Darwin 25.5.0 arm64 arm
What issue are you seeing?
Codex Desktop managed worktree creation fails for a large private monorepo.
The UI reports:
git ls-files failed while locating AGENTS.override.md
However, Git tracing shows that git worktree add succeeds, and the expected
post-create git ls-files --others --ignored --exclude-standard -z -- command is never spawned.
':(glob)**/AGENTS.override.md'
No Codex thread is ever started. The worktree does get created successfully, but cannot be used via Codex.
What steps can reproduce the bug?
- Open the repo in Codex Desktop.
- Start a new thread using a managed worktree.
- Worktree creation fails after
git worktree add. - UI reports the AGENTS.override.md error.
What is the expected behavior?
After successful git worktree add, Codex should complete post-create setup
and start the thread, or report the real underlying command/lifecycle error.
Additional information
- Git: Apple Git 2.50.1
- Repo shape: large private monorepo, about 68k tracked files, about 900 MB checkout
Manual checks:
git worktree add --detach ... mainsucceeds.- The exact AGENTS scan succeeds when run manually.
- A fresh clone of the repo has the same failure.
- Parallel checkout reduced worktree creation from about 14s to about 7s, but the failure remains.
Git trace evidence:
git worktree add --detach <codex-worktree-path> mainexits 0.- No traced invocation of:
git ls-files --others --ignored --exclude-standard -z -- ':(glob)**/AGENTS.override.md'
- Desktop logs around the same attempt show a new conversation/worktree lifecycle issue,
including "Received turn/started for unknown conversation" while worktree creation is in progress.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I captured a success and failure with GIT_TRACE2 enabled.
Success:
git ... ls-files --others --ignored --exclude-standard -z -- :(glob)**/AGENTS.override.md
Failure:
codex-thread.json and config.worktree
So the bug appears to be that the Desktop post-create continuation is getting
lost/cancelled after successful checkout and before the AGENTS.override scan.
The UI reports "git ls-files failed while locating AGENTS.override.md", but in
the failed trace that git command was never invoked.
Update: root cause narrowed down and workaround confirmed
I reproduced this again with Codex Desktop 26.623.101652 (build 4674, codex-cli 0.142.5), and now have a controlled A/B that makes worktree creation succeed without changing the Git binary.
Codex Desktop does the following:
zsh -ilcwithCODEX_SHELL=1, then merges that environment intoprocess.env. This explained why launching Codex with a customPATHdid not initially change the result.gitinPATH./usr/bin/git, it runs:/usr/bin/xcode-select -p
synchronously with a one-second timeout.
git worktree addsucceeds, Codex unconditionally runs the ignoredAGENTS.override.mdscan. Because this repository takes roughly 7-14 seconds to check out, that scan can require a fresh availability check.Git is unavailablebefore spawninggit ls-files. The caller discards that underlying error and reports:git ls-files failed while locating AGENTS.override.md
This matches the original trace, in which
git worktree addexited successfully but nogit ls-filesprocess was spawned.The confirming A/B was:
Before:
$ command -v git
/usr/bin/git
Managed worktree creation repeatedly failed after checkout.
I then added an earlier PATH entry pointing to the same Git binary:
ln -s /usr/bin/git "$HOME/.local/bin/git"
$HOME/.local/binwas already before/usr/binin my interactiveshell PATH. Afterward:
$ command -v git
/Users/.../.local/bin/git
$ git --version
git version 2.50.1 (Apple Git-155)
I did not restart Codex. The next managed-worktree creation succeeded, and the Desktop logs recorded both:
[worktree-create] ready
[worktree-create] owner-thread-set
Since the symlink executes the identical
/usr/bin/gitbinary and only changes the path spelling seen by the availability check, thisstrongly implicates the
/usr/bin/git-specific preflight.I have not determined why
xcode-select -pintermittently fails inside the Git worker; it succeeds consistently when run manually. Desktop logs do, however, show bursts ofGit is unavailableerrors while Git continues to work normally outside the app.Possible fixes:
worktree_pending_createandworktree_managed_createas availability-check bypass contexts aftergit worktree addhas already succeeded.xcode-selectprobe or increase its one-second timeout.Git is unavailableor spawn error instead of replacing it with theAGENTS.override.mdmessage.The orphaned-worktree symptom may be related to #16936, although this issue now has a more specific reproduction and workaround.