Repository navigation
Description
Summary
Marketplace auto-upgrade leaked 4,972 staging directories totaling 559 GB in ~/.codex/.tmp/marketplaces/.staging/ over 41 days on my machine. That is the largest instance reported so far (previous high: 277 GB in #29994), so I'm adding it as a data point together with a consolidated root-cause read, because the seven existing reports are all still open with no fix PR.
Environment
- codex-cli 0.147.0 (musl standalone), Fedora 43
- ChatGPT Desktop for Linux with automation extensions active (app-server plugin sync)
- Two configured marketplaces (
claude-plugins-official,cctools-codex-plugins), ~115 MB per full clone
What happened
- First leaked dir 2026-07-09, newest 2026-08-19; 4,972 dirs, 559 GB, ~10 GB/day while the desktop app was open.
- Completed leaked dirs are ~112–117 MB (full clones). The newest one was 18 MB, a partial clone — the process was killed mid-
git clone. This matches the 30-secondMARKETPLACE_UPGRADE_GIT_TIMEOUTtrigger described in [bug] Upgrade Marketplaces trigger timeout after 30s would cause massive staging cache content in ".tmp" folder #38770: a ~115 MB marketplace on a residential connection can't finish in 30 s, so the upgrade dies every attempt, the revision metadata never updates, and the next sync retries — one orphaned clone per attempt, forever.
Root cause (from reading current main)
codex-rs/core-plugins/src/marketplace_upgrade.rsstages each upgrade intotempfile::Builder::new().prefix("marketplace-upgrade-").tempdir_in(install_root.join(".staging")).TempDircleanup only runs in its destructor. When the upgrade process is killed (clone timeout, OOM, SIGKILL, app-server teardown), the destructor never runs and the directory stays.- Nothing ever sweeps
.staging: the only code in the repo touching that path is the code that creates entries (marketplace_upgrade.rs,marketplace_add/install.rs). There is no startup janitor for it.
The kicker is that the janitor pattern already exists in this codebase for the sibling leak: curated plugin startup sync has remove_stale_curated_repo_temp_dirs(...) (see #16004). It was never applied to marketplace staging.
Prior reports, all open
#21005 (2026-05-04, 187 GB) · #29994 (277 GB) · #30620 · #30794 · #32058 (also covers marketplace-backup-*) · #38770 (timeout trigger) · #39332 (filed 2026-08-19). Amplifiers: #36093 (concurrent processes), #34128 (annotated-tag upgrade loop), #24815 (the 30 s timeout itself).
Suggested fix
- On startup (or before each upgrade attempt), remove
.staging/marketplace-upgrade-*entries older than some small age, mirroringremove_stale_curated_repo_temp_dirs. - Optionally make the clone timeout proportional to marketplace size or resumable; shallow clones (Title: Marketplace upgrades leave full git clones #29994 suggestion) shrink the per-leak cost but don't stop the leak.
Happy to open a PR porting the existing janitor pattern to installed_marketplaces.rs if maintainers confirm that's the preferred shape.
Activity
github-actions commentedon Aug 19, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
lwz20210407 commentedon Aug 19, 2026
Adding a Windows data point, since every detailed report on this leak so far (including this one, #39332, and #29994) is from Linux/macOS. The behaviour reproduces identically on Windows 11, and the leak rate matches yours almost exactly.
Environment
codex-cli 0.145.0-alpha.4OpenAI.Codex) also installed and running during the daysendbird,text-to-cad) +openai-bundled; ~160 MB per fulltext-to-cadcloneWhat I found
%USERPROFILE%\.codex\.tmp\marketplaces\.staging\had accumulated 101 orphaned directories / 13.78 GB / 96,174 files. The.gitdirectories alone accounted for 10.96 GB across 97 clones.Directory naming was 101/101
marketplace-upgrade-<6 chars>— zero unexpected entries.Remote census (all 101 enumerated, not sampled)
remote.origin.urlhttps://github.com/earthtojake/text-to-cad.githttps://github.com/sendbird/codex-marketplace.gitThose 6 clones with no remote at all are, I think, the most useful part of this report: they are clones killed before
git remote addcompleted. That is direct corroboration of the timeout-kill chain you and #38770 describe — the process dies mid-clone,TempDir's destructor never runs, revision metadata never updates, next sync retries, one orphan per attempt.git status --porcelainon a 5-directory spot check: all clean, no user data.Leak rate
I sampled timestamps on 20 of the 101 directories. All 20 fell on a single day, spread across the working day:
That is roughly one orphan every 20–40 minutes, ≈ 13.8 GB/day at ~160 MB per clone — versus the 13.6 GB/day implied by your 559 GB / 41 days. Two very different platforms, two different marketplace sets, essentially the same rate. That's consistent with the leak being driven by the sync retry interval rather than by anything environment-specific.
Impact here: a 200 GB system drive went to 8.5 GB free.
Cleanup is safe (data point for anyone landing here from a search)
I deleted
.staging/outright and verified afterwards:~/.codex/sessions/— 873 files / 9.78 GB, byte-identical to the pre-deletion baseline; oldest (Feb 2026) and newest sessions still parsecodex --version,codex plugin marketplace list,codex plugin list— all normal, 3 marketplaces detected, all pluginsinstalled, enabledmarketplaces/sendbirdandmarketplaces/text-to-cadclones intact with valid HEADslogs_2.sqlitewas regenerated automaticallyManual workaround on Windows until a janitor lands:
Note on the duplicate pile
This is now at least the 9th open report of the same defect (#21005, #29994, #30620, #30794, #32058, #38770, #39332, #39421, plus amplifiers #36093 / #34128 / #24815), the earliest from 2026-05-05. I deliberately commented here instead of opening a tenth. +1 to your offer to port
remove_stale_curated_repo_temp_dirsto the marketplace staging path — that seems like the smallest change that stops the bleeding, independent of whatever happens to the 30 s clone timeout.Srcanesen commentedon Aug 25, 2026
Fresh datapoint confirming this is still unfixed in 0.147.0 (macOS, Apple Silicon)
Accumulation: 375 orphaned
marketplace-upgrade-*dirs under~/.codex/.tmp/marketplaces/.staging/(~14 GB total, incl. 45 completely empty = aborted attempts) accumulated between Aug 21–25 while CodexBar ran recurring backgroundcodex execsessions. ~41k files written in the last 24h alone.Root cause analysis (
codex-rs/core-plugins, 0.147.0):marketplace_upgrade.rs:251-268creates staging clones viaTempDir::tempdir_in(...)with prefixmarketplace-upgrade-; cleanup relies solely onTempDir::Drop, which never runs on SIGKILL or whenMARKETPLACE_UPGRADE_GIT_TIMEOUT(30 s,marketplace_upgrade/git.rs) aborts the operation.startup_sync.rs:400 remove_stale_curated_repo_temp_dirs) — so every orphan persists forever.manager.rs:362/2557gates upgrades behind a process-localin_flight: bool; concurrent processes (menu-bar apps, multiple terminals) each stage their own full clone. This matches the app-server trigger reported here and explains why background session runners amplify the leak so dramatically.activation.rs:76marketplace-backup-*,marketplace_add.rs:148.keep(), and 0.147.0 additionally leaks underplugins/.marketplace-plugin-source-staging/.Suggested fix (mirroring the existing curated-repo janitor): sweep
.stagingentries matchingmarketplace-{upgrade,add,backup}-*older than ~10 minutes while holding an OS-level lock (mtime alone is unsafe mid-flight, cf. #32058), and/or adopt the 24 h age-gated prune approach from #30620.Happy to provide additional local traces (lsof snapshots, per-dir timestamps) if useful.
lwz20210407 commentedon Aug 26, 2026
7-day follow-up from the Windows reporter above — regrowth measured, plus a natural experiment that supports the timeout hypothesis
I deleted
.staging/entirely on 2026-08-19 (the 101 dirs / 13.78 GB I reported here). Re-measured today, 2026-08-26, same machine, samecodex-cli 0.145.0-alpha.4, no config changes.It regrew, and nothing self-healed
17 new orphans / 2.67 GB between 2026-08-20 09:45 and 2026-08-26 10:17. Confirms there is no startup janitor and no lazy cleanup on the next successful upgrade — deleting the directory is purely symptomatic.
The rate is not constant — it tracks usage, not wall-clock
A 31× swing on an unchanged install. The first window was a heavy Codex day; the second was light. That's inconsistent with a fixed-interval poller and consistent with one orphan per upgrade attempt, i.e. the leak scales with how often the app triggers a sync.
The useful bit: only the large marketplace leaks
Remote census of all 17 (not sampled):
https://github.com/earthtojake/text-to-cad.git(~170 MB)https://github.com/sendbird/codex-marketplace.git(~2 MB)Both marketplaces are configured and both get upgraded. In my 2026-08-19 census the split was 90 / 5 / 6-no-remote — so
sendbirddid leak occasionally before. Over these 6 days it produced zero orphans whiletext-to-cadproduced 17.That is close to a controlled experiment on one machine: same client, same scheduler, same network, two marketplaces differing by ~85× in clone size, and only the large one leaks. It's hard to explain that with anything except a size-dependent failure — i.e. the 30 s
MARKETPLACE_UPGRADE_GIT_TIMEOUTfrom #38770 / #24815.Per-directory sizes back that up
Three things worth noting:
TempDirdestructor also being skipped on the success path (or the process being torn down after clone but before promote). Worth checking both paths, not just the timeout one.Also of note: 4 of the 17 landed between 00:01 and 06:12 on 08-25, when I was not using the machine interactively. So the sync fires unattended.
Restating the ask
Still no fix on any of the ten open reports. Porting
remove_stale_curated_repo_temp_dirsto the marketplace staging path would cap the damage regardless of which of the two failure paths above is responsible. Happy to test a build on Windows if that helps.Windows workaround, unchanged:
Verified again today that this is safe:
~/.codex/sessionsis untouched, andcodex plugin marketplace list/codex plugin listcome back clean afterwards.Davidcreador commentedon Sep 11, 2026
Fresh datapoint: still reproducible on Codex CLI 0.154.0 / Linux arm64
This is still unfixed in the current latest CLI release and in the Codex Desktop build installed alongside it.
Environment
0.154.026.901.51231, embedded CLI0.153.4https://github.com/Gentleman-Programming/engram.git, trackingmainObserved impact
marketplace-upgrade-*directories accumulated in less than a day..staging/marketplace-upgrade-*preserved it.Current source behavior
rust-v0.154.0and currentmainhave identicalmarketplace_upgrade.rscontent. Startup still spawnsplugins-marketplace-auto-upgrade, staging usesTempDir, Git clones have a hard-coded 30-second timeout, and there is no stale marketplace staging janitor. The in-flight guard is process-local, so concurrent/short-lived Codex processes remain an amplifier.Workaround applied locally
refto a full 40-character commit SHA. Both CLI 0.154.0 and Desktop's 0.153.4 recognize this and stop startup remote checks/clones once install metadata matches.marketplace-upgrade-*directories older than 15 minutes.After pinning, launching both CLI versions produced zero new staging directories.
A built-in age-gated janitor plus cross-process locking and shallow/incremental fetches would prevent this unbounded disk growth without requiring local cleanup automation.
lazybuttrying commentedon Sep 22, 2026
A fifth leaking prefix nobody has reported yet:
git-*in.tmp/rootThe analysis here and in the comments covers
marketplace-upgrade-,marketplace-backup-, andplugins-clone-. There is a fourth creation site with the sameTempDir-only lifetime, and it is not under.staging/, which is probably why it has gone unnoticed — it sits in$CODEX_HOME/.tmp/directly, next toplugins/.codex-rs/core-plugins/src/git_policy.rs,configure_trusted_git_repository:It builds a throwaway
GIT_DIR(HEAD, emptyobjects/, emptyrefs/) to isolate automatic Git commands from repository discovery, and it is called from four places:marketplace_upgrade/git.rs:25and:62,startup_sync.rs:612, andloader.rs:1893.macOS,
codex-cli, accumulated 2026-04-17 → 2026-09-21:.tmp/marketplaces/.staging/marketplace-upgrade-*.tmp/git-*.tmp/marketplaces/marketplace-backup-*Worth stating plainly because it cuts against the framing of this thread:
git-*is the most numerous orphan by a wide margin and the least significant by bytes — 4 KB each, since real objects are written into the clone destination, not theGIT_DIRscaffold. It will not show up in anyone'sdureport, but it is 3,901 inodes and it grows on every automatic Git operation, not only on upgrade attempts. Anyone implementing the sweep should include the prefix; anyone diagnosing by disk size will miss it.One constraint on the age threshold
The suggested fix here is an age-based sweep, which is right. But the threshold cannot simply be "comfortably above the Git timeout", because not every caller has one:
marketplace_upgrade/git.rs— every step goes throughrun_git_command_with_timeoutwithMARKETPLACE_UPGRADE_GIT_TIMEOUT(30 s).startup_sync.rs—CURATED_PLUGINS_GIT_TIMEOUT(30 s).loader.rs:1903—run_git_outputcallscommand.output()with no timeout at all, andloader.rs:1893gives that clone agit-*GIT_DIR.A directory's mtime only changes when its direct entries change, and Git writes objects into subdirectories after the initial scaffold, so an in-flight clone does not reliably keep the top-level mtime fresh. A ten-minute window applied to
git-*could therefore delete theGIT_DIRout from under a slow but live clone. The bounded prefixes are safe at ten minutes;git-*wants a much wider window (a day is still far below how long these actually survive) or a bound on that call site.Reference implementation
I have a working patch against
mainthat generalizesremove_stale_curated_repo_temp_dirsintostale_temp_dirs::remove_stale_temp_dirs(parent, prefix, max_age)and calls it from all five creation sites, with the threshold split described above. Tests assert stale removed / fresh kept / unrelated kept, including that an installed marketplace aged past the threshold survives.cargo test -p codex-core-plugins --lib→ 463 passed,cargo clippy --all-targetsclean.I understand from
docs/CONTRIBUTING.mdthat external code contributions are not accepted, so this is reference material rather than a PR offer — take, adapt, or ignore as useful: https://github.com/lazybuttrying/codex/tree/fix/marketplace-git-temp-dir-leakyaanfpv commentedon Oct 7, 2026
Another way to hit this one, which never stops on its own: a configured git marketplace whose upstream renamed itself fails the name check on every auto-upgrade and leaves a full clone each time. Details in #51609.
MLgentDev commentedon Oct 10, 2026
I can confirm the issue: Linux, size of ~/.codex/.tmp was about 500GB
codex --version
codex-cli 0.160.1
Terryli246 commentedon Oct 14, 2026
macOS reproduction + process attribution for the
git-*prefix (0.162.0-alpha.17.2)Adding a datapoint for the
git-*prefix described above, from a newer CLI than the rest of this thread, plus a measurement nobody has done yet: which process actually creates them.Everything below was measured on the live machine; nothing is inferred from
dualone.Environment
codex-cli 0.162.0-alpha.17.2(/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex)26.1007.30912(build20156), macOS 27.0.1, arm64ghost_snapshotanddesktop.worktree-*keys are absent fromconfig.tomlAccumulation: 1,255 dirs, ~15 MB
.tmp/git-*First seen 2026-09-08 (birth-time distribution, not mtime), newest just before cleanup on 2026-10-14. Rate is steady, not bursty — birth times show continuous creation:
Two points worth correcting for anyone else measuring this. First, mtime is misleading here: 1,221 of the 1,255 directories share an identical mtime, which is why an earlier pass of mine read them as a single burst. Birth time (
stat -f %SB) is what shows the real cadence. Second,duunderstates this prefix badly — 1,255 empty scaffolds cost ~15 MB of inode/block overhead, which is real but small; the inode count is the actual cost.Process attribution: created by codex itself, ~3–5 min cadence
I ran a 0.3-second-interval poller on
.tmp/for ~15 minutes and captured 19 creation events. At every event, the creating process tree included:and a
nodechild of PID 18641 bootstrapping theclaude-memplugin (scripts/mcp-server.cjs).lsof +Dreported zero open file handles under anygit-*directory at any sample, so these are not in-flight clones — they are abandoned immediately.That last point is the interesting one relative to the constraint raised in the earlier comment: if a
git-*GIT_DIRis genuinely discarded the moment it is scaffolded, the "wide age window so a live clone isn't deleted out from under itself" concern doesn't apply to these at all. All 1,255 contained no files underobjects/orrefs/, and everyHEADwas justref: refs/heads/main— the scaffold is written and abandoned before any object is added. A ten-minute sweep would be safe on this data.I can't say which of the four call sites named above (
marketplace_upgrade/git.rs:25,:62,startup_sync.rs:612,loader.rs:1893) is responsible here — my config has no marketplaces configured, so the plugin-sync paths are the more likely candidates but I have not isolated it.loader.rs:1893(run_git_output, no timeout) would fit the steady ~3–5 minute cadence better than a 30-second-timeout path.Not caused by local configuration
Full sweep of
config.tomlfound noghost_snapshot, noghost_snapshot.ignore_large_untracked_files, nocodex-git-root, nodesktop.git-worktree-root, noworktree-auto-cleanup-enabled. All defaults. So there is no local setting to turn this off.Cleanup
Deleted all 1,255 after confirming: zero
lsofhandles, zero files underobjects//refs/beyondHEAD(1,221 also had a Finder.DS_Store), and no other non-.DS_Storecontent anywhere in the population..tmp/went 167 MB → 152 MB.bundled-marketplaces/,marketplaces/,plugins/and the lock files were left untouched.It regrows immediately, and faster than steady
Deleting them is not a fix. With both codex processes still running and no config change:
git-*countThe first new directory (
git-Xs2JEA) is byte-for-byte the same shape as the old population —HEAD=ref: refs/heads/main, emptyobjects/, emptyrefs/, zero files beneath either. So the 13-to-14-minute interval was a lull, not the steady rate; under active desktop-app use this prefix accumulates considerably faster than the ~3–5 min I derived from the birth-time histogram, which was itself measured over a window where the app was doing less.That combination — scaffold written, abandoned, never swept, and regrowth visible within minutes of
rm -rf— is the whole bug from a user's side. It doesn't need a fix that preserves a live clone; it needs the scaffold not to outlive the call that made it.Kenmege commentedon Oct 18, 2026
Another data point for this leak, on codex-cli 0.160.1 (macOS, arm64).
$CODEX_HOME/.tmp/marketplaces/.staging/marketplace-upgrade-*accumulated 23 directories (~330 MB) over 19 days. The cause here was that[marketplaces.<name>].last_revisioninconfig.tomlstayed at an August revision for 4 of 5 git marketplaces, while each marketplace's.codex-marketplace-install.jsonand the remote HEAD had moved on. So the auto-upgrade skip condition (last_revision == remote_revisiontogether with matching install metadata) never held, and each periodic upgrade cloned again; any process exit mid-clone left a staging directory behind.Nothing else on the machine rewrites
config.toml, so the post-activation write oflast_revision(record_user_marketplace) apparently did not persist. Settinglast_revisionto the installed revision stopped the re-clones locally. A janitor for.staging/marketplace-upgrade-*, like the one that already exists for curated clones, would bound this; #51609 looks like the same class.Yimingwang-Leon commentedon Oct 26, 2026
Additional Windows 10 case:
os error 5while replacing the marketplace root, followed by approximately one-minute retry intervalsCross-posting the Windows evidence from Imbad0202/academic-research-skills-codex#43, as requested by its maintainer. These observations are from October 17, on the pre-fix bundled CLI below; this is not a claim that 0.164.0 still leaks. The bounded retest with the CLI actually used by Desktop is appended below.
Environment at the incident
codex-cli 0.163.0-alpha.10.2; the Desktop app version was not reliably recorded.2.56.0.windows.2, withcore.longpaths=true.ars-codex:https://github.com/Imbad0202/academic-research-skills-codex.git, trackingmain.52228e8280dd1770e18ecfc3b1fdf16b13b58104.71528d9349bcdacfbe94111f06d9e2d82215a44d.Observed impact
At one inspection,
%USERPROFILE%\.codex\.tmp\marketplaces\.stagingheld 213 staging directories and.tmpheld 378git-*directories (later 395). Earlier disk scans showed over 10 GB of staging growth, and C: eventually reached 0 bytes free. Thegit-*entries examined were small templates (21-byteHEAD, emptyobjectsandrefs), not the main byte consumer. Deleting old copies and restarting had not prevented recurrence while the Git source remained configured.Consecutive staging creation times on October 17, UTC+08:00:
Windows-specific error
returned:
“拒绝访问” means “Access is denied.” The locking process was not identified. A read-only backup was running during this explicit diagnostic attempt, so this error alone does not establish the cause of all previous automatic failures. Separate application warnings also included Git connection resets and an unavailable local proxy; I do not assume those network failures and the directory-replacement failure are one cause.
Workaround and validation
We preserved a verified 3.23.0 snapshot on another drive, replaced only the
ars-codexGit marketplace source with that local marketplace through the official CLI, and cleaned verified inactive temporary directories. All other marketplace/plugin settings were preserved. Both temporary-directory counts reached zero, and no new checkout appeared for about ten minutes;plugin liststill reported the plugin installed and enabled.The ARS maintainer has pointed us to the cleanup changes in #55689 and #55690, shipped in 0.164.0. The Windows retest below distinguishes:
The working local-marketplace configuration will remain available as the fallback. Paths are redacted; no credentials, complete configuration, or conversation logs are attached.
Windows retest on 2026-10-26
Desktop and runtime actually tested
prod. Its configured updater reportsup_to_date.app-serverreportscodex-cli 0.164.0-alpha.11.1. This is a prerelease, not the 0.164.0 stable binary; I am not inferring fix inclusion from the numeric version alone.Method and scope
The tests used that exact Desktop CLI executable and a separate
CODEX_HOMEon a secondary local drive. The production local-marketplace configuration was left unchanged. Real ARS source was used for the successful upgrade. Small offline Git fixtures were used to deliberately exercise failure paths, so there was no need to expose the live installation to repeated downloads or change its permissions.marketplace-windows-*fixturemarketplace-upgrade-*fixture older than 10 minutesmarketplace-add-*fixture older than 24 hours52228e8...upgraded to 3.23.2 /c923a914eaa45fe1435ad3ac6641a8f251167675git-*directoryos error 32; no new orphan after either failureos error 5; no new orphanThe controlled access-denied output was:
After every completed operation, zero operation-created staging directories and zero
git-*directories remained. Intentionally preserved control fixtures are excluded from that statement; they were removed with the isolated test home at the end.The production
config.tomlremained byte-identical throughout the retest. Production staging andgit-*counts were zero at the start and end, and ARS 3.23.0 remained installed/enabled from the existing local source. The temporary test checkouts were removed afterward.Conclusion and remaining limitation
The cleanup behavior associated with #55689 and #55690 is observable in this installed Desktop runtime, including cleanup after a controlled Windows
os error 5. A permission/sharing violation can still correctly prevent an upgrade; the observed improvement is that the failed checkout does not accumulate.This does not identify the cause of the original October 17 permission failure, reproduce the Desktop's long-running production Git auto-upgrade loop, or prove a days-long absence of recurrence after re-enabling it. I have therefore retained the working local-marketplace fallback rather than treating these bounded tests as proof that the original production issue is fully resolved.
Kenmege commentedon Nov 5, 2026
git-*still leaks on 0.166.0, plus a deterministic lifecycle reproductionEnvironment:
0.166.0.0.166.0-alpha.6.rust-v0.166.0=6ff1e1ca3b30fc8b914720681fcf5fe62e95f856.What we saw: 5,348
.tmp/git-*directories had built up since mid-October, about 21.8 MB allocated. That is after the 0.164.0 cleanup changes (#55689, #55690). Pinning every marketplace to a full SHA did not stop it. The pin skips the remote-revision lookup, but not the background plugin clones that also take aconfigure_trusted_git_repositoryguard (core-plugins/src/loader.rs,run_git_output).Controlled reproduction. No network or credentials are needed:
CODEX_HOMEwith one local marketplace and one Git-source plugin.gitfirst on PATH. Forclone, it recordsGIT_DIR, sleeps 4 s, then writes a minimal plugin manifest into the destination.codex app-serverover stdio. Callplugin/listwithmarketplaceKinds: ["local"]andforceRefetch: false; this starts the background plugin refresh.GIT_DIR, close stdin and terminate only that app-server. Let the fixture clone exit normally.git-*dir left after server exitHEAD,objects,refs)So the leak is the
TempDirguard's lifetime. An app-server that exits while a background clone holds the guard never runs its destructor, and nothing reclaims the directory later.Fix direction: either drain or cancel and join background Git operations at shutdown, or add an owner/liveness-aware janitor for
.tmp/git-*. Either way, keep theGIT_DIRisolation, and never sweep in-flight clones by age alone (see the mtime caveat above).eibrahim commentedon Nov 16, 2026
Another data point, codex-cli 0.163.0 on macOS (arm64), several machines.
~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-*behind, and nothing in Codex ever removes it.claude-plugins-official(git source) each leftover is a clone of about 38 MB. One machine gained 61 of them in a day, 49 in a single hour while several Codex sessions were busy.Expected: a failed, timed-out or interrupted upgrade removes its own staging folder, or Codex prunes stale
.staging/marketplace-upgrade-*folders when it starts.Workaround we run meanwhile: an hourly job that deletes
marketplace-upgrade-*folders older than 60 minutes that no process has open.qingtengCHINA commentedon Nov 26, 2026
macOS: fixed CLI is installed, but a pre-fix binary sharing
CODEX_HOMEkeeps creatingmarketplace-upgrade-*(27.5 GiB)Another data point. It explains why some users still see this leak after #55689 and #55690.
Environment
~/.codex:codex-cli 0.169.1from npm. This is the one onPATH. Its strings showmarketplace-upgrade-only asLEGACY_UPGRADE_PREFIX.codex-cli 0.154.0, the Homebrew cask (/opt/homebrew/bin/codex→Caskroom/codex/0.154.0). It was never upgraded after install.~/.codex/packages/app-server-daemon/releases/0.160.0-aarch64-apple-darwin/bin/codex, an old daemon release that is still on disk.marketplace-upgrade-creator frommarketplace_upgrade.rs(tagrust-v0.154.0, lines 264–272). Neither containsstaging-cleanup.lock.What we saw
~/.codex/.tmp/marketplaces/.staging/held 28marketplace-upgrade-*directories, 27.5 GiB in total, on a nearly full disk.claude-mem-local).claude-mem-localroot was last modified on Oct 21. Its upgrade never succeeded, so every attempt left another clone..staging.lockand.staging-cleanup.lockexist, which shows the new cleaner has run on this machine. Even so, the backlog did not drain.What we did not verify
daemon.stderr.logand pid files were last written on Oct 1–2, so the 0.160.0 daemon release had not run since then. That leaves the 0.154.0 cask as the most likely creator. Our guess at the mechanism: a GUI-launched tool whosePATHhas/opt/homebrew/binbut not the npm prefix resolvescodexto the cask. This is inferred from version strings and timestamps, not observed directly.marketplace-upgrade-*directories still appear.Why this matters after the fix
CODEX_HOMEwith a fixed one goes on creating legacy directories without limit. Nothing tells the user that an outdated Codex is still in use. A version check on startup ("another Codex older than X wrote to this CODEX_HOME"), or a warning incodex doctor, would surface this.MAX_CLEANUP_DIRECTORIES = 4per pass, incore-plugins/src/marketplace_staging.rs, only runs when an upgrade or add happens. That cannot keep up with a producer that adds about 1 GB several times a day. A byte-based budget, or a larger limit for legacy directories older thanLEGACY_UPGRADE_MAX_AGE, would let the fixed binary recover the disk.Workaround for affected users: run
which -a codex. Upgrade or remove every older copy (brew upgrade --cask codex, and remove oldapp-server-daemon/releases/*). Then delete~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-*directories older than an hour.skishore1676 commentedon Nov 26, 2026
Still reproducing on codex-cli 0.172.0 (macOS) —
marketplace-backup-*prefixData point from a newer release than the ones above.
Environment
0.172.0com.openai.codex)26.1120.50957, macOSWhat I see
marketplace-backup-<random>directories accumulated in~/.codex/.tmp/marketplaces/between 2026-11-24 and 2026-11-26 (~5.15 GiB, ~0.27 GiB each) alongside the live<marketplace-name>checkout. I removed them by hand.marketplace-backup-*directories appeared 25 minutes apart (314 MiB and 307 MiB), so the rate is roughly one full-size backup per sync while the desktop app is open..gitand plugin manifests, but is incomplete: they are missing 2,143 and 3,155 tracked files respectively — consistent with an interrupted/aborted upgrade whose backup is never cleaned up or restored..staging/was empty at the time, so on this version the growth is in themarketplace-backup-*prefix rather thanmarketplace-upgrade-*.completed remote installed plugin bundle syncevents over the same window; I couldn't tie individual backups to a specific trigger.config.toml(onlymarketplaces.<name>.source/.source_type).Ask: bounded retention for
marketplace-backup-*(e.g. keep the last 1–2, delete on successful activation), and cleanup of backups left by failed activations.