Codex retains wrong worktree/thread binding for Linear-delegated tasks and applies fixes to the wrong local worktree
What version of the Codex App are you using (From “About Codex” dialog)?
26.527.31326
What subscription do you have?
Pro
What platform is your computer?
Mac, Windows
What issue are you seeing?
Codex Desktop appears to retain the wrong internal worktree/thread binding in a multi-worktree Git repository.
I have one repository with multiple legitimate Git worktrees. When a task is delegated via Linear and Codex generates a fix, the fix can later be opened from the correct workspace in Codex Desktop, but Apply/Handoff still tries to target the wrong local worktree.
The UI may show the correct workspace root, but the fix appears to remain internally associated with another worktree. Codex briefly shows a warning that seems to indicate a mismatch, but the warning disappears too quickly to read fully and there is no clear way to correct the apply target.
I reproduced the same behavior on both Windows and macOS, so this does not appear to be Windows-specific.
What steps can reproduce the bug?
- Create a Git repository with at least two local worktrees.
- Open one of those worktrees as the active project in Codex Desktop.
- Delegate a task through Linear to Codex, or open a Linear-linked Codex task/thread that was previously associated with another worktree of the same repo.
- Let Codex generate code changes in its temp worktree.
- Return to Codex Desktop and try to open or apply the fix from the currently selected workspace root.
- Observe that Codex briefly shows a mismatch warning, then still tries to apply or route the fix to the wrong worktree.
What is the expected behavior?
Codex should scope each thread and fix strictly to the selected physical workspace root / absolute worktree path.
If a fix was created for another worktree of the same repository, Codex should clearly and persistently warn about that mismatch and provide an explicit choice to:
- switch to the original worktree,
- retarget the fix to the current workspace,
- or cancel.
Apply/Handoff should never implicitly target a different local worktree just because both worktrees belong to the same Git repository.
Additional information
This appears to be a Codex issue rather than a Git issue.
The Git setup is valid and behaves correctly outside Codex:
- one repository
- multiple legitimate worktrees
- each worktree works normally in Git
In my local setup, the main checkout, the secondary worktree, and the Codex temp worktree all share the same Git common directory, which may be relevant. Codex also seems to have internal mismatch logic already, because it briefly shows a warning and there are signs of thread/workspace mismatch handling in the local app state.
The same problem happens on both Windows and macOS.
The issue may be more likely when entering the task through Linear delegation, because it feels like the Codex thread retains an older worktree association even when the UI is currently showing a different workspace root.
For now, the only safe workaround is to avoid Apply/Handoff in this setup and instead use PRs, cherry-pick, or manual Git operations.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗