codex - 💡(How to fix) Fix Codex Desktop: chats disappear after update/import; imported threads open blank despite JSONL turns [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20493Fetched 2026-05-01 05:42:36
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
1
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

After updating Codex Desktop and using the Imported agent setup flow, existing local chats appeared to disappear from the Desktop sidebar. The transcript JSONL files were still present on disk and could be recovered manually, but the Desktop app no longer surfaced them normally. Some imported/external chats also open to a blank-looking chat view from codex://threads/<id> even though the app-server can parse the transcript when turns are explicitly requested.

This presents to the user as data loss, even if the raw transcripts still exist.

Related/similar issues I found before filing:

  • #18364
  • #17540
  • #19345
  • #19615
  • #19873
  • #20419
  • #14370

Root Cause

After updating Codex Desktop and using the Imported agent setup flow, existing local chats appeared to disappear from the Desktop sidebar. The transcript JSONL files were still present on disk and could be recovered manually, but the Desktop app no longer surfaced them normally. Some imported/external chats also open to a blank-looking chat view from codex://threads/<id> even though the app-server can parse the transcript when turns are explicitly requested.

This presents to the user as data loss, even if the raw transcripts still exist.

Related/similar issues I found before filing:

  • #18364
  • #17540
  • #19345
  • #19615
  • #19873
  • #20419
  • #14370

Fix Action

Fix / Workaround

Local workaround used

RAW_BUFFERClick to expand / collapse

Summary

After updating Codex Desktop and using the Imported agent setup flow, existing local chats appeared to disappear from the Desktop sidebar. The transcript JSONL files were still present on disk and could be recovered manually, but the Desktop app no longer surfaced them normally. Some imported/external chats also open to a blank-looking chat view from codex://threads/<id> even though the app-server can parse the transcript when turns are explicitly requested.

This presents to the user as data loss, even if the raw transcripts still exist.

Related/similar issues I found before filing:

  • #18364
  • #17540
  • #19345
  • #19615
  • #19873
  • #20419
  • #14370

Environment

  • Codex CLI/Desktop bundle: codex-cli 0.128.0-alpha.1
  • macOS: 26.4.1 25E253
  • Architecture: arm64
  • Codex Desktop source: installed app bundle at /Applications/Codex.app

What happened

  1. Updated Codex Desktop.
  2. Used the app's "Imported agent setup" flow.
  3. After that, older chats were no longer visible in the Desktop sidebar.
  4. Restarting Codex Desktop did not restore them.
  5. Rebuilding session_index.jsonl and project/root state made the CLI able to browse/resume sessions, but Desktop still did not reliably display/open imported chats.
  6. A generated local page with codex://threads/<id> links could navigate into Codex, but the opened chat view was blank for imported chats.

Evidence

The old transcript files still existed under ~/.codex/sessions/..., so the user data was not fully gone from disk.

However, ~/.codex/state_5.sqlite was corrupt immediately after the issue:

  • file ~/.codex/state_5.sqlite reported generic data, not SQLite.
  • App logs contained errors such as:
    • failed to initialize sqlite state db: file is not a database
    • sqlite state db unavailable for thread ...

After moving the corrupt DB aside, Codex rebuilt a valid SQLite DB. The rebuilt DB currently contains:

  • 210 total threads
  • 200 unarchived threads
  • 113 threads with source vscode

The import registry exists and shows external sessions were imported:

  • ~/.codex/external_agent_session_imports.json
  • Contains 72 imported external session records.

Example imported thread:

  • Thread id: 019ddfce-b73e-7230-ae24-a70b89c76982
  • Transcript path shape: ~/.codex/sessions/2026/05/01/rollout-...-019ddfce-b73e-7230-ae24-a70b89c76982.jsonl
  • thread/read without includeTurns:true returned metadata/preview but turns: [].
  • thread/read with includeTurns:true returned the actual user and assistant messages.

Desktop logs around opening imported chats included:

  • Conversation state not found conversationId=...
  • followed by maybe_resume_success ... turnCount=1

Despite that, the Desktop UI appeared blank.

There was also repeated log noise for at least one imported thread with cwd /:

  • No cwd found for local task conversationId=019ddfce-17b1-7893-a39c-d66ace3561f6

Expected behavior

  • App updates and import flows should not make existing chats disappear from the Desktop sidebar.
  • If state_5.sqlite migration/open fails, Desktop should detect the corruption, preserve the DB, rebuild from JSONL, and show a visible recovery/warning state instead of looking like the user's chats are gone.
  • Imported external sessions should either render correctly in Desktop or be clearly labeled as imported/archive-only with a built-in viewer/export.
  • codex://threads/<id> should not navigate to a blank chat when the app-server can parse the transcript.

Actual behavior

  • Existing chats appeared deleted from the Desktop UI.
  • Imported threads could be indexed and listed, but opening them from Desktop/deep link could produce a blank chat.
  • Manual recovery was required to rebuild state and create a separate local viewer for the JSONL transcripts.

Local workaround used

  • Backed up and moved aside the corrupt state_5.sqlite.
  • Allowed Codex to rebuild a valid SQLite DB from local session files.
  • Built a separate local HTML viewer directly from the JSONL transcripts to make the recovered chats readable.

I can provide sanitized logs or additional command output if useful.

extent analysis

TL;DR

The most likely fix involves rebuilding the SQLite database and ensuring proper handling of imported chats in the Codex Desktop application.

Guidance

  • Verify that the state_5.sqlite database is not corrupt by checking its integrity and rebuilding it if necessary.
  • Check the import registry (~/.codex/external_agent_session_imports.json) to ensure that external sessions are properly imported and indexed.
  • Investigate the Desktop logs to identify any errors related to conversation state or chat rendering.
  • Consider implementing a recovery mechanism to handle database corruption and provide a visible warning state to the user.

Example

No specific code snippet is provided, but the issue suggests that the thread/read API call with includeTurns:true returns the actual user and assistant messages, which could be used to render the chat correctly.

Notes

The issue is specific to the Codex Desktop application and its interaction with imported chats and the SQLite database. The provided workaround involves rebuilding the database and creating a separate local viewer for the JSONL transcripts.

Recommendation

Apply a workaround to rebuild the SQLite database and ensure proper handling of imported chats, as the root cause of the issue is likely related to database corruption and chat rendering.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • App updates and import flows should not make existing chats disappear from the Desktop sidebar.
  • If state_5.sqlite migration/open fails, Desktop should detect the corruption, preserve the DB, rebuild from JSONL, and show a visible recovery/warning state instead of looking like the user's chats are gone.
  • Imported external sessions should either render correctly in Desktop or be clearly labeled as imported/archive-only with a built-in viewer/export.
  • codex://threads/<id> should not navigate to a blank chat when the app-server can parse the transcript.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop: chats disappear after update/import; imported threads open blank despite JSONL turns [1 comments, 2 participants]