Regression in 0.149.0: empty .git directory no longer defines the project root
Open 💬 1 comment Opened Aug 21, 2026 by hsuy1ee
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What changed
After upgrading Codex CLI from 0.148.0 to 0.149.0, an empty .git directory no longer stops the upward project-root search. In a child directory inside a parent Git repository, the terminal title now resolves to the parent repository name.
In 0.148.0, the check was:
if dot_git.exists()
In 0.149.0, it became:
if dot_git.exists() && (!dot_git.is_dir() || dot_git.join("HEAD").exists())
Adding an empty .git/HEAD file restores the old behavior.
Relevant comparison: https://github.com/openai/codex/compare/rust-v0.148.0...rust-v0.149.0
Suggestion
Please consider removing the additional HEAD existence check and restoring the 0.148.0 behavior. A .git directory is normally created either by Git or intentionally by the user. In the intentional case, the user knows they are using it as a project boundary.
Environment
- Codex CLI 0.149.0
- Windows 11 / PowerShell
1 Comment
Thanks for the clear report. You’re right that this changed in 0.149.0: Codex now skips .git directories without HEAD, whereas previously their presence alone stopped the search. This was done to mitigate a security vulnerability.
Could you share a little more about how the empty
.gitdirectory is created and what workflow it supports? Are you using it primarily to control the terminal title, or also to keep parent-project configuration and instructions from applying to that directory?