Repository navigation
Description
What version of the Codex App are you using?
Codex Desktop 26.715.52143, build 5591
Bundled CLI: codex-cli 0.145.0-alpha.18
What platform is your computer?
macOS 26.5.2 build 25F84, arm64
What issue are you seeing?
Creating a Codex-managed worktree from a valid linked checkout whose common directory is a bare repository mutates the shared Git config in a way that makes every linked worktree appear bare.
The repository layout was:
workspace/
repo/ # bare repository/common-dir
linked-worktree-a/
linked-worktree-b/
... # 115 linked worktrees
codex-source/ # valid linked checkout selected as the Codex project
Before the Codex operation:
extensions.worktreeConfigwas unset in the shared config.core.bare=truewas present in the bare common config.git statusandgit rev-parse --is-inside-work-treeworked in all linked worktrees.- The selected project passed
--show-toplevel,--is-inside-work-tree=true, and--is-bare-repository=false.
Starting one worktree-backed Codex thread then:
-
Created the managed detached worktree.
-
Added this to the shared bare common config:
[extensions] worktreeConfig = true
-
Created only this per-worktree file for the managed worktree:
[codex] localEnvironmentConfigPath = __none__
-
Left
core.bare=truein the shared config.
Immediately afterward, the managed worktree and every existing linked worktree returned:
git rev-parse --is-inside-work-tree
false
git rev-parse --is-bare-repository
true
git status
fatal: this operation must be run in a work tree
The shared config's modification time matched the Codex provisioning attempt. Only two config.worktree files existed across the 115 linked worktrees, so there was no per-worktree core.bare=false override for the others.
This behavior matches Git's documented warning: once extensions.worktreeConfig is enabled, the special main-worktree-only treatment of core.bare is gone, and a shared core.bare=true must be moved out of the common config. See git-worktree: Configuration File.
Recovery and controlled validation
Removing only the extension that Codex had just added restored all linked worktrees immediately:
git --git-dir=<common-dir> config --unset extensions.worktreeConfigNo source changes were lost.
I then replaced the Codex source project with a fully independent ordinary clone whose own common config has core.bare=false. A second Codex-managed worktree spawn succeeded:
- a pending client ID became a regular thread ID;
- the managed cwd was under
$CODEX_HOME/worktrees; --is-inside-work-tree=true;--is-bare-repository=false;- detached HEAD at the expected commit;
- clean status;
- archive cleanup removed the managed worktree.
The original bare common-dir remained untouched during this successful run.
Expected behavior
Codex should not leave a bare common-dir in this invalid mixed configuration.
Before enabling extensions.worktreeConfig, provisioning should either:
- detect
core.bare=truein the common config and avoid enabling the extension; - perform the complete Git-prescribed migration safely for the bare main repository and every existing linked worktree; or
- reject this topology with an actionable error and recommend an independent non-bare clone.
A failed or partial migration must be rolled back before returning control. This write occurs outside the model sandbox and can disrupt every checkout sharing the repository.
Related issues
- Codex App create_thread worktree rows fail with 'Worktree init failed' and no recoverable error #28204 tracks worktree-init failures that expose no recoverable error to a parent
create_threadcaller. - Codex App: support parent workspaces containing multiple Git repositories #26338 tracks parent workspaces containing child repositories.
This report is separate because the selected source root was a valid Git working tree; the failure is a shared Git-config mutation during managed-worktree provisioning.
Activity
jtulak commentedon Sep 2, 2026
Confirmed this still occurs with Codex Desktop
26.831.21537, build7579, on macOS with Git2.55.0.In my case, the incident followed moving a Codex task from a parent project to a project representing one linked worktree. Codex requested access to the parent directory; I granted it and shortly afterward removed that access from the project again.
Codex enabled
extensions.worktreeConfigin the shared bare repository configuration and created a managed-worktreeconfig.worktreecontaining only:The shared configuration retained
core.bare=true, causing both existing linked worktrees to report themselves as bare and stop accepting normal worktree operations. The modification timestamps of the shared configuration and Codex-managedconfig.worktreematched the Codex provisioning operation.I submitted the associated diagnostic feedback as:
01a062b9-f9f7-7641-830b-57e3cab4d9dbThe Git-prescribed repair worked without disabling worktree-specific configuration: remove
core.barefrom the shared configuration and placecore.bare=truein the bare main repository’s ownconfig.worktree. Afterward, all linked worktrees were recognized correctly again.