Skip to content

Codex history list can become completely empty, Codex

Quick fix

Keeping sqlite_home and migrating the provider bucket in the active SQLite database can restore visible Codex history.

Error output
After enabling **统一 Codex 会话历史** for Codex, the Codex history list can become completely empty, even though all session files still exist.
English translation

After enabling **Unified Codex session history** for Codex, the Codex history list can become completely empty, even though all session files still exist.

In this Windows report, Codex's active database was `%USERPROFILE%\.codex\sqlite\state_5.sqlite`, rather than the root `state_5.sqlite`. After unified session history is enabled, `config.toml` uses `model_provider = "custom"`; if history in the active database is still in the `openai` bucket, Codex displays only `custom` history, making the history appear empty even though `.jsonl` files were not deleted.

The verified workaround in the original post was to keep `sqlite_home` and migrate the active database. Comments also reported a variant marked as migrated but with `migratedStateRows = 0`, plus multi-database scanning and a repair tool proposed in PR #4292; the issue remains open, with no merged official automatic recovery solution.

  1. Keep `sqlite_home` at the top level of Codex's `config.toml`, pointing to the active SQLite directory.

    %USERPROFILE%\.codex\config.toml
    sqlite_home = 'C:\\Users\\<USER>\\.codex\\sqlite'
  2. Also keep the same `sqlite_home` in CC Switch's saved Codex provider templates or common Codex config, so provider switching does not overwrite and remove it.

  3. After enabling “Unified Codex session history,” choose to migrate existing official history and confirm that history in the active SQLite database was migrated to the `custom` provider bucket.

ToolCodex
Version受影响:26.609.x
PlatformsWindows
When migration shows `migratedStateRows = 0`, should `codex-history-tool repair --apply` be run after #4292, or should CC Switch automatically rerun migration?
The original post only raised this recovery-path question and gave no confirmed conclusion; comments said PR #4292 provides diagnostic and repair tooling plus improved active-database discovery, but the issue remains open.
Can the built-in `openai` provider be overridden in `config.toml` to retain the OpenAI history bucket?
No. The report states that current Codex rejects overriding the reserved built-in `openai` provider id.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.