Desktop app crash-loops at startup: sqlite state runtime backfill exceeds fixed 30s timeout on large session stores; rebuilds discard pins and custom thread names
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
After updating to ChatGPT Desktop 26.825.41651 (bundled codex-cli 0.151.0-alpha.7.1, macOS arm64), the app crash-loops at startup on a machine with a large session store (~17,000 rollout files / ~16 GB under $CODEX_HOME/sessions). Root cause chain:
- The new sqlite state runtime (
state_5.sqlite, includesthread_spawn_edges) performs a full backfill over all rollout files on first initialization. - On this store the backfill takes several minutes, but startup waits only 30s:
Error: failed to initialize sqlite state runtime under $CODEX_HOME: timed out waiting for state db backfill at $CODEX_HOME after 30s (status: running)→ exit code 1. - Every relaunch kills the in-progress backfill at 30s and restarts it, so the app never comes up (crash loop).
Before the app became fully unable to start, active chats failed with "thread not found"; logs show:
state db list_threads failed: error returned from database: (code: 1) no such table: thread_spawn_edges
Workaround that recovered the app
Running the bundled binary manually (no 30s watchdog) let the backfill complete once (~4 min), after which the app started normally:
"/Applications/ChatGPT.app/Contents/Resources/codex" app-server
Data-loss aspect (worse than the crash)
Each state-db rebuild regenerates thread rows from rollout files and discards user-curated data that is not stored in rollouts:
is_pinned(pinned chats)- custom thread names (set via
thread/name/set— these land only in the state DB, not in the rollout, so a later rebuild erases them) - previously generated/curated titles (regenerated from the first user message)
Additionally, any externally detected modification of state_5.sqlite appears to trigger an immediate full rebuild, compounding the loss.
Related observation
codex doctor shows the rollout scan is capped at 9,999 files (rollout DB scan cap reached true); with >10k active files, stale-row and archive-mismatch checks are silently skipped.
Suggestions
- Raise or remove the 30s startup timeout, or make the initial backfill asynchronous/resumable so the UI can start while it runs.
- Persist pins and custom names durably (e.g. in rollout metadata) or preserve these columns across backfills.
- Surface the scan cap instead of skipping checks silently.
Environment
- ChatGPT Desktop 26.825.41651, Codex Framework 151.0.7922.174
- bundled codex-cli 0.151.0-alpha.7.1
- macOS 26.5.2 (arm64)
- ~17k active rollout files, ~16 GB; state DB ~360 MB after backfill
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the bundled codex app-server entry point and state_5.sqlite initialization against a large session store, focusing on the 30-second backfill timeout and rebuild behavior. Also inspect the codex doctor rollout scan cap. Done means startup completes reliably without a crash loop or destructive rebuild of pins and custom thread names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust, sqlite
- Domain
- databases, desktop, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100