Skip to content

[bug] Upgrade Marketplaces trigger timeout after 30s would cause massive staging cache content in ".tmp" folder #38770

Open

Description

@zol9527

What version of the Codex App are you using (From “About Codex” dialog)?

26.813.12317

What subscription do you have?

plus

What platform is your computer?

Darwin 25.6.0 arm64 arm

What issue are you seeing?

Two related problems in the configured-marketplace auto-upgrade path
(codex-rs/core-plugins/src/marketplace_upgrade.rs):

1. The 30s git timeout is hardcoded and unrealistic for large repos

const MARKETPLACE_UPGRADE_GIT_TIMEOUT: Duration = Duration::from_secs(30);

Every auto-upgrade attempt runs a full git clone under this budget. For a
marketplace backed by a large repository (my case: volcengine/OpenViking,
~332MB worktree + ~236MB .git) on a modest connection, 30s is never enough,
so the upgrade fails every single time:

WARN codex_core_plugins::manager: failed to auto-upgrade configured marketplace
     marketplace="openviking"
     error=git clone marketplace source timed out after 30s

There is no config key, env var, or CLI flag to raise it — [marketplaces.*]
only accepts source_type, source, ref_name, sparse_paths,
last_updated, last_revision.

2. Failed upgrades leak their staging directories

Each attempt clones into a marketplace-upgrade-* temp dir under
~/.codex/.tmp/marketplaces/.staging/. After a timeout the directory is
abandoned, not deleted, and the upgrade is retried on every app restart /
periodic refresh. In ~6 hours this accumulated 194 orphaned directories,
43GB
on my machine (mix of empty dirs, complete ~332MB clones, and partial
500–680MB clones). Since the clone is retried forever and never succeeds, the
disk usage grows unboundedly.

The staging dir is created with tempfile::Builder::new().prefix( "marketplace-upgrade-").tempdir_in(...), so it should self-clean on Drop —
empirically it does not when the upgrade fails.

What steps can reproduce the bug?

. Add a git-backed marketplace whose full clone takes >30s on your connection:

[marketplaces.openviking]
source_type = "git"
source = "https://github.com/volcengine/OpenViking.git"
  1. Restart Codex (or wait for the periodic auto-upgrade).
  2. Observe the WARN in the logs and a new marketplace-upgrade-* dir left
    behind in ~/.codex/.tmp/marketplaces/.staging/ each attempt.
  3. du -sh ~/.codex/.tmp/marketplaces/.staging grows without bound.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    app
    on Aug 15, 2026
  2. added
    bug
    skills
    on Aug 15, 2026
  3. michaelsamoilenko commented on Sep 16, 2026

    @michaelsamoilenko

    Reproduced on Windows with codex-cli 0.154.0.

    Environment:

    • Windows NT 10.0.26200.0
    • Git 2.51.1.windows.1
    • PowerShell 7.6.6
    • Public marketplace: https://github.com/dotnet/skills.git

    Command:

    codex plugin marketplace upgrade dotnet-agent-skills

    Result:

    Failed to upgrade marketplace `dotnet-agent-skills`: git clone marketplace source timed out after 30s:
    Cloning into '...\marketplaces\.staging\marketplace-upgrade-XXXXXX'...
    Updating files: 100% (2683/2683), done.
    Error: 1 upgrade failure(s) occurred.
    

    The checkout eventually reaches 100%, but Codex still rejects it because the 30-second deadline has already elapsed.

    Independent measurements on the same machine:

    • Full clone: 66.67 seconds, .git size approximately 224.76 MiB
    • Shallow clone: 8.02 seconds, .git size approximately 3.93 MiB
    • codex plugin marketplace add dotnet/skills succeeds after approximately 69 seconds
    • marketplace upgrade fails because it enforces the 30-second limit

    A sparse marketplace is an effective workaround:

    codex plugin marketplace add dotnet/skills --sparse .agents --sparse plugins

    With that configuration, adding took 6.38 seconds and a subsequent marketplace upgrade took 6.56 seconds.

    The failed operations also left staging data under $CODEX_HOME/.tmp/marketplaces/.staging: four directories totaling 846.88 MiB, including a completed marketplace-upgrade-* directory of approximately 223.38 MiB. This appears related to #38770.

  4. KanadeK commented on Sep 21, 2026

    @KanadeK

    I can confirm this issue still reproduces on the current Windows desktop build, with severe disk impact.

    Environment

    • ChatGPT/Codex desktop app build: 26.915.31945
    • OS: Windows 11 x64
    • CODEX_HOME: non-default location on a secondary NTFS volume
    • Marketplace: public Git-backed marketplace; exact repository omitted for privacy

    Observed result

    The directory below accumulated 481 orphaned upgrade clones totaling 198.02 GB:

    <CODEX_HOME>\.tmp\marketplaces\.staging\marketplace-upgrade-*
    

    Most complete clones were approximately 0.60–0.61 GB each and contained 1,271 files. During one long-running Codex session alone, another 72 directories / 31.47 GB appeared.

    The local Codex log contains the matching failure (marketplace name and local path redacted):

    WARN codex_core_plugins::manager:
    failed to auto-upgrade configured marketplace marketplace="<redacted>"
    error=git clone marketplace source timed out after 30s:
    Cloning into '<CODEX_HOME>\.tmp\marketplaces\.staging\marketplace-upgrade-...'
    

    The staging directory was not reclaimed on later app starts or later marketplace operations. Disk usage continued to grow.

    Windows-specific cleanup detail

    When manually cleaning the staging directory, a normal recursive delete removed only 152 of the 481 directories. The remaining 329 directories contained 983 large Git pack files under .git\objects\pack; those files had the Windows ReadOnly attribute. Example:

    Attributes : ReadOnly, Archive
    Error      : Access to ...\.git\objects\pack\pack-....idx is denied
    

    After clearing the ReadOnly attribute, all remaining staging directories could be deleted, recovering approximately 198 GB.

    Expected behavior

    1. Always remove marketplace-upgrade-* after success, timeout, validation failure, or cancellation.
    2. Run a startup/periodic janitor for stale marketplace staging directories.
    3. Clear or handle Windows read-only Git pack attributes during cleanup.
    4. Make the 30-second clone timeout configurable or avoid repeated full-history clones (for example, shallow clone or fetch/update an existing mirror).

    This is not just a small temp-file leak: in normal desktop use it can consume hundreds of gigabytes and exhaust the volume.

  5. thomhurst commented on Oct 14, 2026

    @thomhurst

    Another Windows reproduction, with a permanent trigger from a common public marketplace: https://github.com/dotnet/skills.git (dotnet-agent-skills).

    Environment: codex-cli 0.162.1, Windows 11 (10.0.26200).

    Config:

    [marketplaces.dotnet-agent-skills]
    last_updated = "2026-08-31T22:14:38Z"
    last_revision = "f775756a79362846b1b5c8e46dbf38b3833ba26e"
    source_type = "git"
    source = "https://github.com/dotnet/skills.git"

    last_updated has not moved since 2026-08-31, so no upgrade has succeeded in about six weeks. Every attempt fails the same way:

    WARN codex_core_plugins::manager failed to auto-upgrade configured marketplace marketplace="dotnet-agent-skills" error=git clone marketplace source timed out after 30s: Cloning into 'C:\Users\<user>\.codex\.tmp/marketplaces\.staging\marketplace-upgrade-sayX8U'...
    Updating files:  62% (2184/3512)Updating files:  63% (2213/3512)...
    

    The download finishes inside 30 seconds. The timeout fires during checkout: the logged attempts reached between 62% and 87% of roughly 3,500 files. File creation on Windows is slow, probably because of antivirus scanning and NTFS overhead. As a result, this repository never finishes checking out in time on this machine. The failure is permanent rather than transient.

    Leak rate: .staging held 13 marketplace-upgrade-* directories, all created between 14:24 and 14:56 today. Ten were complete 381 MB clones; three were empty. That is 3.72 GB in about 30 minutes, from normal use with a few Codex sessions open.

    Requests, in order of impact:

    1. Delete the staging directory when an upgrade fails or times out. On Windows, clear the read-only attribute on .git/objects/pack/* first, or the recursive delete fails.
    2. Make the timeout configurable, or apply it to the network fetch only and not to checkout.
    3. Clone shallowly and sparsely (--depth 1 --filter=blob:none, plus sparse checkout of the marketplace and plugin paths). The upgrade only needs the manifest and plugin directories, not 3,500 files of history and tests.
    4. Back off after repeated failures for the same marketplace and revision, rather than recloning at every startup.
    5. Prune stale marketplace-upgrade-* directories at startup (fix(marketplace): prune stale upgrade staging directories #30620).

    Workaround for other Windows users, run while Codex is closed:

    Get-ChildItem "$env:USERPROFILE\.codex\.tmp\marketplaces\.staging" -Directory -Filter 'marketplace-upgrade-*' |
      Where-Object LastWriteTime -lt (Get-Date).AddHours(-1) |
      ForEach-Object { attrib -r "$($_.FullName)\*" /s /d; Remove-Item $_.FullName -Recurse -Force }

    Related: #21005, #39421, #45943, #51609.

  6. jonasyr commented on Oct 24, 2026

    @jonasyr

    Another reproduction on Linux (Arch), codex-cli 0.164.0.

    • Marketplace: https://github.com/pbakaus/impeccable.git (no sparse_paths; the installed snapshot is ~720 MB). codex plugin marketplace upgrade impeccable fails every time with git clone marketplace source timed out after 30s.
    • ~/.codex/.tmp/marketplaces/.staging/ had grown to 53 GB in 810 abandoned marketplace-upgrade-* / marketplace-linux-* directories before I emptied it by hand.

    One observation that may help others until there is a fix: codex plugin marketplace add (marketplace_add/install.rs, run_git) runs git without any timeout, so marketplace remove <name> followed by marketplace add <source> gets a large marketplace current where upgrade cannot. A configurable timeout (or the same no-timeout path for upgrade) plus removing the staging dir on failure would fix both halves.

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

    appbugskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions