Desktop-created worktree thread exists locally but never appears in Codex Desktop thread list
What version of the Codex App are you using (From “About Codex” dialog)?
26.309.3504.0
What subscription do you have?
ChatGPT Pro
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Codex Desktop on Windows created a new thread in a new worktree successfully, but the thread never appeared in the Desktop app afterward.
There was no visible error message in the UI. The failure was silent: the thread started running, then was no longer visible in the current workspace’s thread list.
Prompt used to create the missing worktree thread (PII redacted):
"You are working in <WORKTREE_NAME> on <BRANCH_NAME>.
Review AGENTS.md, Roadmap.md, docs/worktree-plan.md, README.md, design.md, and docs/testing.md first.
Scope only this worktree:
- canonical content schema
- normalization pipeline for question-bank and curriculum-supporting content
- content versioning metadata
- media descriptors needed for study and exam delivery
Do not implement search UI, auth, RAG retrieval, memory, analytics, or payments here.
Deliver:
- shared contracts and validation rules
- import/normalization utilities
- release/version metadata strategy reflected in docs
- tests for normalization and schema validation
End with:
- updated docs
- changelog entry
- a short handoff note stating contract decisions and downstream impact"
Missing thread details:
- Session / thread ID: <THREAD_ID>
- Thread title: <THREAD_TITLE>
The thread still exists locally on disk and in Codex state, so this does not look like data loss. It looks like a Desktop workspace/thread-association bug.
What steps can reproduce the bug?
- Open Codex Desktop on Windows with a repo at <MAIN_WORKSPACE_ROOT>.
- Start a new thread from that workspace.
- Choose "New worktree".
- Let the thread start running.
- Return to the thread list in Codex Desktop.
Actual result:
- The worktree is created under <CODEX_HOME>\worktrees\<WORKTREE_ID>\<REPO_NAME>.
- The new thread is not visible in the Codex Desktop thread list for the original workspace.
Session / thread ID:
- <THREAD_ID>
Token limit usage:
- Not applicable. No token-limit warning was shown.
Context window usage:
- Not applicable. No context-window warning was shown.
Evidence that the thread was created successfully:
- Worktree path exists: <CODEX_HOME>\worktrees\<WORKTREE_ID>\<REPO_NAME>
- Rollout/session file exists: <CODEX_HOME>\sessions\<YYYY>\<MM>\<DD>\rollout-<TIMESTAMP>-<THREAD_ID>.jsonl
- Thread exists in local Codex state with archived=0 and cwd set to the worktree path
This is a UI/workspace-association repro rather than a code snippet repro.
What is the expected behavior?
A thread created by Codex Desktop should remain visible in Codex Desktop after creation.
If Codex Desktop creates a new worktree thread, it should automatically associate that worktree path with the workspace/thread list so the thread is still discoverable from the UI.
The user should not need to inspect local session files or state databases to find a thread that Desktop itself created.
Additional information
Additional local evidence suggests the worktree thread exists but was not associated with the active workspace root.
Observed state:
- Active/saved workspace root in Desktop included: <MAIN_WORKSPACE_ROOT>
- Missing thread cwd was: <CODEX_HOME>\worktrees\<WORKTREE_ID>\<REPO_NAME>
- There was no workspace-root hint entry for <THREAD_ID>
That makes the thread effectively invisible in the Desktop workspace view even though the backing thread metadata and rollout file are present.
I did not verify any interactive CLI recovery command before filing this. I only verified from local on-disk/session/state data that the thread still exists and is not archived.
I did not find an exact duplicate, but these issues seem related:
- #14182
- #14162
- #14141
- #6730
8 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
looks like this is part of #10347
Got the same issue.
I saw a related Windows + WSL worktree failure.
What I observed:
• Codex created linked worktrees under
C:\Users\mike\.codex\worktrees\...• the app/workflow did not behave as expected afterward
• the extra linked worktrees persisted and surfaced in VSCode source control
• they had to be removed manually with
git worktree remove --force ...andgit worktree pruneEnvironment:
• Windows 11
• WSL Ubuntu
• repo opened from WSL path
Session ID from in-app feedback:
13cb61d3-2d73-46b4-9120-19248ea0665dAdding this as another data point in case it is the same desktop worktree-association bug family.
I have one additional data point that may narrow this down.
I compared two Windows machines:
CODEX_HOMEis customized toD:\Tools\Codex\HomeCODEX_HOMEis the default%USERPROFILE%\.codexOn the affected machine,
Fork into new worktreecreated the child threads and worktree directories successfully, but the new threads did not appear in the Codex Desktop UI under the original project.On the unaffected machine, the same operation worked as expected: the new worktree thread appeared in the UI.
The key difference I found is in
.codex-global-state.json.On the unaffected machine, the visible worktree-forked thread was automatically added to
thread-workspace-root-hints.The mapping had this shape:
<child-thread-id> -> <original-project-root>The child thread’s actual
cwdwas still the worktree path under the Codex home worktrees directory, butthread-workspace-root-hintsmapped the child thread back to the original project root. That seems to be what lets Desktop show the worktree thread in the original project’s thread list.On the affected machine, the missing worktree-forked threads existed locally with:
archived = 0cwd = D:\Tools\Codex\Home\worktrees\<worktree-id>\<repo-name>But there was no corresponding
thread-workspace-root-hintsentry for those child thread IDs, so the UI could not associate them with the original project.A temporary local recovery was possible by fully exiting Codex Desktop, adding the missing mappings to
thread-workspace-root-hintsin.codex-global-state.json, and restarting Codex Desktop.This makes me suspect the bug may be specifically in the workspace-root hint registration path for worktree forks when
CODEX_HOMEis set to a non-default Windows path, rather than in git worktree creation itself.Version details from the affected environment:
26.513.x0.131.0-alpha.9CODEX_HOME:D:\Tools\Codex\HomeCorrection / retraction: my previous comment was premature.
The workaround I described did restore visibility for already-created worktree threads in my local Codex Desktop sidebar, but it did not fix the underlying bug.
After restoring those existing chats, creating a new thread from the same project can still start it under
%USERPROFILE%\.codex\worktrees\<id>\<repo-name>and it can still fail to be associated with the original project as expected.So the confirmed narrower finding is only this:
.codex-global-state.jsonhints andstate_5.sqlite -> threads.cwd;Please do not treat the earlier workaround as a full bug fix. At most it is a local recovery method for already-created hidden threads, and the root Desktop workspace/thread association issue remains.
I have a more controlled follow-up data point.
This time I tested with a fresh Codex home on the affected Windows machine, not the previously migrated/old state.
Environment:
26.519.5221.0CODEX_HOMEpoints to a non-default Windows path:D:\Tools\Codex\HomeD:\Tools\Codex\Home.testing3for inspection.Test setup:
D:\Tools\Codex\Homeas the active Codex home.D:\Projects\Sandbox\Test4git initREADME.mdmainD:\Projects\Sandbox\Test4as a Codex Desktop project.Fork into new worktree.Observed behavior:
Preparing worktree (detached HEAD 6581ec5)HEAD is now at 6581ec5 2nd commitWorktree created at D:\Tools\Codex\Home\worktrees\6448\Test4No local environment selectedInspection after the test:
state_5.sqlite -> threadscontained the original thread:and the forked worktree thread:
The forked rollout file also existed:
session_index.jsonlcontained only the original thread, not the forked worktree thread:.codex-global-state.jsonhad the expected project root entries:but it had no
thread-workspace-root-hintskey at all.The worktree itself existed and was a detached HEAD at the expected commit:
So this looks narrower than my earlier report: with a fresh non-default Windows
CODEX_HOMEonD:, worktree creation can succeed, but Codex Desktop does not persist enough project/sidebar association metadata for the forked worktree thread. The thread exists and is unarchived, but it drops out of the project sidebar after the initial live display.I found one concrete local cause/workaround for this class of disappearing Codex Desktop WorkTree threads on Windows.
Full A-to-Z write-up: #24484.
This does not mean every disappearing WorkTree thread has this exact cause. In my case, the Git worktree was created correctly, but Codex Desktop failed to keep the new WorkTree thread associated with the original project in the sidebar.
TL;DR workaround that fixed it for me
Check whether Git can read the repo origin from the repository's
.gitdirectory:If that fails or prints nothing, but this works:
then add a narrow trust entry:
Verify again:
After restarting Codex Desktop, newly created WorkTree threads stayed associated with the original project again in my setup.
Symptom I saw
CODEX_HOME\worktrees\<id>\<repo-name>.git worktree list --porcelainshowed the worktree correctly.CODEX_HOME\worktrees\...folder as if it were a separate project.So this was not data loss and not a failed Git worktree creation. It looked like a Desktop project/sidebar association failure.
What was normal / not the bug
These were expected or healthy in my case:
CODEX_HOME\worktrees.How I narrowed it down
CODEX_HOME\worktreeslocation, but that appears normal for Codex-managed WorkTrees.``
text
``No matching origin found originUrl=<repo origin url>
.git.Root cause in my setup
The repository root was owned by my normal Windows user, but the
.gitdirectory had a different local owner from an older setup / folder move.My global Git
safe.directoryconfig trusted the repository root, but not the.gitdirectory path.Since Codex Desktop / its Git worker appeared to query Git metadata from inside
.git, Git refused to read the repository metadata from that location. As a result, Codex Desktop could not match the WorkTree thread back to the original project origin/root and did not persist the sidebar association.Prevention I used afterwards
For future projects under my normal project folder, I added scoped wildcard entries instead of trusting everything globally:
I would not recommend
safe.directory=*as a convenience workaround, because that disables Git's ownership protection too broadly.The cleaner long-term fix is probably to repair the Windows owner / ACL of the repository's
.gitdirectory, or reclone the repository cleanly.Product suggestion
Codex Desktop probably should not automatically change
safe.directory, because that is a Git security setting.But it would be helpful if Desktop surfaced a clear diagnostic when project/worktree association fails because Git cannot read repository metadata from
.git, instead of letting the WorkTree thread briefly appear and then silently disappear from the original project sidebar.