Windows: archiving a managed worktree thread leaves node/node_repl processes locking the deleted directory
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- git, node.js, rust
- Domain
- desktop, devtools, operating-systems
Research direction
Start by tracing the managed worktree archive cleanup entry point on Windows, focusing on task-scoped node.exe and node_repl.exe shutdown and current-working-directory handling. Reproduce the issue with the listed steps, inspect git worktree list and child-process CWDs after archiving, and consider the work complete when the worktree root is deleted without live Codex children retaining it.
Written by the indexing model from the issue text.
Description
What version of the Codex App are you using?
Codex Desktop package 26.707.9981.0 (Windows app).
What platform is your computer?
Windows 11 x64.
What issue are you seeing?
Archiving a Codex-managed worktree thread successfully removes the Git worktree registration and the worktree contents, but one node.exe process and one node_repl.exe process remain alive with their current working directory set to the now-empty worktree root.
Because Windows does not allow deleting a directory that is the current working directory of a live process, the empty directory remains locked:
Remove-Item: The process cannot access the file
'%USERPROFILE%\.codex\worktrees\<id>\<repo>'
because it is being used by another process.
Terminating only those two remaining processes immediately releases the lock and allows the empty directory to be deleted.
Steps to reproduce
- Open a Git repository in Codex Desktop on Windows.
- Create a Codex-managed worktree task.
- Interact with the task so its worker/tool runtimes are started.
- Optionally create a temporary branch in the worktree. In this clean reproduction I used
codex/test123; the worktree was otherwise clean. - From a separate task opened on the main checkout, ask Codex to archive the worktree-backed task. The app reports the archive as successful and the task disappears from the active task list.
- Wait at least 25 seconds.
- Inspect
git worktree list, the target directory, and the current working directories of the remaining Codex child processes.
Reproduction thread ID: 019f6709-0cd0-70b3-839e-b58b1feb8d70
Observed result
The cleanup is only partial:
| Time | Worktree state | Processes whose CWD is the worktree |
|---|---|---|
| Before archive | Registered and populated | node.exe ×2, node_repl.exe ×2 |
| 5 seconds after archive | Git registration removed; root directory empty | node.exe ×1, node_repl.exe ×1 |
| 25 seconds after archive | Still unregistered and empty, but root remains locked | Same two processes |
| After terminating those two PIDs | No Git worktree; directory can be deleted | None |
Additional checks:
git worktree listshowed only the main checkout after archive.- Running Git in the old path failed with
not a git repository, as expected after cleanup. - The main checkout was unchanged.
- The temporary branch remained, which is normal Git behavior and is not part of this bug.
- The archived conversation was stored separately under the Codex archived-session storage; it was not stored in the worktree directory.
- This was reproduced cleanly after an earlier exploratory run.
Expected behavior
When a Codex-managed worktree task is archived:
- All task-scoped runtimes should terminate or move their current working directory away from the worktree before removal.
- The managed worktree root should be deleted completely, or deletion should complete after a short bounded grace period.
- No live Codex child process should retain the removed checkout as its current working directory.
Related issues and why this appears distinct
- #19480 reports that the cleanup script does not run and the entire worktree remains Git-registered and on disk. Here, Git registration and contents are removed successfully; only the empty root is left because processes still hold it as their CWD.
- #11324 and #12491 report broader MCP/child-process accumulation, mainly on macOS. This reproduction is a deterministic Windows directory lock involving one
node.exeand onenode_repl.exeafter a successful managed-worktree archive. - #25541 and #25713 concern Windows archive UI/reconciliation behavior. This report is specifically about background archive cleanup and process/CWD lifetime.
The archive lifecycle appears to stop only one of each duplicated runtime pair, leaving the second node/node_repl pair attached to the deleted worktree path.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- Avg merge
- 1m
- Merged PRs (30d)
- 1k
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
A-linter
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxc-project/oxc#26863 ·