Large long-lived local session history blocks Codex Desktop startup during state DB backfill
What version of the Codex App are you using (From “About Codex” dialog)?
Codex Desktop: 26.721.4979.0, App server: 0.146.0-alpha.3.1
What subscription do you have?
ChatGPT Pro
What platform is your computer?
Windows 11 x64 (Microsoft Windows NT 10.0.26200.0 x64)
What issue are you seeing?
Codex Desktop startup appears to depend on the total size and composition of the user's long-lived local session history. With my full existing Codex profile restored, containing approximately 34.25 GiB of session history, the application does not open and reports:
Codex app-server initialize handshake timed out
The Desktop log shows:
state db backfill is running at /mnt/c/Users/user/.codex; waiting up to 30s before retrying startup initialization
I first noticed this after an app update installed on Saturday, July 25, 2026. I cannot confirm whether that update introduced the regression or whether the behavior already existed and only became visible after the update/restart.
This is a serious long-term usability and data-retention problem. A user who keeps using Codex and retains session history can eventually reach a state where the application cannot start. Recovery currently requires manually moving internal session and SQLite state files, then restoring history in measured batches. Normal accumulated user history should not become a startup dependency that can make the application unusable.
The problem is specifically related to the session/state layer:
- With the full historical
sessions,archived_sessions, and matching state DB restored, Desktop initialization times out. - When those items are isolated from the active profile, Desktop starts.
- When history is restored incrementally while the state DB remains in a completed backfill state, Desktop starts again.
- In one verified staged state, approximately 0.9 GiB of restored history and 121 indexed DB entries produced a 275 ms Desktop handshake, a visible main window in 603 ms, and mounted routes in about 2.05 s, with no backfill wait.
This points to startup being synchronously coupled to a potentially large or repeated state DB backfill under a fixed initialization timeout. Large individual rollout files may also contribute.
What steps can reproduce the bug?
- Use a long-lived Codex Desktop profile with many retained sessions, including some large session rollout files. My complete history is approximately 34.25 GiB.
- Place the session history and its matching
state_5.sqlitestate under the normal%USERPROFILE%\.codexprofile. - Start Codex Desktop.
- Observe that the app-server initialization handshake times out while the state DB backfill is still running or waiting.
- Exit Codex completely.
- Move
sessions,archived_sessions, andstate_5.sqlite*out of the active profile, then start Codex again. - Observe that the application starts.
- Restore smaller subsets of the same history incrementally and rebuild/index them to completion.
- Observe that startup works again below the problematic history/backfill state.
The exact size threshold may depend on session count, individual rollout size, DB state, storage performance, and the WSL-backed filesystem path. The key reproducible boundary is that the same application installation starts with the history/state layer isolated and fails with the full long-lived history/state layer present.
What is the expected behavior?
Codex Desktop should remain launchable regardless of how much valid session history has accumulated during normal long-term use.
In particular:
- Historical state migration/backfill should be incremental, resumable, and preferably performed in the background.
- Startup should not require the entire historical corpus to finish processing within a fixed app-server handshake deadline.
- If migration is required, the UI should open and display progress or a recovery option instead of failing the whole application startup.
- A completed backfill should not be needlessly repeated.
- Large histories should be indexed, segmented, or compacted in a way that keeps startup time bounded.
- Failure diagnostics should identify the exact database/path, current progress, and a safe recovery action that does not require deleting user history.
Additional information
This appears related in theme to reports of unbounded local Codex state growth, but it is distinct from issue #27741: that issue concerns logs_2.sqlite, while this report concerns retained session history, state_5.sqlite, state DB backfill, and the Desktop initialization handshake.
I can provide sanitized timing data, file-count/size summaries, and the relevant Desktop log excerpt. I cannot safely publish raw session JSONL files, the complete SQLite database, or the full .codex archive because they contain conversation content, commands, local repository paths, and potentially sensitive data.
1 Comment
Additional reproduction: an empty completed backfill is not invalidated after rollout files are restored
I reproduced the same fixed 30-second initialization failure described in this issue on a substantially smaller Windows profile, and the recovery process exposed a second deterministic state/indexing problem.
Environment
OpenAI.Codex_26.727.4816.0_x640.146.0-alpha.9.219045, x64C:\Users\<windows-user>\.codex/home/<wsl-user>/.codex/sqlite/state_5.sqliteHistory at the time of failure:
logs_2.sqlitewas approximately 464 MB, but moving it aside did not change the state-backfill failure.Startup failure
With the full rollout history present and the WSL state DB requiring backfill, Desktop consistently terminated initialization after approximately 30 seconds:
The failure was deterministic while
backfill_state.statusremainedrunning.Deterministic stale-
completereproductionThe following recovery sequence exposed a separate issue:
sessionsandarchived_sessionsoutside the active Codex home.``
text
``threads=0
backfill_state.status=complete
Desktop now starts, but the restored history remains absent. The rollout files are not rescanned after the prior empty backfill has been marked
complete.Unsupported re-arm experiment
After backing up the database, changing the backfill state so that the importer ran again caused the existing rollout files to be indexed. Observed progress across separate launches included:
This demonstrates that the restored rollout files were readable and importable. However, each launch still encountered the same 30-second fatal startup boundary while backfill remained active.
Completion was reached only after temporarily excluding four of the largest remaining rollout files:
All four files passed line-by-line JSONL parsing. One contains an individual JSONL record of approximately 10 MB. That record is a candidate performance factor, but I have not established that it is the blocking record or the root cause.
Restoring even one excluded file and re-arming the backfill returns Desktop to the startup-timeout path.
Current workaround
Desktop is currently usable with:
No rollout files were deleted, but those four sessions are unavailable through Desktop history.
This workaround requires direct manipulation of internal state and is not suitable as a supported recovery procedure.
Additional behavior requested
This reproduction suggests that recovery needs all of the following:
This also overlaps with #31433 and #28068, which cover valid rollout files missing from the state DB and the lack of a supported historical rescan/reindex path. The additional evidence here is the deterministic empty-backfill-to-stale-
completetransition and the observed incremental importer progress under the same Windows/WSL runtime.