[Bug] Paginated thread history projection stops at a token_count record
What version of the Codex App are you using (From “About Codex” dialog)?
Bundled runtime: codex-cli 0.145.0 (desktop build not included), 0.149.0 same
What subscription do you have?
Not disclosed for privacy
What platform is your computer?
Linux x86_64 (host and kernel identifiers omitted)
What issue are you seeing?
Several completed local chats display only the initial user message and the assistant's first progress update. Later tool activity, turns, and final answers are missing from the conversation pane even though the durable rollout still contains the complete transcript.
The failure occurs while materializing paginated thread history. The projection stops at an early token_count record and does not process later rollout records.
Sanitized errors:
invalid type: map, expected f64
thread history projection expected ordinal 17, got 18
failed to project durable rollout during shutdown
What steps can reproduce the bug?
- Use Codex App with the bundled codex-cli 0.145.0 runtime and paginated thread history.
- Run a local task that emits a token_count event containing structured rate-limit data.
- Allow the task to continue through later turns and produce a final answer.
- Close and reopen the chat.
- Observe that the conversation pane contains only the messages before the rejected token_count event.
In the observed cases, restarting the app retries projection but does not repair the incomplete history.
What is the expected behavior?
The complete conversation, including later turns and final answers, should be reconstructed from the durable rollout and displayed after reopening the chat.
Additional information
History mode: paginated.
The projection cursor remains at ordinal 17. The next record is skipped, producing the subsequent ordinal-gap error.
The durable session data remains present; this appears to be a history-index/projection failure rather than transcript deletion.
The same failure pattern was observed in multiple local chats.
Privacy: No transcript, prompt, screenshot, filesystem path, account identifier, task/thread/session ID, repository name, hostname, raw log, token usage value, or private project information is attached or included.
13 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional reproduction evidence from the same failure family:
26.818.618090.149.1A local diagnostic mitigation forced unknown-conversation recovery to call full paginated hydration (
hydrateBackgroundThreads([threadId], { includeTurns: true })) before replaying deferred live notifications. The patched bundle was installed, its marker verified, and the app-server restarted. Mobile still displayed the truncated transcript.This narrows the remaining failure below a renderer-only unknown-conversation recovery path: likely the remote
thread/readhistory projection/index or the data returned to Remote clients. In affected tasks, a read can reporthasMore: falsewhile returning only the first visible turn even though the durable rollout has many later completed turns.This also overlaps the visible symptom in #39011 (completed messages disappearing after steered follow-ups), though the durable projection failure here persists across reconnect/restart and devices.
Confirmed local recovery and narrowed the invariant failure further.
For two affected tasks,
thread_history_projection_stateshowed:next_rollout_ordinal = 18next_rollout_byte_offsetexactly equaled the end byte offset of rollout ordinal 18So the projector had consumed ordinal 18's bytes without advancing its ordinal checkpoint. Every subsequent append then failed with
expected ordinal 18, got 19; 0 rejected rollout lines cannot cover that gap.Transactionally advancing only
next_rollout_ordinalby one, with the database backed up and rollout JSONL untouched, immediately restored an inactive task: its projection advanced from one visible turn/four items to the complete history.The active task exposed a second restart-related invariant failure: duplicate ordinals were written around service restarts, initially
token_countplusthread_settings_appliedsharing ordinals 149 and 743. After backing up the rollout and removing only the duplicatetoken_countrecords, projection advanced to ordinal 1053 and restored 25 turns/339 items. A later restart produced another duplicate ordinal 1052. Advancing only the byte checkpoint past the already-accounted duplicate, while retainingnext_rollout_ordinal = 1053, resumed projection normally; it advanced to ordinal 1087 with 26 turns/350 items.This confirms two related correctness issues:
Suggested regression coverage:
token_countline;All repairs were performed against backed-up local state. No transcript content was deleted or reconstructed.
need fix
Independent sanitized confirmation from another Codex Desktop environment.
Environment
0.146.0-alpha.3.1history_mode=paginatedObserved behavior
For a completed affected thread:
interruptedturn and reports no additional page;task_complete;inProgressturn and four projected items;token_countrecord with ordinal N, whilenext_rollout_ordinalremains N;The recurring sanitized log signatures are:
Restart and shutdown retries did not reconcile the projection.
Aggregate scope
A read-only scan of the 14 most recent user-created paginated threads in this environment found the same boundary in 14 of 14 cases:
token_countrecord;inProgressturn;task_complete.This confirms a repeatable projection/index failure rather than transcript deletion or renderer-only state.
A supported repair or automatic re-projection path for already-wedged threads would be valuable, in addition to preventing the byte and ordinal checkpoints from diverging.
Privacy note: this report intentionally excludes prompts, transcript text, screenshots, task or thread identifiers, project and filesystem names, host information, account details, credentials, raw logs, and database files.
I can confirm that I am experiencing the same issue in Codex Desktop
connected to a remote Ubuntu 24.04 host running codex-cli 0.145.0.
Additional evidence from read-only diagnostics on this host:
invalid type: map, expected f64This suggests that the issue affects paginated history materialization,
rather than being caused by transcript deletion or SQLite corruption.
Seeing this as well, pretty significant user experience issue
Independent reproduction on 2026-08-26 that closely matches this issue and extends it to ChatGPT iOS Remote:
codex_chatgpt_ios_remotecodex-cli 0.145.0response_itemassistant message with phasefinal_answer, immediately followed bytask_complete.read_threadreconstruction reports that same turn asinProgressand stops after the commentary item; it omits the later final answer and completion.token_countrecord occurs at the cutoff boundary and contains structuredrate_limitsdata (including primary, secondary, and credits objects), matching the projection-failure pattern described here.This is therefore not model-output loss: the completed response remains in the host rollout, while the reconstructed/mobile history is truncated before the token-count boundary.
The private thread ID, screenshots, and exact transcript timestamps are available through OpenAI Support if maintainers need them.
I can independently reproduce what appears to be the same paginated thread-history projection bug on two separate new threads.
2 independent new paginated threads affected
Thread 1:
next_rollout_ordinal = 15
next_rollout_byte_offset = 119292
record at byte offset = ordinal 16
Thread 2:
next_rollout_ordinal = 14
next_rollout_byte_offset = 125677
record at byte offset = ordinal 15
raw rollout = intact
state metadata = intact
SQLite integrity_check = ok
projection = permanently stalled
Codex CLI/app-server = 0.146.0
Both affected threads remain present in the raw rollout/state metadata, but disappear or become incomplete in the Codex App history UI after reload.
No database repair, reindex, cleanup, or manual modification has been performed.
I can provide additional timestamps or metadata if useful.
Additional Windows ChatGPT Work reproduction, cross-referenced as #40907:
Thinkingstate, consistent with a completion/later-turn record not being projected.The user has not modified local rollout files or SQLite state. Exact runtime/build and private thread diagnostics are not yet available.
Based on the symptoms and the evidence already collected in this issue, the leading hypothesis is the same byte-offset / ordinal checkpoint divergence at a structured
token_countrecord: the durable rollout may contain the later turns while the paginated projection remains permanently stalled.Please correlate #40907 with this issue and check the affected Windows Work thread for
history_mode=paginated, records after the visible cutoff,thread_history_projection_stateconsistency, and the knowninvalid type: map, expected f64/ ordinal-gap signatures. A privacy-scrubbed screenshot is available.I can reproduce the same class of paginated-history failure on Windows Codex Desktop.
Environment:
I have two affected local threads. I am omitting thread IDs, paths, and transcript contents for privacy.
Case A:
Case B:
Both state_5.sqlite and thread_history_1.sqlite pass SQLite quick_check. The rollout files and authoritative thread rows are still present; this appears to be a stale or wedged thread-history projection rather than transcript deletion.
Expected behavior:
I have not modified the databases. Could you confirm whether these cases belong to the same projection bug tracked here, and whether there is a supported repair path for already-wedged projections?
I can confirm this issue on a remote Linux app-server used from Codex Desktop on macOS over SSH, with a larger blast radius and a successful recovery path.
Environment
codex-cli 0.145.0codex-cli 0.150.1paginatedSymptoms
Forking is not available for threads using paginated history yet.Projection evidence
This was not isolated to one thread:
thread_history_1.sqlitecontained only 17 turns total: exactly one projected turn per affected thread.invalid type: map, expected f64thread history projection expected ordinal N, got N+1This matches the token-count/schema failure described in the issue: after rejecting the structured value, the cursor never advanced, and all subsequent records became unreachable through paginated history.
Version-skew detail
Upgrading the npm CLI alone did not replace the running server. Immediately after the upgrade:
The old
0.145.0app-server was an unmanaged persistent process holding the control socket.codex app-server daemon restartcorrectly refused with:app server is running but is not managed by codex app-server daemonAfter terminating the old unmanaged instance and bootstrapping the managed daemon, both versions reported
0.150.1.Recovery that restored all affected threads
thread_history_1.sqliteplus its WAL/SHM files aside (no rollout data was removed).0.150.1daemon.Suggested product improvements
thread_history_*.sqliteexplicitly as a rebuildable derived index and automatically retry/rebuild when the cursor is far behind a valid canonical rollout.cliVersion != appServerVersionand clearly warn or safely replace an unmanaged incompatible server.history doctor/rebuildcommand that scans all affected paginated threads, rather than requiring a manual database move and lazy reopening of every thread.No private prompts, hostnames, repository names, absolute paths, credentials, or thread IDs are included here.
Additional Windows reproduction with a clearer interruption/power-off trigger (2026-08-28).
Environment
codex-cli 0.150.0-alpha.8Trigger pattern
This has now occurred in two separate long local chats:
In the latest occurrence, the stale message said that a proof-of-concept was only about to begin, while the repository's durable Git state already contained the later completed and validated implementation. This confirms that the project data was not rolled back; the Desktop history/task projection was stale.
Expected behavior
After an interrupted turn followed by an unclean host shutdown, startup recovery should:
This looks consistent with the projection/restart invariant failures already documented in this issue, but adds a repeatable user-level trigger: interrupt an active command, then shut down before the turn fully settles.
No session IDs, project names, paths, transcript text, screenshots, credentials, rollout files, or database contents are included. Local rollout/database state was not modified.