Repository navigation
Cold start scales badly with large ~/.codex state: 419 MB logs DB + 625 MB sessions cause 1–5 min startup on WSL2 #28166
Description
Activity
- addedCLIIssues related to the Codex CLIIssues related to the Codex CLIwindows-osIssues related to Codex on Windows systemsIssues related to Codex on Windows systemssessionIssues involving session (thread) management, resuming, forking, naming, archivingIssues involving session (thread) management, resuming, forking, naming, archiving
on Jun 14, 2026 github-actions commented
on Jun 14, 2026 on Jun 14, 2026 – with GitHub ActionsContributorMore actionsPotential duplicates detected. Please review them and close your issue if it is a duplicate.
- Desktop launch can fail when logs_2.sqlite grows large: app-server SQLite pool times out during startup #27741
- Windows Desktop: brief mouse/input freezes after opening Codex with large sessions directory #28109
- Codex CLI extremely slow after billing renewal, one-word prompt takes 2-4 minutes even in empty directory #26775
Powered by Codex Action
This may be related to the broader local-state / logs / sessions performance cluster, but I do not think it is an exact duplicate.
My understanding of the difference is:
- Desktop launch can fail when logs_2.sqlite grows large: app-server SQLite pool times out during startup #27741 is about a Codex Desktop app-server launch failure on
/mnt/c, with a multi-GBlogs_2.sqlitecausing a SQLite pool timeout during startup. - Windows Desktop: brief mouse/input freezes after opening Codex with large sessions directory #28109 is about Windows Desktop mouse/input freezes and Desktop session-history responsiveness.
- Codex CLI extremely slow after billing renewal, one-word prompt takes 2-4 minutes even in empty directory #26775 is CLI-related, but it appears to reproduce even with a clean
CODEX_HOME, whereas in this report a cleanCODEX_HOMEis fast.
This issue is narrower: direct Codex CLI cold-start latency on native WSL2 ext4. The affected commands are
codex doctor,codex exec, and the TUI. The slowdown appears only with accumulated local state under~/.codex, and I tried to separate the cost by moving individual state components aside.The strongest distinction is that removing
logs_2.sqlitereduced colddoctortime by about 152 s, while removing the plugin catalog only reduced it by about 12 s. That makes this look less like a general plugin/model latency issue and more like a local-state startup path issue.If maintainers prefer to consolidate this into an existing tracking issue for local-state startup performance, I am happy to close it.
Thank you for consideration.- Desktop launch can fail when logs_2.sqlite grows large: app-server SQLite pool times out during startup #27741 is about a Codex Desktop app-server launch failure on
Cold start needs a metadata-first path that does not open every large history payload.
Commands like
doctor,exec, and TUI launch can read a compact session/log manifest first, then lazily hydrate only the active session. Diagnostics should report manifest rows, changed files scanned, bytes parsed, and time spent in logs DB versus session JSONL.That makes WSL cold-cache cost measurable.
Generated with ax.
What version of Codex CLI is running?
codex-cli 0.139.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
gpt-5.5
What platform is your computer?
WSL2 Ubuntu on Windows Linux 6.6.114.1-microsoft-standard-WSL2 x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
Windows Terminal with WSL2 Ubuntu, bash shell. No tmux/screen/zellij multiplexer.
Codex doctor report
What issue are you seeing?
On a cold page cache, full-init Codex commands such as codex exec, codex doctor, and the TUI can block for 1-5 minutes before doing useful work. This makes the CLI appear hung, especially to humans or wrappers using short timeouts.
Auth, network, websocket, and model access appear healthy. The delay appears to come from cold-cache startup I/O over accumulated local state in ~/.codex, especially logs_2.sqlite and sessions/.
Observed timings:
Accumulated ~/.codex state:
What steps can reproduce the bug?
Use Codex long enough for ~/.codex to accumulate large local state. In my case:
Drop the page cache:
sync
echo 3 | sudo tee /proc/sys/vm/drop_caches
Run:
codex doctor
or:
codex exec --skip-git-repo-check "say OK"
Observe a long silent startup delay before useful output.
I bisected the cold startup cost by moving one candidate aside, dropping the page cache, timing cold codex doctor, and then restoring the candidate.
This strongly suggests that the largest startup cost is associated with accumulated local state, especially the telemetry logs DB and the sessions directory. The plugin catalog contributes, but it is not the primary cause in this environment.
I also tested whether features.plugins=false explains the issue. It does not explain the main cold-start delay.
Interpretation:
What is the expected behavior?
Codex should start in a few seconds even when local history, telemetry, sessions, or plugin catalogs have grown large.
Large append-only or historical state should not block CLI startup unless the user explicitly opens that state.
If startup must do expensive local-state work, the CLI should print early progress such as "loading local state", "loading sessions", or "loading plugin catalog", so a slow cold start is not mistaken for a hang.
Additional information
Ruled out:
Secondary observations:
With plugins disabled, doctor timing is effectively unchanged. Physically moving the plugin catalog directory does change timing, which suggests doctor may still scan plugin-related state even when the feature is disabled.
In one RUST_LOG=info codex exec run, the same manifest warning for one plugin was logged 6 times, and a set of skill icon warnings was logged 24 times.
Example repeated warnings:
codex_core_plugins::manifest: ignoring interface.defaultPrompt[0]: prompt must be at most 128 characters
path=.../.tmp/plugins/plugins/ngs-analysis/.codex-plugin/plugin.json
codex_core_skills::loader: ignoring interface.icon_small/icon_large: icon path with '..'
One internal startup phase also logged approximately:
duration_ms=14502
Suggested fixes:
Local mitigation:
Using a clean CODEX_HOME with only auth/config avoids the delay, which further supports that the problem is accumulated local state rather than auth, network, or the binary itself.