Repository navigation
Description
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.
Activity
Boulea7 commentedon Mar 27, 2026
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.
xl-openai commentedon Mar 28, 2026
Thanks for reporting! A fix should be merged and will release soon.
Bryan2333 commentedon Apr 20, 2026
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.
Alek2077 commentedon May 1, 2026
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.
Bryan2333 commentedon May 6, 2026
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:\.il-alexk commentedon Jun 15, 2026
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:
polyakoff commentedon Aug 12, 2026
Confirming this is still present on
codex-cli 0.146.0(Linux aarch64, npm install, running inside a Docker container as thecodex-localadapter backend for an orchestration platform — not the interactive TUI).Symptom on our side was more severe than a disk-space leak: because our
codexinvocations are short-lived (spawned per agent turn, exiting after a few minutes), the childgit clone https://github.com/openai/plugins.gitprocess frequently outlives the parentcodexprocess. When that happens, the orphanedgitprocess is reparented to our container's PID 1 (a Node.js supervisor that doesn't reap arbitrary reparented children), and oncegitexits it becomes a permanent zombie — never reaped. Over a few hours this accumulated 14,500+ zombiegitprocesses and 1.6 GB of leaked~/.codex/.tmp/plugins-clone-*directories, growing at ~400/hour.Edit / correction: I initially reported that setting only the narrower
remote_pluginfeature flag was sufficient, on the theory that it's the flag that specifically gates the curated-marketplace sync (codex features listdoes show it as a distinct, separatestableflag fromplugins/plugin_sharing). That turned out to be wrong. We live-tested it under real production load and the leak continued at the same rate withremote_plugin=falseconfirmed active (codex features listcorrectly reported it disabled, but the startup-sync code path doesn't appear to gate on it). Only the broader flag actually stops it:Confirmed by watching zombie-process and temp-dir counts plateau over several minutes of continued real load, after they kept climbing with
remote_plugin=falsealone. If you're only able to set the narrower flag for some reason, don't rely on it — verify against actual process/temp-dir counts, not justcodex features listoutput, as we initially did.This obviously doesn't fix the underlying issue for anyone who wants curated plugins working — the
tempfile::Builder::...tempdir_in(parent)?.keep()-before-validation-succeeds bug described above looks like it's still there 4+ months and several point releases after the original report.Boulea7 commentedon Oct 9, 2026
Could you link the PR or commit behind the March fix mentioned above, and the first release containing it? That would help reconcile it with the later reports on 0.128.0, 0.139.0, and 0.146.0. I haven’t reproduced those later reports.