Skip to content

Marketplace upgrade staging leak: 559 GB / 4,972 orphaned dirs in 41 days; cleanup janitor exists for curated clones but not marketplaces #39421

Open

Description

@numberyy

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-second MARKETPLACE_UPGRADE_GIT_TIMEOUT trigger 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)

  1. codex-rs/core-plugins/src/marketplace_upgrade.rs stages each upgrade into tempfile::Builder::new().prefix("marketplace-upgrade-").tempdir_in(install_root.join(".staging")).
  2. TempDir cleanup 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.
  3. 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, mirroring remove_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

  1. added
    bug
    CLI
    skills
    on Aug 19, 2026
  2. lwz20210407 commented on Aug 19, 2026

    @lwz20210407

    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

    • Windows 11 Pro 10.0.26200
    • codex-cli 0.145.0-alpha.4
    • Codex desktop app (MS Store OpenAI.Codex) also installed and running during the day
    • 2 configured marketplaces (sendbird, text-to-cad) + openai-bundled; ~160 MB per full text-to-cad clone

    What I found

    %USERPROFILE%\.codex\.tmp\marketplaces\.staging\ had accumulated 101 orphaned directories / 13.78 GB / 96,174 files. The .git directories 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)

    count remote.origin.url
    90 https://github.com/earthtojake/text-to-cad.git
    5 https://github.com/sendbird/codex-marketplace.git
    6 no remote configured

    Those 6 clones with no remote at all are, I think, the most useful part of this report: they are clones killed before git remote add completed. 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 --porcelain on 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:

    07:15  07:37  07:53  08:03  08:41  08:57  09:01  09:15  09:59  10:37
    10:39  10:57  12:11  12:25  13:37  13:53  14:16  15:25  18:20  20:13
    

    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 parse
    • codex --version, codex plugin marketplace list, codex plugin list — all normal, 3 marketplaces detected, all plugins installed, enabled
    • live marketplaces/sendbird and marketplaces/text-to-cad clones intact with valid HEADs
    • logs_2.sqlite was regenerated automatically

    Manual workaround on Windows until a janitor lands:

    rd /s /q "%USERPROFILE%\.codex\.tmp\marketplaces\.staging"

    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_dirs to the marketplace staging path — that seems like the smallest change that stops the bleeding, independent of whatever happens to the 30 s clone timeout.

  3. Srcanesen commented on Aug 25, 2026

    @Srcanesen

    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 background codex exec sessions. ~41k files written in the last 24h alone.

    Root cause analysis (codex-rs/core-plugins, 0.147.0):

    • marketplace_upgrade.rs:251-268 creates staging clones via TempDir::tempdir_in(...) with prefix marketplace-upgrade-; cleanup relies solely on TempDir::Drop, which never runs on SIGKILL or when MARKETPLACE_UPGRADE_GIT_TIMEOUT (30 s, marketplace_upgrade/git.rs) aborts the operation.
    • There is no sweeper for marketplace temp dirs — contrast curated clones, which do have one (startup_sync.rs:400 remove_stale_curated_repo_temp_dirs) — so every orphan persists forever.
    • manager.rs:362/2557 gates upgrades behind a process-local in_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.
    • Sibling leaks share the same pattern: activation.rs:76 marketplace-backup-*, marketplace_add.rs:148 .keep(), and 0.147.0 additionally leaks under plugins/.marketplace-plugin-source-staging/.

    Suggested fix (mirroring the existing curated-repo janitor): sweep .staging entries matching marketplace-{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.

  4. lwz20210407 commented on Aug 26, 2026

    @lwz20210407

    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, same codex-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

    window orphans size rate
    2026-08-19 (~13 h) 101 13.78 GB ~13.8 GB/day
    2026-08-20 → 08-26 (6.0 d) 17 2.67 GB ~0.44 GB/day

    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):

    count remote
    17 https://github.com/earthtojake/text-to-cad.git (~170 MB)
    0 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 sendbird did leak occasionally before. Over these 6 days it produced zero orphans while text-to-cad produced 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_TIMEOUT from #38770 / #24815.

    Per-directory sizes back that up

    2026-08-20 09:45      3 MB   marketplace-upgrade-Ckdxl0   <-- partial, killed early
    2026-08-20 10:23    169 MB   marketplace-upgrade-iZOngF
    2026-08-20 10:58    169 MB   marketplace-upgrade-UuxdWd
    2026-08-20 11:01    169 MB   marketplace-upgrade-G4VqBy
    2026-08-20 11:05    169 MB   marketplace-upgrade-THJPZn
    2026-08-20 11:07    169 MB   marketplace-upgrade-0VkEaP
    2026-08-20 11:19    169 MB   marketplace-upgrade-x5VcTq
    2026-08-20 15:38    169 MB   marketplace-upgrade-AomJoq
    2026-08-22 12:54    171 MB   marketplace-upgrade-WxfIsl
    2026-08-22 14:59    171 MB   marketplace-upgrade-dybpSl
    2026-08-25 00:01    172 MB   marketplace-upgrade-MckTwN
    2026-08-25 02:22    172 MB   marketplace-upgrade-BvNmQm
    2026-08-25 04:12    172 MB   marketplace-upgrade-C7bOyF
    2026-08-25 06:12    172 MB   marketplace-upgrade-6oH0SZ
    2026-08-25 10:22    172 MB   marketplace-upgrade-MFZujp
    2026-08-25 15:43    172 MB   marketplace-upgrade-wKBUF5
    2026-08-26 10:17    173 MB   marketplace-upgrade-3pmqDo
    

    Three things worth noting:

    1. Most orphans are complete clones (169–173 MB), not partials. So the clone frequently finishes and the directory is still abandoned. The timeout explains the partials, but a completed-then-orphaned clone points at the TempDir destructor 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.
    2. Bursts, not a steady drip — 5 orphans inside 56 minutes on 08-20 (10:23→11:19), then 2 days of nothing. Retry storms while the app is open.
    3. Sizes creep 169 → 173 MB across the week, tracking upstream repo growth — so the per-leak cost grows over time on its own.

    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_dirs to 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:

    rd /s /q "%USERPROFILE%\.codex\.tmp\marketplaces\.staging"

    Verified again today that this is safe: ~/.codex/sessions is untouched, and codex plugin marketplace list / codex plugin list come back clean afterwards.

  5. Davidcreador commented on Sep 11, 2026

    @Davidcreador

    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

    • Omarchy / Arch Linux, arm64
    • standalone Codex CLI 0.154.0
    • Codex Desktop 26.901.51231, embedded CLI 0.153.4
    • one configured Git marketplace: https://github.com/Gentleman-Programming/engram.git, tracking main
    • multiple short-lived and concurrent Codex sessions

    Observed impact

    • After deleting roughly 50 GB of these clones the previous day, another 31 marketplace-upgrade-* directories accumulated in less than a day.
    • The 31 directories consumed 1,412.6 MiB; each completed clone was about 46 MiB.
    • The directories tracked successive Engram revisions and their timestamps followed Codex usage/session churn.
    • The installed marketplace was valid and separate; deleting only .staging/marketplace-upgrade-* preserved it.

    Current source behavior

    rust-v0.154.0 and current main have identical marketplace_upgrade.rs content. Startup still spawns plugins-marketplace-auto-upgrade, staging uses TempDir, 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

    1. Pin the marketplace ref to 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.
    2. Run an hourly user timer that removes only exact 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.

  6. lazybuttrying commented on Sep 22, 2026

    @lazybuttrying

    A fifth leaking prefix nobody has reported yet: git-* in .tmp/ root

    The analysis here and in the comments covers marketplace-upgrade-, marketplace-backup-, and plugins-clone-. There is a fourth creation site with the same TempDir-only lifetime, and it is not under .staging/, which is probably why it has gone unnoticed — it sits in $CODEX_HOME/.tmp/ directly, next to plugins/.

    codex-rs/core-plugins/src/git_policy.rs, configure_trusted_git_repository:

    let staging_root = canonical_home.join(".tmp");
    ...
    let repository = tempfile::Builder::new()
        .prefix("git-")
        .tempdir_in(staging_root.as_path())?;

    It builds a throwaway GIT_DIR (HEAD, empty objects/, empty refs/) to isolate automatic Git commands from repository discovery, and it is called from four places: marketplace_upgrade/git.rs:25 and :62, startup_sync.rs:612, and loader.rs:1893.

    macOS, codex-cli, accumulated 2026-04-17 → 2026-09-21:

    Path Count Size
    .tmp/marketplaces/.staging/marketplace-upgrade-* 1,085 5.0 GB
    .tmp/git-* 3,901 15 MB
    .tmp/marketplaces/marketplace-backup-* 3 35 MB

    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 the GIT_DIR scaffold. It will not show up in anyone's du report, 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 through run_git_command_with_timeout with MARKETPLACE_UPGRADE_GIT_TIMEOUT (30 s).
    • startup_sync.rs — CURATED_PLUGINS_GIT_TIMEOUT (30 s).
    • loader.rs:1903 — run_git_output calls command.output() with no timeout at all, and loader.rs:1893 gives that clone a git-* 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 the GIT_DIR out 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 main that generalizes remove_stale_curated_repo_temp_dirs into stale_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-targets clean.

    I understand from docs/CONTRIBUTING.md that 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-leak

  7. yaanfpv commented on Oct 7, 2026

    @yaanfpv

    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.

  8. MLgentDev commented on Oct 10, 2026

    @MLgentDev

    I can confirm the issue: Linux, size of ~/.codex/.tmp was about 500GB
    codex --version
    codex-cli 0.160.1

  9. Terryli246 commented on Oct 14, 2026

    @Terryli246

    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 du alone.

    Environment

    • codex-cli 0.162.0-alpha.17.2 (/Applications/ChatGPT.app/Contents/Resources/codex-cli/CodexCLI.app/Contents/MacOS/codex)
    • ChatGPT desktop app 26.1007.30912 (build 20156), macOS 27.0.1, arm64
    • No marketplace-related config; ghost_snapshot and desktop.worktree-* keys are absent from config.toml

    Accumulation: 1,255 dirs, ~15 MB

    Path Count Size
    .tmp/git-* 1,255 ~15 MB

    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:

    Date Dirs
    2026-09-08 2
    2026-09-22 9
    2026-09-27 15
    2026-09-28 81
    2026-09-29 30
    2026-09-30 124
    2026-10-01 19
    2026-10-08 ~168 (peak)
    2026-10-14 36

    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, du understates 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:

    codex app-server  -c features.code_mode_host=true          (PID 18641)
    codex exec-server --remote https://codex-cloud-environments.chatgpt.com/api  (PID 21589)
    

    and a node child of PID 18641 bootstrapping the claude-mem plugin (scripts/mcp-server.cjs). lsof +D reported zero open file handles under any git-* 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_DIR is 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 under objects/ or refs/, and every HEAD was just ref: 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.toml found no ghost_snapshot, no ghost_snapshot.ignore_large_untracked_files, no codex-git-root, no desktop.git-worktree-root, no worktree-auto-cleanup-enabled. All defaults. So there is no local setting to turn this off.

    Cleanup

    Deleted all 1,255 after confirming: zero lsof handles, zero files under objects//refs/ beyond HEAD (1,221 also had a Finder .DS_Store), and no other non-.DS_Store content 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:

    Elapsed after deletion git-* count
    0 min 0
    4 min 0
    10 min 0
    11 min 1
    14 min 14

    The first new directory (git-Xs2JEA) is byte-for-byte the same shape as the old population — HEAD = ref: refs/heads/main, empty objects/, empty refs/, 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.

  10. Kenmege commented on Oct 18, 2026

    @Kenmege

    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_revision in config.toml stayed at an August revision for 4 of 5 git marketplaces, while each marketplace's .codex-marketplace-install.json and the remote HEAD had moved on. So the auto-upgrade skip condition (last_revision == remote_revision together 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 of last_revision (record_user_marketplace) apparently did not persist. Setting last_revision to 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.

  11. Yimingwang-Leon commented on Oct 26, 2026

    @Yimingwang-Leon

    Additional Windows 10 case: os error 5 while replacing the marketplace root, followed by approximately one-minute retry intervals

    Cross-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

    • Windows 10 Home 22H2, build 19045.6466.
    • Codex Desktop using bundled codex-cli 0.163.0-alpha.10.2; the Desktop app version was not reliably recorded.
    • Git 2.56.0.windows.2, with core.longpaths=true.
    • Marketplace ars-codex: https://github.com/Imbad0202/academic-research-skills-codex.git, tracking main.
    • Installed ARS 3.23.0, marketplace revision 52228e8280dd1770e18ecfc3b1fdf16b13b58104.
    • An unpromoted staging checkout contained 3.23.1 / 71528d9349bcdacfbe94111f06d9e2d82215a44d.

    Observed impact

    At one inspection, %USERPROFILE%\.codex\.tmp\marketplaces\.staging held 213 staging directories and .tmp held 378 git-* directories (later 395). Earlier disk scans showed over 10 GB of staging growth, and C: eventually reached 0 bytes free. The git-* entries examined were small templates (21-byte HEAD, empty objects and refs), 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:

    01:31:18  01:32:19  01:33:19  01:34:25
    01:35:25  01:36:25  01:37:26  01:38:26
    

    Windows-specific error

    codex plugin marketplace upgrade ars-codex --json

    returned:

    Failed to upgrade marketplace `ars-codex`: failed to move previous marketplace root out of the way at %USERPROFILE%\.codex\.tmp/marketplaces\ars-codex: 拒绝访问。 (os error 5)
    Error: 1 upgrade failure(s) occurred.
    

    “拒绝访问” 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-codex Git 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 list still 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:

    1. Whether replacement of the old marketplace root still fails.
    2. Whether a failed or abandoned attempt leaves accumulating staging copies.
    3. Which Desktop version and actually bundled CLI are being tested, rather than relying on a separately installed CLI.

    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

    • Codex Desktop 26.1021.31345, build 21828, release channel prod. Its configured updater reports up_to_date.
    • MSIX package version observed from the running parent process: 26.1021.3705.0.
    • The executable used by Desktop's running app-server reports codex-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.
    • Windows 10 Home 22H2, build 19045.6466.

    Method and scope

    The tests used that exact Desktop CLI executable and a separate CODEX_HOME on 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.

    Case Observed result
    Unowned marketplace-windows-* fixture Reclaimed
    Legacy marketplace-upgrade-* fixture older than 10 minutes Reclaimed
    Legacy marketplace-add-* fixture older than 24 hours Reclaimed
    Recent legacy fixture and unrelated sentinel Preserved on the initial pass; the recent legacy fixture was later reclaimed after it crossed the age threshold
    Real ARS 3.23.0 checkout at 52228e8... upgraded to 3.23.2 / c923a914eaa45fe1435ad3ac6641a8f251167675 Upgrade succeeded; no newly orphaned staging or git-* directory
    Two consecutive upgrades with a readable directory handle denying delete sharing Both failed at “move previous marketplace root” with os error 32; no new orphan after either failure
    Same fixture after closing that handle Upgrade succeeded
    Add with an intentionally nonexistent Git ref Checkout failed as expected; no new orphan
    Upgrade with temporary, non-inheriting delete-denial ACLs on the isolated fixture directory/parent Failed at “move previous marketplace root” with the exact os error 5; no new orphan
    Same fixture after restoring the original ACLs Upgrade succeeded; ACL restoration was verified

    The controlled access-denied output was:

    Failed to upgrade marketplace `codex-retest`: failed to move previous marketplace root out of the way at <isolated-test-home>\.tmp/marketplaces\codex-retest: 拒绝访问。 (os error 5)
    Error: 1 upgrade failure(s) occurred.
    

    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.toml remained byte-identical throughout the retest. Production staging and git-* 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.

  12. Kenmege commented on Nov 5, 2026

    @Kenmege

    git-* still leaks on 0.166.0, plus a deterministic lifecycle reproduction

    Environment:

    • macOS 27.2 (arm64).
    • CLI and app-server 0.166.0.
    • Desktop bundled CLI 0.166.0-alpha.6.
    • Source at the release tag: 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 a configure_trusted_git_repository guard (core-plugins/src/loader.rs, run_git_output).

    Controlled reproduction. No network or credentials are needed:

    1. Use an isolated, disposable CODEX_HOME with one local marketplace and one Git-source plugin.
    2. Put a fixture git first on PATH. For clone, it records GIT_DIR, sleeps 4 s, then writes a minimal plugin manifest into the destination.
    3. Start codex app-server over stdio. Call plugin/list with marketplaceKinds: ["local"] and forceRefetch: false; this starts the background plugin refresh.
    4. Once the fixture has recorded its GIT_DIR, close stdin and terminate only that app-server. Let the fixture clone exit normally.
    Case Clone finished git-* dir left after server exit
    Server ended during the clone yes yes (HEAD, objects, refs)
    Server ended after the clone's guard dropped yes no

    So the leak is the TempDir guard'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 the GIT_DIR isolation, and never sweep in-flight clones by age alone (see the mtime caveat above).

  13. eibrahim commented on Nov 16, 2026

    @eibrahim

    Another data point, codex-cli 0.163.0 on macOS (arm64), several machines.

    • Every failed or interrupted marketplace auto-upgrade leaves ~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-* behind, and nothing in Codex ever removes it.
    • With 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.
    • With a larger git marketplace (a repository of about 900 MB whose clone never finished inside the 30-second upgrade timeout), one machine reached 2,324 leftover folders, about 60 GB, and ran out of disk.

    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.

  14. qingtengCHINA commented on Nov 26, 2026

    @qingtengCHINA

    macOS: fixed CLI is installed, but a pre-fix binary sharing CODEX_HOME keeps creating marketplace-upgrade-* (27.5 GiB)

    Another data point. It explains why some users still see this leak after #55689 and #55690.

    Environment

    • macOS 27, arm64.
    • Three Codex binaries share one ~/.codex:
      • codex-cli 0.169.1 from npm. This is the one on PATH. Its strings show marketplace-upgrade- only as LEGACY_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.
    • Strings show that both older binaries contain the marketplace-upgrade- creator from marketplace_upgrade.rs (tag rust-v0.154.0, lines 264–272). Neither contains staging-cleanup.lock.

    What we saw

    • ~/.codex/.tmp/marketplaces/.staging/ held 28 marketplace-upgrade-* directories, 27.5 GiB in total, on a nearly full disk.
    • Each directory was a full ~1 GB clone of a local git marketplace (claude-mem-local).
    • New directories kept appearing several times a day, for example 10:11, 10:37, 10:46, 10:57, 11:05 and 11:34 on one day. That was well after 0.169.1 was installed.
    • The installed claude-mem-local root was last modified on Oct 21. Its upgrade never succeeded, so every attempt left another clone.
    • .staging.lock and .staging-cleanup.lock exist, which shows the new cleaner has run on this machine. Even so, the backlog did not drain.

    What we did not verify

    • We did not catch which process started the old binary. When we polled for about 2 minutes, no new directory appeared.
    • The daemon's daemon.stderr.log and 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 whose PATH has /opt/homebrew/bin but not the npm prefix resolves codex to the cask. This is inferred from version strings and timestamps, not observed directly.
    • We removed the cask and the stale daemon release. We will follow up on whether new marketplace-upgrade-* directories still appear.

    Why this matters after the fix

    1. A pre-fix binary that shares CODEX_HOME with 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 in codex doctor, would surface this.
    2. MAX_CLEANUP_DIRECTORIES = 4 per pass, in core-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 than LEGACY_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 old app-server-daemon/releases/*). Then delete ~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-* directories older than an hour.

  15. skishore1676 commented on Nov 26, 2026

    @skishore1676

    Still reproducing on codex-cli 0.172.0 (macOS) — marketplace-backup-* prefix

    Data point from a newer release than the ones above.

    Environment

    • codex-cli 0.172.0
    • Codex desktop (com.openai.codex) 26.1120.50957, macOS
    • One configured git marketplace (~360 MiB checkout)

    What I see

    • 19 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.
    • Within the same day after cleanup, two new 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.
    • Each backup wraps a checkout with .git and 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 the marketplace-backup-* prefix rather than marketplace-upgrade-*.
    • Logs show 10 completed remote installed plugin bundle sync events over the same window; I couldn't tie individual backups to a specific trigger.
    • No retention/cleanup setting exists in config.toml (only marketplaces.<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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLILinuxbugskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions