Conversation history is not saved

Open 💬 2 comments Opened Jul 5, 2026 by zyyxyd-crypto

What version of Codex CLI is running?

1.2.31

What subscription do you have?

api

Which model were you using?

deepseek

What platform is your computer?

_No response_

What terminal emulator and version are you using (if applicable)?

_No response_

Codex doctor report

What issue are you seeing?

好的,以下是整理好的 Bug Report,可以直接复制粘贴:

---

Title: Threads disappear after app restart — state_5.sqlite threads table is empty (data loss)

Environment:

  • OS: Windows (Chinese locale)
  • Codex Desktop App
  • Date observed: 2026-07-05

Symptoms:

  1. When I restart the Codex desktop app, the thread list briefly appears in the sidebar for a split second, then flashes and disappears completely.
  2. All 18 previous threads are gone — only "New Chat" remains available.
  3. This persists across multiple restarts.

Root Cause (from local investigation):

  • %USERPROFILE%\.codex\sqlite\state_5.sqlitethreads table has 0 rows
  • %USERPROFILE%\.codex\sqlite\codex-dev.dblocal_thread_catalog has only 2 rows (both workspace-local threads, not projectless ones)
  • %USERPROFILE%\.codex\backups_state\...\.codex-global-state.jsonprojectless-thread-ids still contains 18 thread IDs, confirming the threads existed before the wipe
  • The backup under backups_state\provider-sync\... was taken after the wipe — its state_5.sqlite also has 0 threads
  • Session rollout .jsonl files under sessions\ still exist on disk, but their rollout IDs don't map to thread IDs in the database

Hypothesis:
A database migration or sync operation wiped the threads table in state_5.sqlite, but the global state JSON (projectless-thread-ids) was not cleaned up in sync. This causes the UI to briefly render the stale thread list from the JSON index, then clear it when the actual database query returns empty.

Impact:
All thread history is locally unrecoverable. The session JSONL files contain raw conversation data but can't be reassociated with threads.

What steps can reproduce the bug?

重启应用就没有对话

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗