codex - 💡(How to fix) Fix Desktop project sidebar hides active threads after state DB migration drift and stale temporary sessions [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#17304Fetched 2026-04-11 06:18:11
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
cross-referenced ×3labeled ×2commented ×1renamed ×1

After a Codex Desktop update, project-grouped sidebar threads disappeared even though the sessions were still present locally. Switching the sidebar to chronological view showed many untitled sessions, but project grouping only showed a few active threads and some projects appeared empty.

I recovered the local state and wanted to share the investigation because the failure mode looks like a combination of state DB migration metadata drift and thread/list including stale temporary sessions.

Root Cause

I recovered the local state and wanted to share the investigation because the failure mode looks like a combination of state DB migration metadata drift and thread/list including stale temporary sessions.

Code Example

migration 21 was previously applied but is missing in the resolved migrations

---

{"method":"thread/archive","params":{"threadId":"..."}}
RAW_BUFFERClick to expand / collapse

Summary

After a Codex Desktop update, project-grouped sidebar threads disappeared even though the sessions were still present locally. Switching the sidebar to chronological view showed many untitled sessions, but project grouping only showed a few active threads and some projects appeared empty.

I recovered the local state and wanted to share the investigation because the failure mode looks like a combination of state DB migration metadata drift and thread/list including stale temporary sessions.

Symptoms

  • Codex Desktop project sidebar stopped showing active, unarchived historical threads for project roots.
  • Chronological view still showed many sessions, often untitled.
  • Several temporary derived sessions were taking priority over root-project sessions.
  • Logs repeatedly contained:
migration 21 was previously applied but is missing in the resolved migrations
  • The same period also had intermittent reconnect / child-process timeout symptoms, though I cannot prove they share one direct cause.

Local root causes found

  1. ~/.codex/state_5.sqlite schema had already advanced past migration 20:

    • The migration-21 table already existed.
    • The migration-22 schema change already existed.
    • The old log tables had already been dropped.
  2. _sqlx_migrations only recorded migrations through version 20.

  3. A backup DB still had correct migration metadata for versions 21-23.

  4. Restoring the missing migration metadata rows stopped the migration-21 warning on new app-server startup.

  5. The sidebar source of truth was not just SQLite threads.archived. Codex Desktop’s app-server thread/list(archived=false) still returned some temporary sessions even after SQLite rows were manually marked archived. Those entries disappeared only after calling the official RPC:

{"method":"thread/archive","params":{"threadId":"..."}}
  1. After archiving leaked temporary sessions through app-server, project-root threads reappeared in the project sidebar after restarting Codex Desktop.

  2. One duplicate-thread case was a real duplicate binding: two thread IDs pointed to the same rollout JSONL path. Keeping the real rollout ID and hiding the ghost binding resolved the duplicate entry.

Recovery flow that worked locally

  1. Back up ~/.codex/state_5.sqlite.
  2. Compare _sqlx_migrations against actual schema and a known-good backup DB.
  3. Restore missing migration rows 21-23 from the backup metadata.
  4. Start a fresh codex app-server and verify the migration-21 warning is gone.
  5. Use app-server thread/list(archived=false) to enumerate the actual sidebar-visible active list.
  6. Filter out temporary session roots that should not appear under project grouping.
  7. Archive those leaked temporary sessions via thread/archive, not by only updating SQLite.
  8. Use thread/name/set for any recovered active threads that still have missing titles.
  9. Check duplicate rollout_path rows in SQLite and resolve any ghost binding carefully.
  10. Restart Codex Desktop and verify project sidebar grouping.

Expected improvement

It would be helpful if Codex Desktop could either:

  • detect and repair migration metadata drift when the schema already matches a later migration,
  • avoid letting temporary sessions dominate project-grouped sidebar pagination,
  • expose a safer local state repair / reindex command for Desktop,
  • or ensure thread/list(archived=false) does not resurrect entries that SQLite already marks archived unless a full read-repair also reconciles archived state.

Related-looking issue found during search: #10917, but this case specifically involved _sqlx_migrations drift plus temporary-session leakage in thread/list.

extent analysis

TL;DR

To resolve the issue with missing project-grouped sidebar threads in Codex Desktop, restore missing migration metadata rows and archive leaked temporary sessions via the app-server.

Guidance

  • Verify the _sqlx_migrations table against the actual schema and a known-good backup DB to identify missing migration rows.
  • Restore missing migration rows 21-23 from the backup metadata to resolve the migration-21 warning.
  • Use the app-server thread/list(archived=false) to enumerate the actual sidebar-visible active list and filter out temporary session roots that should not appear under project grouping.
  • Archive leaked temporary sessions via thread/archive to ensure they do not dominate project-grouped sidebar pagination.

Example

{"method":"thread/archive","params":{"threadId":"..."}}

This RPC call can be used to archive leaked temporary sessions.

Notes

The issue is likely caused by a combination of state DB migration metadata drift and temporary-session leakage in thread/list. The provided recovery flow has been tested locally and resolved the issue.

Recommendation

Apply the workaround by restoring missing migration metadata rows and archiving leaked temporary sessions via the app-server, as this approach has been proven to resolve the issue locally.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING