What version of the Codex App are you using (From “About Codex” dialog)?
26.513.31313 (2867)
What subscription do you have?
chatgpt plus
What platform is your computer?
codex app runs on Darwin 25.4.0 arm64 arm, and it connects to a remote unbutu: Linux 6.8.0-87-generic x86_64 x86_64
What issue are you seeing?
When using Codex Desktop's built-in remote workspace feature, right-clicking a thread and selecting "Fork into New Worktree" can create the worktree from the correct source repository, but the new thread is shown under the wrong project group in the sidebar.
This appears to be a sidebar grouping bug, not a git/worktree creation bug.
Environment
- Codex Desktop
- Remote workspace connected to a Linux development host via the built-in remote workspace feature
- Multiple repositories/worktrees from the same Git remote are present on that remote host
What steps can reproduce the bug?
- Connect Codex Desktop to a remote Linux host using the built-in remote workspace feature.
- Have at least two workspace roots on that host:
/remote/project-A
/remote/project-B
- Ensure both workspaces point to the same Git remote URLs, but they are not the same repository/worktree lineage.
- Open a thread under
project-A.
- Right-click the thread and select "Fork into New Worktree".
- Wait for the new worktree session to appear in the sidebar.
What is the expected behavior?
The new thread should be grouped under:
- the newly created Codex worktree derived from
project-A, or
- at minimum, the
project-A group.
Additional information
Actual Behavior
The new thread is grouped under a different existing project in the sidebar, such as project-B, even though the worktree was actually created from project-A.
Sanitized Example
Actual source project:
Another unrelated workspace visible in the sidebar:
New Codex-created worktree:
/remote/.codex/worktrees/<id>/project-A
What should happen:
- the new thread is grouped under
project-A or the new Codex worktree group
What actually happens:
- the new thread is grouped under
project-B
Why this is clearly incorrect
The underlying Git metadata shows that the newly created Codex worktree belongs to project-A, not project-B.
Sanitized Git metadata example:
-
project-A
git rev-parse --show-toplevel => /remote/project-A
git rev-parse --git-common-dir => /remote/project-A/.git
-
project-B
git rev-parse --show-toplevel => /remote/project-B
git rev-parse --git-common-dir => /remote/another-root/.git
-
new Codex worktree
git rev-parse --show-toplevel => /remote/.codex/worktrees/<id>/project-A
git rev-parse --git-common-dir => /remote/project-A/.git
So the new Codex worktree shares Git common-dir with project-A, not project-B.
Additional Technical Notes
From investigation of the app behavior:
- The "Fork into New Worktree" flow passes the correct source workspace root.
- The actual create-worktree operation also uses the correct source workspace root.
- The problem happens later, when the sidebar decides which project group should own the new pending worktree thread.
The likely root cause is that sidebar grouping prefers matching by originUrl before commonDir.
That is unsafe when multiple workspace roots share the same remote origin URL.
In this case:
project-A
project-B
- the new Codex worktree
all share the same origin / upstream remote URLs, but only project-A shares the correct commonDir with the newly created worktree.
If the grouping logic uses originUrl first, it can incorrectly match the new thread to the first project group with the same remote, which explains the wrong sidebar placement.
Suggested Fix
When mapping a worktree-backed thread back to a sidebar project group:
- Prefer matching by
commonDir
- Only fall back to
originUrl if commonDir is unavailable
commonDir is the reliable identity signal here; originUrl is not unique enough.
Impact
This is confusing because:
- the worktree is created from the correct source
- but the UI makes it look like it belongs to a different project
- users can easily think the fork operation targeted the wrong repository
If helpful, I can provide sanitized logs showing:
- the correct source workspace used during create-worktree
- the resulting Codex worktree path
- the incorrect sidebar grouping outcome
What version of the Codex App are you using (From “About Codex” dialog)?
26.513.31313 (2867)
What subscription do you have?
chatgpt plus
What platform is your computer?
codex app runs on
Darwin 25.4.0 arm64 arm, and it connects to a remote unbutu: Linux 6.8.0-87-generic x86_64 x86_64What issue are you seeing?
When using Codex Desktop's built-in remote workspace feature, right-clicking a thread and selecting "Fork into New Worktree" can create the worktree from the correct source repository, but the new thread is shown under the wrong project group in the sidebar.
This appears to be a sidebar grouping bug, not a git/worktree creation bug.
Environment
What steps can reproduce the bug?
/remote/project-A/remote/project-Bproject-A.What is the expected behavior?
The new thread should be grouped under:
project-A, orproject-Agroup.Additional information
Actual Behavior
The new thread is grouped under a different existing project in the sidebar, such as
project-B, even though the worktree was actually created fromproject-A.Sanitized Example
Actual source project:
/remote/project-AAnother unrelated workspace visible in the sidebar:
/remote/project-BNew Codex-created worktree:
/remote/.codex/worktrees/<id>/project-AWhat should happen:
project-Aor the new Codex worktree groupWhat actually happens:
project-BWhy this is clearly incorrect
The underlying Git metadata shows that the newly created Codex worktree belongs to
project-A, notproject-B.Sanitized Git metadata example:
project-Agit rev-parse --show-toplevel=>/remote/project-Agit rev-parse --git-common-dir=>/remote/project-A/.gitproject-Bgit rev-parse --show-toplevel=>/remote/project-Bgit rev-parse --git-common-dir=>/remote/another-root/.gitnew Codex worktree
git rev-parse --show-toplevel=>/remote/.codex/worktrees/<id>/project-Agit rev-parse --git-common-dir=>/remote/project-A/.gitSo the new Codex worktree shares Git common-dir with
project-A, notproject-B.Additional Technical Notes
From investigation of the app behavior:
The likely root cause is that sidebar grouping prefers matching by
originUrlbeforecommonDir.That is unsafe when multiple workspace roots share the same remote origin URL.
In this case:
project-Aproject-Ball share the same
origin/upstreamremote URLs, but onlyproject-Ashares the correctcommonDirwith the newly created worktree.If the grouping logic uses
originUrlfirst, it can incorrectly match the new thread to the first project group with the same remote, which explains the wrong sidebar placement.Suggested Fix
When mapping a worktree-backed thread back to a sidebar project group:
commonDiroriginUrlifcommonDiris unavailablecommonDiris the reliable identity signal here;originUrlis not unique enough.Impact
This is confusing because:
If helpful, I can provide sanitized logs showing: