Thread store resolves stale session_index entries to missing rollout files (state db returned stale rollout path)
Summary
The local session index (~/.codex/session_index.jsonl) retains entries whose rollout
JSONL no longer exists in either the live sessions tree or archived_sessions/. When the
app/thread store resolves such a thread id, it returns a path to a missing file and errors
instead of falling back to the archived copy or self-healing the index. On a
long-lived, high-session-volume host this accumulates: 113 of 283 indexed entries (40%)
had no backing rollout file anywhere.
Evidence
Codex's own log reports the inconsistency from inside codex_rollout::list:
ERROR codex_rollout::list: state db returned stale rollout path for thread
019f2339-9299-7e51-b192-9751a0a03586:
/home/USER/.codex/sessions/2026/07/02/rollout-2026-07-02T14-26-43-019f2339-...jsonl
That file is not in live sessions/, not in archived_sessions/ (507 archived JSONLs
present), and not found by a recursive basename search.
Audit of the index on the affected host:
index entries: 283 | present (live or archived): 170 | STALE (no backing file): 113
A second, related failure mode also seen: a rollout file that exists but is misfiled —
stored under sessions/2026/05/09/ while its contents begin with 2026-07-03 data and do
not start with a session_meta record. So the index/path bookkeeping and the on-disk
partitioning can disagree in both directions (missing file; misplaced/malformed file).
How it likely arises
The index write and the rollout file lifecycle (create / archive-move / delete) are not
crash-consistent. If the process is interrupted between updating the index and finalizing
the file — e.g. an ENOSPC disk-full (our trigger: root fs hit 100%), a SIGKILL, or an
archival move that half-completes — the index keeps an entry the filesystem can't satisfy.
Nothing later reconciles it.
Impact
- App/thread resolution errors when opening or listing affected threads.
- Users cannot cleanly resume or reference historical sessions that are actually still
recoverable from durable artifacts.
- Grows unbounded on active hosts; 40% stale observed.
Expected behavior (any of)
- On resolve-miss, fall back to
archived_sessions/(and a basename search) before erroring. - Self-heal the index: drop or flag entries whose rollout file is absent from both live
and archived locations, rather than repeatedly resolving to a dead path.
- Make the index update + rollout finalize crash-consistent (write file first / fsync +
atomic rename, update index only after), so an interrupted write can't orphan an entry.
- Provide a
codexsubcommand to verify/repair the session index.
Workaround in use
Local reconciliation script: back up session_index.jsonl, drop entries with no backing
rollout file in live or archived sessions (never deletes rollout files). Mitigates the
resolve error until a first-class fix lands.
Related issues (adjacent but distinct)
Several open issues touch "stale rollout path," but each is tied to a specific Desktop UI
flow rather than the crash/interruption-consistency root cause and the systemic 40%
accumulation reported here (observed via codex-cli / app-server, not a UI action):
- #26201 / #26174 — stale archived rollout path after archive/unarchive
- #30924 — "failed to resolve rollout path" on new conversations (Windows Desktop)
- #23991 — delete leaves session-index residue
- #21663 — missing rollout path → macOS SIGABRT
This report is about the index and rollout-file lifecycle becoming inconsistent when a
write is interrupted (ENOSPC / SIGKILL / half-completed archival move), independent of
any UI flow, and the index then never self-reconciling. Please link/dedupe as appropriate.
Environment
- codex-cli 0.142.5, Linux (Ubuntu 22.04), standalone install
~/.codexon local disk; hundreds of live + 507 archived sessions- Trigger correlated with a root-filesystem ENOSPC event (0 bytes free) during an archival burst
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
版本 26.623.141536 • 发布于 2026年7月7日
no rollout found for thread id
Additional macOS evidence showing a one-for-one state transition after a legacy filesystem-level archive move:
0.143.00.144.0-alpha.4OKBefore and after
codex doctor --jsoncounts changed exactly with the moved set:This supports the report's hypothesis that filesystem-level archival can leave both sides of the inventory inconsistent: the preserved archived rollout is unindexed, while the DB row remains at the old active path.
No manual SQLite repair or speculative filesystem rollback has been attempted. The archive workflow is paused pending a supported recovery path.
Could Codex expose a previewable reconcile/reindex command that:
codex doctor --json.A full redacted Doctor report can be provided privately if useful.
Windows Desktop confirmation, with a newer app package.
OpenAI.Codex_26.814.5167.0_x64Observed behavior:
thread not foundand it cannot be continued.Exact archive error:
One affected thread ID:
01a013b2-9800-75d0-ae83-35e9dbc50a8eThe task record is still readable through the local task listing, and its workspace directory still exists. I have not performed a filesystem or SQLite audit, so I cannot confirm that this is the same missing-rollout mechanism as the original report; it is a symptom-level match. I have deliberately not reset the app, cleared
.codex, or deleted the workspace, to avoid making recoverable local history less recoverable.A safe, previewable reconcile/reindex tool or an option to remove an orphaned sidebar entry would be especially useful here.
This index-vs-filesystem drift (
session_index.jsonlpointing to non-existent or relocated rollouts after interrupted writes/ENOSPC) is specifically what Codex Rescue models in its inventory discovery. It treats the filesystem as truth, identifies DB-only orphaned pointers without touching them in-place, and correlates misfiled session dates.You can inspect the entire session inventory and check divergence diagnostics using the read-only Alpha6 release on npm:
It runs completely locally without network calls or modifying your sessions. If you try it, sharing the sanitized finding codes or inventory discrepancy counts would be very helpful.