Managed app-server daemon keeps every old release, ~/.codex/packages/app-server-daemon/releases grew to 2.8 GB
What version of Codex CLI is running?
codex-cli 0.161.0 (brew cask). The managed app-server daemon is also 0.161.0.
What subscription do you have?
ChatGPT Pro
Which model were you using?
gpt-6.1-sol, but i dont think the model is related.
What platform is your computer?
Darwin 27.0.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
iTerm2 3.7.3
Codex doctor report
Trimmed to the checks related to this issue, home path shortened to ~.
{
"schemaVersion": 1,
"codexVersion": "0.161.0",
"checks": {
"installation": {
"status": "ok",
"summary": "installation looks consistent",
"details": {
"PATH codex #1": "/opt/homebrew/bin/codex",
"current executable": "/opt/homebrew/bin/codex",
"install context": "brew (package /opt/homebrew/Caskroom/codex/0.161.0, bin /opt/homebrew/Caskroom/codex/0.161.0/bin, resources /opt/homebrew/Caskroom/codex/0.161.0/codex-resources, path /opt/homebrew/Caskroom/codex/0.161.0/codex-path)",
"managed by Vite+": "false",
"managed by bun": "false",
"managed by npm": "false",
"managed by pnpm": "false",
"managed package root": "not set"
}
},
"app_server.status": {
"status": "ok",
"summary": "background server is running",
"details": {
"app-server version": "0.161.0",
"control socket": "~/.codex/app-server-control/app-server-control.sock",
"daemon state dir": "~/.codex/app-server-daemon",
"dedicated pid file": "~/.codex/app-server-daemon/daemon.pid (file)",
"dedicated update-loop pid file": "~/.codex/app-server-daemon/daemon-updater.pid (file)",
"mode": "ephemeral",
"pid file": "~/.codex/app-server-daemon/app-server.pid (missing)",
"settings": "~/.codex/app-server-daemon/settings.json (missing)",
"status": "running",
"update-loop pid file": "~/.codex/app-server-daemon/app-server-updater.pid (missing)"
}
},
"updates.status": {
"status": "ok",
"summary": "update configuration is locally consistent",
"details": {
"cached latest version": "0.161.0",
"check for update on startup": "true",
"last checked at": "2026-10-08T10:43:34.404481Z",
"latest version": "0.161.0",
"latest version status": "current version is not older",
"update action": "brew upgrade --cask codex",
"version cache": "~/.codex/version.json"
}
},
"system.disk": {
"status": "ok",
"summary": "sufficient free disk space (67.9 GiB)",
"details": {
"CODEX_HOME available": "67.9 GiB",
"failure threshold": "1.0 GiB",
"warning threshold": "5.0 GiB",
"worktree available": "67.9 GiB"
}
}
}
}
What issue are you seeing?
The managed daemon updater installs every new release into ~/.codex/packages/app-server-daemon/releases/<version>-aarch64-apple-darwin/, but it never removes the old ones. Only current is used.
On my Mac there were 9 release folders after 13 days:
0.157.0 314M Sep 25
0.157.1 314M Sep 26
0.158.0 316M Sep 28
0.159.0 316M Sep 29
0.159.2 316M Sep 30
0.159.3 316M Oct 1
0.160.0 318M Oct 2
0.160.1 318M Oct 7
0.161.0 321M Oct 7 (current)
Total was 2.8 GB. With a new release almost every day this is around 200 MB per day and it never stops.
i looked at codex-rs/app-server-daemon (lib.rs, managed_install.rs, migration.rs) and scripts/install/install.sh on main and i couldnt find any code that removes previous release folders. Maybe i missed it.
The CLI here is installed with brew, so these copies grow quietly next to the brew install and most users will not notice them.
What steps can reproduce the bug?
- Install Codex CLI (brew cask in my case) and use it normally, so the managed daemon starts. No
~/.codex/app-server-daemon/settings.json, so auto update is on. - Wait for a few daemon auto updates. It checks 5 minutes after start and then every hour.
- Run:
ls ~/.codex/packages/app-server-daemon/releases
du -sh ~/.codex/packages/app-server-daemon/releases
What is the expected behavior?
After a successful update and restart, old releases are removed. Keeping current and maybe one previous release for rollback would be enough.
If keeping them is on purpose, a retention setting or a cleanup command under codex app-server daemon, and a short note in the README, would help.
Additional information
- i deleted the 7 old folders by hand and kept 0.161.0 (current) and 0.160.1. The daemon kept running, and
codex app-server daemon versionreportscliVersion,appServerVersionandmanagedCodexVersionall as 0.161.0. So manual cleanup looks safe, but users should not need to do it. - Related but different: #48195 (each release is a full package copy, about 374 MB) and #51961 (daemon and updater start without explicit settings).
Additional macOS confirmation on 2026-10-21, with source analysis and an isolated installer reproduction.
Environment and observed impact
- macOS 26.6.2, arm64.
- ChatGPT/Codex desktop app 26.1013.40934, build 20770; its bundled CLI reports
0.163.0-alpha.10.2. - Both standalone and managed daemon
currentlinks selected0.163.0-aarch64-apple-darwin. - Neither package root had a
selection-historyfile.
Location under ~/.codex/packages/ |
Complete release directories before cleanup | Approximate disk usage |
|---|---|---|
standalone/releases |
4: 0.159.1, 0.159.2, 0.162.1, 0.163.0 | 1.34 GB |
app-server-daemon/releases |
9: 0.159.1, 0.159.2, 0.159.3, 0.160.0, 0.160.1, 0.161.0, 0.162.0, 0.162.1, 0.163.0 | 3.02 GB |
Total package directory usage measured with du: 4,357,939,200 bytes. The desktop Storage page placed this largely under “Other,” so chat cleanup did not address the main usage.
After checking current targets, running executable paths and open files, nine superseded directories were manually removed, retaining 0.163.0 and 0.162.1 in both roots. Package directory usage fell to 1,358,258,176 bytes, a reduction of 2,999,681,024 bytes (~3 GB). Both current binaries still returned codex-cli 0.163.0; retained executable metadata and current links were unchanged. This verifies filesystem cleanup and version startup, not a full functional regression test.
Root cause and release coverage
In the 0.163.0 installer, cleanup_stale_install_artifacts() removes staging directories and temporary links, but not superseded, complete releases. The successful-install path installs/selects the new release without release pruning.
Both installation roots use this mechanism: installer root selection, and the daemon updater sets CODEX_INSTALL_DAEMON_ONLY=1.
I found the merged fixes #53827 (2026-10-14) and #55149 (2026-10-19). However, comparison against the rust-v0.163.0 tag confirms that neither fix is included in that release's source. Thus a fix merged to main should not yet be read as resolving existing 0.163.0 installations.
Isolated reproduction and migration edge case
Using the upstream scripts/install/test_install_sh.py download fixtures, with tiny valid macOS package payloads and all downloads mocked, I ran three sequential successful installations: 0.161.0 → 0.162.1 → 0.163.0.
| Installer / scenario | Releases remaining after the third install |
|---|---|
rust-v0.163.0, standalone |
3 |
rust-v0.163.0, daemon-only shell installer |
3 |
main at d138398cef7d49e46fe33f1d0ddbd2ca0ed16aa4, standalone |
2 |
One additional migration case may be useful: run the current main installer as a same-version reinstall over the old three-release standalone fixture, where current already selects 0.163.0 and there is no selection-history.
- Installation succeeds, but all three releases remain.
selection-historyis not created.- The installer warns:
Could not safely inspect old Codex releases; skipped remaining cleanup.
This follows the current code: history is only recorded when selection changes, while pruning requires valid history. The safety guard is understandable, but rerunning the updated installer alone does not clean an already-current legacy installation.
Please ensure both retention fixes reach the stable/macOS distribution, and provide/document a safe cleanup or history-migration path for already-accumulated installations, including this no-op case. Retaining current, previous, and genuinely in-use packages is appropriate. Showing obsolete package usage and a supported cleanup action in Storage would also make the issue easier to diagnose.
Related standalone report: #33256.
Adding a Linux data point from Arch Linux (openai-codex 0.167.1-1, official extra repo).
After upgrading from 0.167.0 to 0.167.1, ~/.codex/packages/app-server-daemon/releases/ contained two complete releases: the old 0.167.0-x86_64-unknown-linux-musl (516 MB) and the new one (358 MB). current pointed only at the new release, and no running process had the old binaries mapped, so the old copy was pure dead weight.
codex app-server daemon version showed the CLI, managed daemon, and app-server all at 0.167.1, so this is only about the retained directory, not a stale daemon process.
selection-history still references the old release after the upgrade, and I found no automatic pruning. Removing it manually had no effect on the running daemon.
Is a retention policy planned (e.g. current + N-1), or is manual cleanup the intended approach for now?
Linux regression: selection-history ctime precision mismatch prevents daemon pruning
Reproducible Linux-specific failure on v0.169.0 — a concrete root cause for the retention failure tracked here.
Root cause
The installer records the current symlink identity with GNU stat:
scripts/install/install.sh L846-847 (same pattern again at L1452-1453)
identity="$(LC_ALL=C stat -c '%d %i %.9Z' "$CURRENT_LINK" ...)"
The Rust pruner reconstructs it from the raw syscall:
codex-rs/app-server-daemon/src/release_pruning.rs L24-35
selection_identity() -> format!("{} {} {}.{:09}",
meta.dev(), meta.ino(), meta.ctime(), meta.ctime_nsec())
These are not equivalent. %.9Z goes through a double, and at epoch-second
magnitude the mantissa is already spending ~10 significant figures, so the
nanosecond field quantises to 100 ns.
Evidence
Same symlink, three readers:
python3 os.lstat().st_ctime_ns : 1794560352369099650 -> .369099650
LC_ALL=C stat -c '%.9Z' : 1794560352.369099600
selection-history line 3 : 2051 409766 1794560352.369099600
The strict compare at release_pruning.rs L162-168 therefore fails with
invalid or stale daemon selection — before any worker-identity check. The
caller logs that at debug level, so the skipped prune is silent.
The round trip only survives when ctime_nsec happens to be a multiple of
100, i.e. roughly 1 install in 100.
Note for anyone reproducing: checking this with stat -c %.9Z is the same
lossy reader the installer uses, so the comparison cannot fail. The bug is
only visible with a reader that returns integer nanoseconds.
Impact
On this machine: 21 release directories, 0.156.1 through 0.169.0, 370-522 MB
each, 9.12 GB — i.e. the fix from #53827 shipped but does not fire.
Retention would protect current + previous, leaving 19 directories /
~8.14 GB stranded. Growth was ~6 GiB in 13 days.
Suggested fix
- Have writer and reader use one identity representation; don't round-trip a float.
- Either emit integer nanoseconds (
%d %i %Zplus a separate nsec field), or parse numerically on the Rust side instead of comparing strings. - BSD
stat's%Fcon the macOS fallback path needs the same treatment. - Regression test with a
ctime_nsecthat cannot survive%.9Z. - Keep failing closed: a mismatched identity must still refuse to delete.
Environment
Codex CLI v0.169.0, Ubuntu 26.04 x86_64, managed app-server daemon.
Same thing happens on my machine with 61ns delay