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 reports duplicate archived rollout thread ID and missing DB row; no safe reconciliation command #55439
codex doctor reports an archived rollout missing from the state database and a duplicate rollout thread ID, although the SQLite database passes integrity checks. Two distinct archived rollout files share the same thread ID. There does not appear to be a documented, non-destructive reconciliation command.
Environment
Codex CLI: 0.163.0-alpha.10.2
macOS arm64 (doctor reports macOS 27.0.1)
Desktop app: 26.1013.40934
State database: ~/.codex/state_5.sqlite
Observed behavior
⚠ threads 2 issues - rollout files are missing from the state DB; duplicate thread inventory entries found
rollout DB missing archived rows 1
rollout DB duplicate rollout thread ids 1
rollout DB duplicate DB paths 0
Two different .jsonl.zst files in ~/.codex/archived_sessions/ contain the same primary thread ID in their filenames, with one also containing an additional UUID suffix. Both files exist, differ in SHA-256, and were backed up and verified. The threads table has only one row for that thread ID (archived=1), pointing to the file with the additional UUID suffix.
PRAGMA integrity_check; returns ok on the original state database and on the backup.
codex debug --help and codex debug app-server --help do not expose an inventory repair command.
Expected behavior
The archived rollout inventory should be consistent, or the CLI should provide a supported, non-destructive reconciliation workflow that preserves both histories.
Request
Is there a supported safe way to reconcile the duplicate archived rollout thread ID and missing archived DB row without deleting either rollout or editing SQLite directly?
I have intentionally omitted private paths, conversation contents, credentials, and full diagnostic logs. I can provide a redacted doctor report if needed.
I would avoid manually editing SQLite or deleting either archive: the report shows a healthy SQLite integrity check but an inventory/identity collision, and the two rollout files have different hashes.
A safe product-level resolution could be a supported reconciliation command with these properties:
Dry-run first: enumerate archive files and DB rows, showing duplicate thread IDs, candidate row-to-file matches, and unmatched files without changing anything.
Preserve ambiguous histories: if two distinct files share an ID, do not pick one silently or overwrite either. Require an explicit mapping or report that human resolution is needed.
Recoverable write path: create and verify a database backup, apply any approved row changes in one transaction, and keep both original rollout files unchanged.
Idempotent validation: rerunning the command should not create duplicate rows; afterward run SQLite integrity checks and verify that every indexed archive has a valid file association.
Redacted output: report counts and conflict classes by default, not conversation content or full local paths.
Until such a command exists, the safest guidance is to retain the verified backup and both files and ask maintainers for a supported recovery procedure rather than attempting direct DB edits.
Same pattern on Windows 11 (build 26300), standalone Codex CLI 0.166.0, Desktop 26.1027.3384.0. Two archived threads, both with source=vscode.
Doctor:
rollout DB missing archived rows 2
rollout DB duplicate rollout thread ids 2
rollout DB stale rows 0
For each thread, archived_sessions holds two files: rollout-<t1>-<id>.jsonl.zst and rollout-<t2>-<id>_<uuid>.jsonl.zst. The threads row (archived=1) points to the _<uuid> file, and doctor reports the plain-named file as the missing archived row.
Read-only comparison of line hashes, excluding each file's first session_meta record:
Thread
Plain file lines
_<uuid> file lines
Lines shared
Plain file ends → _<uuid> file starts
A
8,718
75,118
0
2026-09-23 23:40:53.486Z → 23:40:55.867Z
B
12
583
0
2026-10-22 01:09:08.849Z → 01:09:40.628Z
codex migrate-rollouts --thread <id> --verbose (without --apply) reports 2 already paginated for both threads, the same as in the original report.
So the plain-named file isn't a stray copy. It holds the start of the conversation, and the _<uuid> file picks up seconds after it ends. Removing or "deduplicating" the plain file would drop that history. It looks like the inventory check counts each page as a separate rollout instead of grouping <id> and <id>_<page> files under one thread.
Suggestion: treat <id> and <id>_<page> files as one thread when any page has a threads row, and flag a thread only when none of its pages does.
Both files and the state DB are untouched here. I can attach a redacted codex doctor --json report if that helps.
Same pattern on Windows, plus the client-visible consequence: thread/list returns one archived entry per rollout file
Adding a third data point, because the doctor counts here have a reproducible user-visible effect that the earlier reports only described as inventory warnings.
Environment
Windows 11 26200 (10.0.26200), OpenAI.Codex desktop 26.1103.3517.0
Bundled CLI: codex-cli 0.167.0-alpha.3.2
CODEX_HOME=C:/Users/LYQ/.codex, state DB state_5.sqlite
Doctor
threads 3 issues
- rollout files are missing from the state DB: measured "32 active, 4 archived"
- state DB rows point at missing or unusable rollout files: "15 stale rows"
- duplicate thread inventory entries: "9 duplicate rollout thread ids, 0 duplicate DB paths"
Same file layout as @Zombi3h3art's report: the threads row (archived=1) points at the _<uuid> file, and the plain-named root rollout has no row. Here the row for 01a0f6d6-c1c1-7910-a638-7fbdbe6d3dd3 points at ..._01a10c73-6c9d-7842-baef-be7d2037173c.jsonl.zst, i.e. a fork copy, not the thread's own rollout.
Client-visible consequence
thread/list with archived: true returns 9 rows for 5 distinct thread ids:
So one archived conversation (01a0f6d6) occupies four rows in the Archived Chats page, and 01a11914 two. Rows whose rollout file has no state DB row carry no usable metadata: the page shows the same conversation repeated, and part of the duplicates cannot be opened. In practice the user reported the conversation as "missing from Archived Chats" even though the archive files are intact, because the list is dominated by duplicates and one entry surface is broken.
Filter the data array by id; duplicates appear immediately. PRAGMA integrity_check on the same database returns ok.
Root cause as I read it
Forked rollouts copy the parent session_meta, so N archived files can carry the same session_meta.id. The archived listing enumerates rollout files and emits one entry per file, with the state DB supplying metadata only where a row exists. There is no dedupe by thread id and no rule preferring the row's selected rollout_path, so the same thread is listed once per archived file. Doctor is reporting exactly this as "missing archived rows" + "duplicate rollout thread ids".
Disclosure
I manually appended .zst to 17 archived rollout_path values in state_5.sqlite before collecting this evidence, because those rows pointed at .jsonl while only .jsonl.zst existed. The duplication described above predates and is unaffected by that edit; the four files without rows were already unindexed. No rollout files were modified or deleted.
What would fix it
A reconciliation path that (a) dedupes the archived listing by thread id and prefers the row's selected path, and (b) backfills rows for archived files that have none, instead of leaving them unindexed forever. A read-only codex doctor --fix --dry-run style command covering both would also make this diagnosable without manual SQLite work.
Activity
secheverrianogal-beep commentedon Oct 20, 2026
I would avoid manually editing SQLite or deleting either archive: the report shows a healthy SQLite integrity check but an inventory/identity collision, and the two rollout files have different hashes.
A safe product-level resolution could be a supported reconciliation command with these properties:
Until such a command exists, the safest guidance is to retain the verified backup and both files and ask maintainers for a supported recovery procedure rather than attempting direct DB edits.
Zombi3h3art commentedon Oct 30, 2026
Same pattern on Windows 11 (build 26300), standalone Codex CLI 0.166.0, Desktop 26.1027.3384.0. Two archived threads, both with
source=vscode.Doctor:
For each thread,
archived_sessionsholds two files:rollout-<t1>-<id>.jsonl.zstandrollout-<t2>-<id>_<uuid>.jsonl.zst. Thethreadsrow (archived=1) points to the_<uuid>file, and doctor reports the plain-named file as the missing archived row.Read-only comparison of line hashes, excluding each file's first
session_metarecord:_<uuid>file lines_<uuid>file startscodex migrate-rollouts --thread <id> --verbose(without--apply) reports2 already paginatedfor both threads, the same as in the original report.So the plain-named file isn't a stray copy. It holds the start of the conversation, and the
_<uuid>file picks up seconds after it ends. Removing or "deduplicating" the plain file would drop that history. It looks like the inventory check counts each page as a separate rollout instead of grouping<id>and<id>_<page>files under one thread.Suggestion: treat
<id>and<id>_<page>files as one thread when any page has athreadsrow, and flag a thread only when none of its pages does.Both files and the state DB are untouched here. I can attach a redacted
codex doctor --jsonreport if that helps.mapleleo-hub commentedon Nov 7, 2026
Same pattern on Windows, plus the client-visible consequence:
thread/listreturns one archived entry per rollout fileAdding a third data point, because the doctor counts here have a reproducible user-visible effect that the earlier reports only described as inventory warnings.
Environment
26.1103.3517.0codex-cli 0.167.0-alpha.3.2CODEX_HOME=C:/Users/LYQ/.codex, state DBstate_5.sqliteDoctor
The 4 missing archived files:
Same file layout as @Zombi3h3art's report: the
threadsrow (archived=1) points at the_<uuid>file, and the plain-named root rollout has no row. Here the row for01a0f6d6-c1c1-7910-a638-7fbdbe6d3dd3points at..._01a10c73-6c9d-7842-baef-be7d2037173c.jsonl.zst, i.e. a fork copy, not the thread's own rollout.Client-visible consequence
thread/listwitharchived: truereturns 9 rows for 5 distinct thread ids:So one archived conversation (
01a0f6d6) occupies four rows in the Archived Chats page, and01a11914two. Rows whose rollout file has no state DB row carry no usable metadata: the page shows the same conversation repeated, and part of the duplicates cannot be opened. In practice the user reported the conversation as "missing from Archived Chats" even though the archive files are intact, because the list is dominated by duplicates and one entry surface is broken.Reproduction without the desktop UI:
Filter the
dataarray byid; duplicates appear immediately.PRAGMA integrity_checkon the same database returnsok.Root cause as I read it
Forked rollouts copy the parent
session_meta, so N archived files can carry the samesession_meta.id. The archived listing enumerates rollout files and emits one entry per file, with the state DB supplying metadata only where a row exists. There is no dedupe by thread id and no rule preferring the row's selectedrollout_path, so the same thread is listed once per archived file. Doctor is reporting exactly this as "missing archived rows" + "duplicate rollout thread ids".Disclosure
I manually appended
.zstto 17 archivedrollout_pathvalues instate_5.sqlitebefore collecting this evidence, because those rows pointed at.jsonlwhile only.jsonl.zstexisted. The duplication described above predates and is unaffected by that edit; the four files without rows were already unindexed. No rollout files were modified or deleted.What would fix it
A reconciliation path that (a) dedupes the archived listing by thread id and prefers the row's selected path, and (b) backfills rows for archived files that have none, instead of leaving them unindexed forever. A read-only
codex doctor --fix --dry-runstyle command covering both would also make this diagnosable without manual SQLite work.