Repository navigation
Open
Description
What issue are you seeing?
Bug: Each marketplace "upgrade" of a git-sourced marketplace clones the
full repo (incl. .git history) into ~/.codex/.tmp/marketplaces/.staging/
marketplace-upgrade-XXXX, but the staging dir is never deleted after promotion.
Impact: Accumulated 1784 leftover clones = 277 GB on C: over ~3 days.
Only the single git marketplace (claude-mem) was affected; local marketplaces
don't clone. Each clone = 171 MB, of which 158 MB is .git history.
Two issues:
- Staging temp not cleaned up after upgrade.
- Full clone instead of shallow (--depth 1) re-downloads entire git history
every refresh.
Env: Codex CLI app version 26.616.71553, Windows 11.
High session churn (automated runs) multiplies the leak.
Workaround: manually delete ~/.codex/.tmp/marketplaces/.staging
### What steps can reproduce the bug?
## Steps to reproduce
1. Configure a git-sourced marketplace in ~/.codex/config.toml:
[marketplaces.example]
source_type = "git"
source = "https://github.com/thedotmack/claude-mem.git"
2. Trigger a marketplace upgrade/refresh repeatedly (happens on session
start; automated/looping sessions trigger it many times).
3. Inspect ~/.codex/.tmp/marketplaces/.staging/ — a new
`marketplace-upgrade-XXXXXX` dir is created per upgrade.
4. After the upgrade completes, the staging dir is NOT deleted. Each one
is a full clone (~171 MB; ~158 MB is .git history).
5. Over many upgrades they accumulate without cleanup.
## Observed
1784 leftover `marketplace-upgrade-*` dirs = 277 GB on C:, accumulated over
~3 days. Only the single git marketplace was affected (local marketplaces
don't clone).
## Note
Root cause inferred from the 1784 leftover clones + config (not captured
live). Two defects: (1) staging temp never cleaned after promote;
(2) full clone instead of shallow (--depth 1) re-downloads entire git
history every refresh.
## Env
Codex CLI app version 26.616.71553, Windows 11.
### What is the expected behavior?
1. After a marketplace upgrade is promoted, the temporary staging directory
(~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-XXXXXX) is
deleted automatically. No leftovers remain.
2. Stale or failed staging directories are cleaned up on the next startup,
so they cannot accumulate across sessions.
3. Git-sourced marketplaces are fetched with a shallow clone (--depth 1)
and/or updated in place (git fetch/pull on a cached copy) instead of a
full re-clone of the entire history on every refresh.
Net result: marketplace refreshes use minimal, bounded disk space that does
not grow over time.
### Additional information
_No response_
Reacted by Viraj Noorithaya and miraclebakelaser
Activity
Nicolas0315 commentedon Jun 25, 2026
I put together a narrow patch for this on a fork branch:
Nicolas0315:codex/marketplace-shallow-upgradesc38bdc828 fix(plugins): shallow clone marketplace upgradesWhat it changes:
git clonefor configured git marketplace upgrades now uses--depth 1for the defaultHEADcase and branch/tag-like refs.refs/...paths, so explicit commit/ref checkouts do not lose reachability..git/shallow, one reachable commit) and that a successful upgrade leaves nomarketplace-upgrade-*staging dir behind.Verification:
just fmtjust test -p codex-core-plugins marketplace_upgrade-> 12 passedcargo check -p codex-core-pluginsgit diff --checkrtx4090:just test -p codex-core-plugins marketplace_upgrade-> 12 passedcyberagent-mac-m5max: freshorigin/maincheckout + patch,cargo test -p codex-core-plugins marketplace_upgrade-> 12 passedI also tried opening a draft PR against
openai/codex, but GitHub returned:So I’m leaving the branch/compare here for maintainers.
snowboater commentedon Jun 29, 2026
I hit the same incident class and filed a more detailed follow-up here: #30620.
Additional local evidence in that report: repeated
marketplace-upgrade-*staging dirs under.tmp/marketplaces/.staging, each a full clone of the configured Git marketplace, accumulating to ~155G in one affected environment.I also pushed a narrow cleanup fix branch: riverpilot:fix/marketplace-staging-prune.
That branch addresses the stale-staging cleanup side of this issue:
.tmp/marketplaces/.staging/marketplace-upgrade-*dirs on the configured Git marketplace upgrade pathmarketplace-upgrade-prefixNicolas’s branch, Nicolas0315:codex/marketplace-shallow-upgrades, addresses the other side: reducing future clone size by using
--depth 1for safe HEAD/branch/tag-like marketplace clones.I think these are complementary rather than equivalent:
One nuance: if a successful promotion is directly observed leaving its
marketplace-upgrade-*dir behind, that would be an immediate cleanup bug. From the current code path, normal successful promotion should move/drop the temp dir; the durable leak I reproduced is abandoned staging dirs that are not later pruned.Clay996 commentedon Aug 12, 2026
I reproduced this incident class and found a second trigger beyond orphaned
TempDirs: multiple Codex processes can read the same stale marketplace revision, then each perform the same upgrade even after another process has already activated it. In the affected Windows environment, staging grew from 45 to 83 directories (about 9.8 GiB total), with a new full marketplace clone appearing roughly every five minutes.I prepared a bounded fix on a fork branch:
Clay996:fix/marketplace-upgrade-bounds64bdf393f45f06565cf96c632d18d98959bc6104The patch combines the two existing partial directions in this issue with the missing correctness and resource bounds:
Verification on the branch:
codex-core-pluginscrate: 408/408 passed, with one pre-existing environment-only WSL Git compatibility test skipped;just fix -p codex-core-plugins: clean;Per the repository's invitation-only contribution policy, I have not opened an unsolicited PR. If maintainers want this broader fix, please invite a PR and I will submit the branch with the issue linked.
nviraj commentedon Aug 12, 2026
I encountered the same issue on Windows with Codex CLI 0.147.0, and wanted to add another data point because the behavior I observed may help distinguish successful-upgrade cleanup from abandoned staging cleanup.
Environment
codex-cli 0.147.0CODEX_HOME: not set at process, user, or machine scope~\.codexWhat I observed
Under:
I found well over 100 directories with names of the form:
The oldest one I observed dated back to early June, with many more accumulating through July and August.
There were periods where new directories appeared only minutes apart, and in some cases multiple directories had timestamps only seconds apart.
The accumulated staging directory was approximately:
None of the active marketplace roots reported by:
pointed into any of these
marketplace-upgrade-*directories.Cleanup / validation test
To avoid deleting potentially active state, I:
.stagingto a temporary backup.The upgrade completed successfully:
During this fresh upgrade, Codex recreated:
and updated the marketplace successfully.
Crucially, after the successful upgrade completed, the newly created
.stagingdirectory contained no leftovermarketplace-upgrade-*directories.I then removed the old staging backup and recovered approximately 5.14 GB.
Additional stale backup
I also found an older sibling directory with a name of the form:
It was roughly a month old, was not referenced by any active marketplace root, and remained present across successful marketplace operations. I removed it separately after verifying it was not in use.
What this seems to suggest
At least in my case, a normal, manually triggered successful marketplace upgrade cleaned up its current staging directory correctly.
The disk growth therefore appears more consistent with staging directories being abandoned by earlier upgrade attempts/processes and never being reclaimed afterward, rather than every successful upgrade deterministically leaking its temporary directory.
That seems consistent with the distinction mentioned above between:
marketplace-upgrade-*directories from interrupted, failed, concurrent, or otherwise incomplete upgrade attempts not being pruned later.The timestamp pattern was notable because there were clusters of repeated staging directories created at short intervals over extended periods, rather than just one or two isolated leftovers.
Expected behavior
Even when an upgrade is interrupted, fails, or its creating process exits unexpectedly, stale directories such as:
should eventually be reclaimed safely—for example during a subsequent startup or marketplace upgrade—so disk usage remains bounded.
It would also be useful if stale
marketplace-backup-*directories were subject to similarly conservative cleanup when they are no longer referenced.Happy to provide additional diagnostics if there is a specific command or metadata that would help, provided it can be shared with user paths / marketplace details redacted.
jerldev commentedon Aug 14, 2026
I can confirm this issue on Linux with a public Git-backed marketplace.
Environment
codex-cli 0.147.0https://github.com/Gentleman-Programming/engram.gitObserved disk growth
First occurrence:
marketplace-upgrade-*directories~/.codex/.tmp/marketplaces/.stagingAfter deleting those confirmed orphaned staging directories, the problem recurred within roughly 18 hours:
marketplace-upgrade-*directoriesThe active marketplace root remained valid, and Codex's marketplace metadata advanced its
last_updatedandlast_revisionvalues. None of the active marketplace roots reported bycodex plugin marketplace list --jsonpointed into the staging directories.Cleanup and workaround
I removed only the orphaned
marketplace-upgrade-*directories after verifying the active marketplace root was elsewhere. This reduced~/.codexfrom approximately 57 GB to 958 MB and restored free disk space from 6.4 GB to 62 GB.As a temporary mitigation, I changed this Codex-only marketplace registration from a Git source to a local source containing the same verified revision. The plugin remained installed and enabled, and no new staging clone appeared during an immediate observation window longer than the previous approximately one-minute creation cadence.
This looks consistent with abandoned or concurrent Git marketplace upgrade attempts not being reclaimed, rather than normal plugin/session storage growth.
Geekfish commentedon Oct 12, 2026
This also happens on
codex plugin marketplace add, not only on upgrade.Both commands run
git clonewithout--depth:core-plugins/src/marketplace_add/install.rscore-plugins/src/marketplace_upgrade/git.rsWith
--sparse, the clone uses--filter=blob:none. This skips file contents, but Git still downloads the full commit history.Measured with Codex 0.160.1 on macOS, on a large monorepo with a marketplace at its root:
marketplace add --sparseEach upgrade at session start makes a new clone. So each time the ref moves, Codex downloads the full history again.
Possible fix:
HEADref: add--depth 1to both clones.git init, thengit fetch --depth 1 origin <sha>. GitHub and GitLab support fetch by SHA.The curated plugin sync (
startup_sync.rs) already usesgit fetch --depth 1.AngelDc3 commentedon Oct 29, 2026
Another Linux reproduction on a current build, plus a second leftover shape
Environment
chatgpt-bin 26.1021.22027-1(Arch Linux, btrfs)codex-cli 0.164.0-alpha.11.1https://github.com/Gentleman-Programming/engram.gitThis is newer than every build mentioned in this thread so far, so the leak is still present.
Magnitude
~/.codex/.tmphad grown to roughly 140 GB before I deleted it manually. That figure is user-reported;.tmp/marketplaces/.stagingis empty now and.tmpis 175 MB after cleanup.Second leftover shape — pruning
.stagingis not enoughDirectly under
~/.codex/.tmpthere were also 3,024 abandonedgit-XXXXXXdirectories:Each one is an empty skeleton: a 21-byte
HEAD, an emptyobjects/, an emptyrefs/.Age spread by mtime: 476 from 2026-08, 1,602 from 2026-09, 946 from 2026-10. Continuous, and none touched in the hour before inspection. They cost ~11 MB of directory overhead and ~12k inodes, so they are not the 140 GB — but they show the same staging area is written constantly and never swept.
Note
.tmp/marketplaces/.staging-cleanup.lockand.staging.lock(2026-10-25) exist here, so a cleanup path appears to have landed, and.stagingis empty at the time of writing. Whatever that sweep does, it does not reach thegit-*siblings.Expected: everything the marketplace upgrade path stages under
.tmpis bounded or swept, not only.staging.inoukt commentedon Nov 1, 2026
Another occurrence on Windows 10 Home 64-bit (build 19045), using the Codex desktop app with bundled
codex-cli 0.166.0-alpha.5.1.%USERPROFILE%\.codex\.tmp\marketplaces\.stagingaccumulated approximately 11 GB. Inspection found dozens ofmarketplace-upgrade-*directories, many approximately 0.21 GiB each, with creation dates spanning October 28–31, 2026. One sampled directory contains a.gitdirectory and a full source tree. Smaller staging directories were also present.This is an observation of accumulated files, not a controlled reproduction: I have not established whether the corresponding upgrades succeeded, failed, or were interrupted. Expected behavior is that completed or stale staging data is eventually cleaned up so disk usage does not grow indefinitely.