You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doctor: rollout DB / state DB parity warnings accumulate (231 missing active rows, 179 stale rows, 45 duplicate thread ids) #55933
CLIIssues related to the Codex CLIbugSomething isn't workingsessionIssues involving session (thread) management, resuming, forking, naming, archivingwindows-osIssues related to Codex on Windows systems
codex doctor reports persistent state.rollout_db_parity warnings. The app itself works fine — thread histories are intact — but the state DB thread inventory and the rollout files on disk drift apart over time, and there is no built-in way to reconcile them.
Environment
OS: Windows 11 Professional 10.0.26300 (de-DE), 64-bit
Install context: desktop-managed binary (also codex.cmd shim via npm on PATH)
Doctor findings (state.rollout_db_parity)
rollout DB rows: 6072 (active files: 5349, archived files: 781)
231 missing active rows — rollout files on disk with no matching threads row
6 missing archived rows
179 stale rows — DB rows pointing at missing/unusable rollout files (note: stale paths use \\?\C:\… extended-length prefixes, which may contribute to the mismatch)
45 duplicate rollout thread ids (0 duplicate DB paths)
rollout DB sources: subagent:other=2994, subagent:thread_spawn=1849, vscode=1218, exec=10, cli=1
Threads whose rollout file no longer exists on disk still open and display correctly in the Desktop app, because migrated histories live in thread_history_1.sqlite. So at least part of the "stale rows" class appears to be a cosmetic index inconsistency rather than data loss — but doctor cannot distinguish that.
The mismatch counts grow with usage (heavy subagent/thread_spawn usage in this installation).
Manual attempts to clean state_5.sqlitethreads rows are risky: deleting rows for files that are "missing" also removes still-functional migrated threads. A supported repair path is needed.
Suggestion
Provide codex doctor --fix (or a dedicated reindex command) that reconciles state_5.sqlite against the rollout directory and thread_history_1.sqlite, deduplicates thread ids, and normalizes \\?\-prefixed paths.
Alternatively, document the intended lifecycle so the parity check can ignore legitimately-migrated threads.
One major source of the DB rows pointing at missing rollout files drift class on Linux/WSL2 is manual disk cleanup: because ~/.codex/sessions/ grows to tens of GBs (#41806, #34061), users delete old rollout-*.jsonl files by hand, which leaves orphaned rows in state_5.sqlite (threads, thread_dynamic_tools, thread_attachments, guardian_review_feedback, thread_read_receipts, thread_spawn_edges) and thread_history_1.sqlite (thread_items, thread_turns, thread_realtime_items, thread_history_projection_state).
Two details we found while building deterministic reconciliation for this:
thread_history_1.sqlite has an AFTER DELETE ON thread_history_projection_state trigger (thread_realtime_items_projection_cleanup), and state_5.sqlite has threads.attached_thread_parent_id self-references that must be nulled before deleting expired parent thread rows.
Deleting the orphaned rows alone does not reclaim the multi-GB disk footprint of thread_history_1.sqlite or state_5.sqlite until VACUUM runs while neither the .sqlite file nor its -wal/-shm sidecars are held open in /proc/*/fd.
CLIIssues related to the Codex CLIbugSomething isn't workingsessionIssues involving session (thread) management, resuming, forking, naming, archivingwindows-osIssues related to Codex on Windows systems
Activity
github-actions commentedon Oct 21, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
\\?\index paths #55536Powered by Codex Action
simfor99 commentedon Nov 3, 2026
One major source of the
DB rows pointing at missing rollout filesdrift class on Linux/WSL2 is manual disk cleanup: because~/.codex/sessions/grows to tens of GBs (#41806, #34061), users delete oldrollout-*.jsonlfiles by hand, which leaves orphaned rows instate_5.sqlite(threads,thread_dynamic_tools,thread_attachments,guardian_review_feedback,thread_read_receipts,thread_spawn_edges) andthread_history_1.sqlite(thread_items,thread_turns,thread_realtime_items,thread_history_projection_state).Two details we found while building deterministic reconciliation for this:
thread_history_1.sqlitehas anAFTER DELETE ON thread_history_projection_statetrigger (thread_realtime_items_projection_cleanup), andstate_5.sqlitehasthreads.attached_thread_parent_idself-references that must be nulled before deleting expired parent thread rows.thread_history_1.sqliteorstate_5.sqliteuntilVACUUMruns while neither the.sqlitefile nor its-wal/-shmsidecars are held open in/proc/*/fd.We open-sourced our implementation that keeps
~/.codex/sessions/and both SQLite databases in sync (with--dry-rundefault,/proc/*/fdactive-file checks, fail-closedis_pinned = 1protection, and free-space-checkedVACUUM): https://github.com/simfor99/codex-hdd-guard