Curated plugin startup sync leaks ~/.codex/.tmp/plugins-clone-* directories on failure
What version of Codex CLI is running?
codex-cli 0.117.0
What subscription do you have?
Plus
Which model were you using?
Not model-specific. This appears to happen during curated plugin startup sync before normal task work.
What platform is your computer?
Linux x86_64
What issue are you seeing?
The new curated plugin startup sync can leave behind leaked temp repositories under:
$HOME/.codex/.tmp/plugins-clone-*
After upgrading to 0.117.0, I started seeing multiple extra git repositories in VS Code source control. These were not part of my workspace repo. They turned out to be temp clones under ~/.codex/.tmp/, some partially cloned, some empty, some full git repos with thousands of staged deletions/untracked files.
Local evidence from ~/.codex/log/codex-tui.log:
2026-03-27T09:00:22.665896Z WARN codex_core::plugins::startup_sync: git sync failed for curated plugin sync; falling back to GitHub HTTP error=git clone curated plugins repo timed out after 30s: Cloning into '/home/.../.codex/.tmp/plugins-clone-LtJPVl'... fatal: early EOF2026-03-27T12:43:09.973193Z WARN codex_core::plugins::startup_sync: git sync failed for curated plugin sync; falling back to GitHub HTTP error=git clone curated plugins repo timed out after 30s: Cloning into '/home/.../.codex/.tmp/plugins-clone-k0He1F'... fatal: early EOF2026-03-27T12:43:41.545229Z WARN codex_core::plugins::manager: failed to sync curated plugins repo: failed to read download curated plugins archive response from https://api.github.com/repos/openai/plugins/zipball/aef533fd6ce0acf9b4850a5de33328a30731c18a: error decoding response body
On disk afterward I had a mix of leftovers:
- full repos with
.git,README.md,.gitignore,.agents,plugins - partial repos with only
.git - empty plain dirs
Example leftover paths:
$HOME/.codex/.tmp/plugins-clone-EVIX7x$HOME/.codex/.tmp/plugins-clone-JyUIh3$HOME/.codex/.tmp/plugins-clone-KHGHUg$HOME/.codex/.tmp/plugins-clone-LtJPVl$HOME/.codex/.tmp/plugins-clone-k0He1F
Some of the full leftovers resolved to the curated plugins repo:
origin = https://github.com/openai/plugins.gitHEAD = aef533fd6ce0acf9b4850a5de33328a30731c18a
What steps can reproduce the bug?
I do not yet have a deterministic minimal repro, but the observed failure pattern is:
- Run Codex CLI
0.117.0 - Curated plugin startup sync attempts to refresh the local curated marketplace under
~/.codex/.tmp/plugins - The git path times out or fails partway through (
early EOF) - The HTTP fallback also fails or does not complete cleanup
- One or more
plugins-clone-*temp dirs remain permanently under~/.codex/.tmp/
This is likely easier to reproduce by forcing network instability or a timeout during:
git clone https://github.com/openai/plugins.git- or the fallback zipball download from GitHub API
What is the expected behavior?
Failed curated plugin sync attempts should not leave leaked temp dirs or temp git repos behind.
Expected behavior:
- temp clone/extract dirs are cleaned up on every error path
- only the final active curated marketplace path remains:
~/.codex/.tmp/plugins- VS Code or other git-aware tools should never see
plugins-clone-*leftovers as standalone repos
Additional information
I think the root cause is visible in source.
In codex-rs/core/src/plugins/startup_sync.rs, prepare_curated_repo_parent_and_temp_dir() creates a temp dir and immediately calls:
tempfile::Builder::new().prefix("plugins-clone-").tempdir_in(parent)?- then
clone_dir.keep()
That means the temp dir is detached from tempfile auto-cleanup before clone/download/activation has succeeded.
Then both sync paths use that kept directory:
sync_openai_plugins_repo_via_git()sync_openai_plugins_repo_via_http()
There does not appear to be cleanup if any later step fails, for example:
git clonetimeout / early EOF- zipball download failure
- zip extraction failure
- marketplace manifest validation failure
- activation failure
So the likely bug is:
prepare_curated_repo_parent_and_temp_dir() promotes the temp dir to a persistent path too early, and failure paths never remove it.
That matches the exact symptom on disk:
- partial clone directories remain after failed
git clone - empty directories remain after failed fallback stages
- full repos can remain if later activation/validation does not complete
If helpful, I can provide the exact local log lines and leftover directory shapes again, but the source path above already seems to explain the leak.
6 Comments
I took a closer look at the current Rust implementation, and the report seems directionally correct.
Both sync paths in
codex-rs/core/src/plugins/startup_sync.rsstage into a temporary curated repo directory before activation:sync_openai_plugins_repo_via_git()sync_openai_plugins_repo_via_http()The important bit is that
prepare_curated_repo_parent_and_temp_dir()creates that temp dir and immediately callskeep(), so the staged directory stops being self-cleaning before the sync has actually succeeded.From there, any error before
activate_curated_repo(...)can leave the staged path behind, including:git clonetimeout / early EOFSo the leaked
~/.codex/.tmp/plugins-clone-*directories described here are consistent with the current lifecycle.The smallest fix shape still looks like:
TempDirownership for the entire staging/sync flowDoing explicit cleanup on every failure branch would also work, but keeping the staged directory owned by
TempDiruntil success seems less error-prone.I also checked the existing
startup_sync_tests.rscoverage. Right now it already exercises the happy path and git->HTTP fallback behavior, but it does not appear to assert cleanup of leftoverplugins-clone-*directories on failure. A focused regression here would probably be:I have not reproduced this live end-to-end locally, so this is based on source inspection rather than a full runtime repro, but from the code as it stands this does look like a real staged-directory lifecycle bug.
Thanks for reporting! A fix should be merged and will release soon.
I want to clarify an additional issue on Windows 11.
In my case, the leaked
plugins-clone-*directories are not only left behind, but are sometimes created in the root of the C: drive instead of underCODEX_HOME.I have:
CODEX_HOME=C:\Users\Bryan\.config\codexHowever, I found directories like:
C:\UsersBryan.configcodex.tmpplugins-clone-DWfzYnNotice this is incorrectly placed in
C:\and the path separators are missing.From Git Bash, the working directory appears as:
/c/?C:UsersBryan.configcodex.tmpplugins-clone-DWfzYnThis suggests a path normalization issue when handling Windows paths (likely mixing Windows-style paths with POSIX paths incorrectly).
These directories are valid git repos with:
origin = https://github.com/openai/plugins.gitSo in addition to the temp directory leak, there may also be a Windows-specific path handling bug causing incorrect directory placement.
<img width="819" height="429" alt="Image" src="https://github.com/user-attachments/assets/e9c0d239-4716-41ac-b7f7-5021b15ec50d" />
This still appears to happen on
codex-cli 0.128.0.Fresh local evidence from May 1, 2026:
$HOME/.codex/.tmp/plugins-clone-X6PMR0https://github.com/openai/plugins.git3c46336323290cda7c90d78e7a0134f47cc73713$HOME/.codex/.tmp/pluginsexisted separately and was clean at the same HEAD.git/index, so Git reported the repo as thousands of staged deletions plus untracked filesI removed the leaked temp clone manually, and the source-control noise disappeared.
I'm currently using codex-cli v0.128.0. I've noticed that after launching it multiple times, temporary plugin directory is no longer being created in
C:\.Confirmed this still exists in
codex-cli 0.139.0.On WSL2, repeated codex exec runs create and leave behind new:
directories. In a fresh
CODEX_HOME, each successful trivial run likecodex exec "Say Hi"added anotherplugins-clone-*dir.Workaround:
or per command:
As extra cleanup insurance: