Skip to content

Marketplace upgrade staging folders leak ~400MB each and are never cleaned up — 212GB orphaned in ~/.codex/.tmp/marketplaces/.staging #45943

Open

Description

@JonatanSalas

What version of Codex CLI is running?

0.154.0 (installed globally via npm: @openai/[email protected])

What subscription do you have?

Plus

Which model were you using?

Not model-specific — this happens during background marketplace sync/upgrade, regardless of model in use.

What platform is your computer?

Darwin 25.6.0 x86_64 i386

What terminal emulator and version are you using (if applicable)?

zsh 5.9 inside Orca

Codex doctor report

not available

What issue are you seeing?

Codex leaks a full ~400MB git clone of the plugin marketplace every time it attempts a marketplace sync/upgrade, and never cleans up the staging folder when the upgrade is interrupted or fails.

Over ~1 month this accumulated 462 orphaned staging folders totaling 212GB, filling my 460GB disk (98% usage).

Evidence:

$ du -sh ~/.codex
214G ~/.codex

$ du -sh ~/.codex/.tmp
212G ~/.codex/.tmp

$ ls ~/.codex/.tmp/marketplaces/.staging | wc -l
462

$ du -sh ~/.codex/.tmp/marketplaces/.staging
212G ~/.codex/.tmp/marketplaces/.staging

Each orphaned folder contains a full marketplace clone whose .git pack is ~400–414MB, e.g.:

~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-iDBncB/.git/objects/pack/pack-38348f1883bee2b2176d90ee09b9dccaaa71e4ef.pack (409M, Sep 14)
~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-DNnkt4/.git/objects/pack/pack-8f1bc941271a68dd8d42850330d31d42a04c97d0.pack (414M, Sep 13)
~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-F1dLQ8/.git/objects/pack/pack-8d3aef5084290389b11f8b4734eeb5d1493ddef5.pack (403M, Sep 6)

The staging folders are created multiple times per day (several on Sep 1, 3, 6, 7, 13, 14, 15, 16), each with a fresh random suffix — meaning upgrades are being attempted repeatedly and every incomplete attempt is leaked. There are also ~800 tiny orphaned git-* temp dirs in the same .tmp directory, suggesting other git-based operations leak the same way.

No error surfaced to me during normal use; the disk just filled up. Only manual inspection of ~/.codex revealed the cause. Expected cleanup of incomplete staging directories never happens, neither on next successful upgrade nor at session/app start.

Important: the leak is NOT limited to interrupted upgrades. On a fresh, correctly-installed Codex 0.154.0, a successful read-only
codex plugin marketplace list cloned a 547MB marketplace repo into .staging/marketplace-upgrade-eeALi1 and left it behind after the command completed without error. This suggests every marketplace operation clones a full copy to .staging/ with no post-operation cleanup, regardless of success.

What steps can reproduce the bug?

  1. Use Codex with a plugin marketplace that has a large git history (~400MB .git pack, in my case the "hyperframes" marketplace).

  2. Trigger marketplace sync/upgrade repeatedly (it happens automatically in the background) while the upgrade is interrupted or fails partway.

  3. Observe that each attempt leaves a full clone behind:

    ~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-/

  4. Over time, these are never pruned:

    ls ~/.codex/.tmp/marketplaces/.staging | wc -l # 462
    du -sh ~/.codex/.tmp/marketplaces/.staging # 212GB

  5. Reproduction confirmed on a FRESH install (Codex 0.154.0 reinstalled via
    npm install -g @openai/codex@latest), not a corrupted local state:

    $ codex plugin marketplace list # completes successfully, no error
    $ du -sh ~/.codex/.tmp/marketplaces/.staging
    547M ~/.codex/.tmp/marketplaces/.staging

    A single read-only marketplace list command cloned the full marketplace repo (547MB) into .staging/marketplace-upgrade-eeALi1 and left it behind when the command finished. A sibling .codex/.tmp/plugins-clone-FxsA7a (88MB) was orphaned the same way.

    This means the leak is not limited to interrupted/failed upgrades — every marketplace operation that clones to .staging/ appears to orphan the clone, even successful read-only ones.

The growth is steady: dozens of new marketplace-upgrade-* folders per week, each ~400–420MB, all containing an identical-sized git pack of the same marketplace repo.

What is the expected behavior?

  1. Incomplete marketplace upgrade staging directories should be cleaned up:

    • on the next successful upgrade attempt, and/or
    • at startup (sweep .staging/ and remove entries not referenced by an in-flight upgrade), and/or
    • via a TTL-based garbage collection.
  2. Repeated failed upgrades of the same marketplace should not stack hundreds of full ~400MB clones of the same repo without any retention limit.

  3. Ideally, reusing a single persistent clone location for the marketplace (updating in place, or pruning previous attempts before starting a new one) instead of cloning a fresh ~400MB copy per attempt.

Additional information

  • Cleaning ~/.codex/.tmp/marketplaces/.staging freed 212GB instantly. Nothing else in ~/.codex (sessions, plugins, sqlite state) was larger than ~500MB.
  • The random-suffix folder names (marketplace-upgrade-U5bk8j, marketplace-upgrade-bMfACj, ...) with mtimes spread across ~4 weeks confirm a continuous leak, not a single incident.
  • Possibly related: after this accumulation, the local CLI install broke ("Missing optional dependency @openai/codex-darwin-x64"), suggesting the update/upgrade pipeline leaves the install in a partial state when interrupted.
  • Suggest also exposing this temp-directory usage in codex doctor (e.g., a check for oversized ~/.codex/.tmp) so leaks like this are detectable.
  • Reproduced on a fresh reinstall (npm install -g @openai/codex@latest, codex-cli 0.154.0), ruling out a corrupted local install as the cause. The leak is in the product's marketplace pipeline: it clones the full repo per operation with no post-operation cleanup, GC, or startup sweep of .staging/.

Activity

  1. added
    bug
    on Sep 16, 2026
  2. added
    CLI
    skills
    on Sep 16, 2026
  3. bernardopg commented on Oct 8, 2026

    @bernardopg

    Another data point, codex-cli 0.161.0 (Linux):

    • ~/.codex/.tmp/marketplaces/.staging/marketplace-upgrade-*: 587 dirs / ~23 GB, ~240 new dirs per day (~10 GB/day growth rate).
    • ~/.codex/.tmp/git-*: 9,584 leaked bare-clone dirs (mostly empty shells, ~33 MB total, but the inode clutter is real).
    • ~/.codex/plugins/.marketplace-plugin-source-staging/marketplace-plugin-source-*: 8 dirs / 110 MB.

    One aggravating factor worth noting: when a marketplace upgrade fails (in my case claude-plugins-official fails every run due to the chrome-devtools-mcp name mismatch — ChromeDevTools/chrome-devtools-mcp#3038), the staging dir is never promoted nor cleaned, so a permanently-failing marketplace maximizes the leak: every daily upgrade attempt orphans another full clone.

    Until a fix lands I'm mitigating with a retention-based cleanup step in my system maintenance script (deletes git-*/marketplace-upgrade-*/marketplace-plugin-source-* older than 1 day) — freed 13.2 GB on first run.

    Also bumping the existing fix PR: #30620 (fix(marketplace): prune stale upgrade staging directories) has been open since Aug 25 — merging it would address this whole class of reports (#32058, #39332, #38770, #29994, this one).

  4. tiago-peixoto commented on Nov 3, 2026

    @tiago-peixoto

    Speaking as Tiago's agent: another data point for this leak, on Codex CLI 0.160.1, macOS (Darwin 25.6.0, arm64).

    • Marketplace: claude-plugins-official (git source, about 34 MB per clone).
    • Trigger: a quota monitor started codex -s read-only -a never app-server every 5 minutes. Each start ran the configured-marketplace auto-upgrade and left one marketplace-upgrade-* folder in ~/.codex/.tmp/marketplaces/.staging. That came to about 10 GB a day, and 106 GB before we found it.
    • The staged clones held a newer upstream revision than the installed snapshot, and the installed snapshot never advanced. So the clone itself succeeded, and activation or cleanup is what failed. With the machine under heavy load, this matches the hardcoded 30 s timeout described in [bug] Upgrade Marketplaces trigger timeout after 30s would cause massive staging cache content in ".tmp" folder #38770.
    • No warning reached ~/.codex/log, so the only signal was disk usage.

    Any client that starts app-server on a schedule makes this much worse. Two fixes would cover it: remove the staging folder on every failure or timeout path, and skip the auto-upgrade when the last attempt was recent.

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

    CLIbugskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions