Repository navigation
Codex App session list can hide sessions whose first user message is an empty diff-comment wrapper #24077
Description
What version of the Codex App are you using (From "About Codex" dialog)?
0.133.0
What subscription do you have?
Pro
What platform is your computer?
Linux 6.17.0-22-generic x86_64 x86_64
What issue are you seeing?
A persisted Codex App session can disappear from the normal session list even though the rollout JSONL and the SQLite state DB row both exist.
In my local case, the session had:
source = vscodethread_source = userarchived = 0model_provider = openai- a matching
cwd - non-empty
title/previewin the state DB
However, a normal thread/list call returned no rows for the same filters. The same request returned the session when useStateDbOnly was set to true.
The root cause appears to be the interaction between Codex App's diff-comment wrapper and the filesystem-backed thread/list path:
- The first
event_msguser message in the rollout was generated from a diff comment wrapper. - The wrapper included
## My request for Codex:, but there was no content after that marker. rollout/src/list.rsstrips everything beforeUSER_MESSAGE_BEGINwhen extracting the preview.- Because the marker tail was empty, the first user message produced no preview.
- The next actual user message was much later in the rollout, beyond
HEAD_RECORD_LIMIT + USER_EVENT_SCAN_LIMIT. - The normal metadata-filtered
thread/listpath returned the filesystem scan page, where the session did not satisfysummary.preview.is_some(), even though the state DB had a usable title/preview.
What steps can reproduce the bug?
One way to reproduce is to create or capture a Codex App session whose first persisted user message is a diff-comment wrapper like this:
# Diff comments:
## Comment 1
File: /path/to/file
Side: R
Lines: 123
Comment:
some review comment
## My request for Codex:
Then continue the session normally so a later user message has real text, but appears far enough into the rollout that read_head_summary does not scan it.
After the session is persisted:
- Verify the rollout JSONL exists under
~/.codex/sessions/.... - Verify the row exists in the state DB with a non-empty title/preview.
- Call
thread/listwith normal metadata filters, for example sourcevscode, provideropenai,archived=false, and the matchingcwd. - Observe that the session is not returned.
- Repeat the same
thread/listrequest withuseStateDbOnly=true. - Observe that the session is returned.
In my local probe, the normal response was:
{"data":[],"nextCursor":null,"backwardsCursor":null}With useStateDbOnly=true, the same session was returned from the state DB.
What is the expected behavior?
The session should appear in the normal session list when it has valid persisted metadata in the state DB, or the preview extractor should find a later non-empty user message instead of treating the empty wrapper tail as the only displayable user input.
More generally, a Codex App-generated diff-comment wrapper with an empty ## My request for Codex: tail should not make an otherwise valid user session undiscoverable.
Additional information
The relevant code paths appear to be:
rollout/src/list.rs:read_head_summary,event_msg_preview, andstrip_user_message_prefixrollout/src/recorder.rs: metadata-filteredlist_threads_with_db_fallbackthread-store/src/local/list_threads.rs: normal list path vs.useStateDbOnly
The surprising part is that the DB path knows about the session, but the normal filtered listing still returns the filesystem scan page and drops the DB-only hit.
Activity
github-actions commentedon May 22, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
winoros commentedon May 22, 2026
ok, seems that they are the same issue.
GabbeV commentedon Jun 5, 2026
I also hit this when my first message was a pasted file with no further text. Used ChatGPT to narrow down the work around to editing the session rollout file manually by adding a period to the end of the first message. After that the chat once again show up in codex ui and cli.
diegobonacolsi commentedon Jul 7, 2026
This helped a lot, thanks.
Below is my conclusion drafted with Codex itself.
Root cause: the normal
thread/listfilesystem scan skipped sessions whose rollout started with an empty## My request for Codex:wrapper. The threads were still present in SQLite,thread/readandcodex resumeworked, andthread/listwithuseStateDbOnly: truereturned them correctly.Workaround: after backing up the rollout JSONL, I changed the empty wrapper to
## My request for Codex:.(added a single period). Both missing threads immediately reappeared in the Codex UI.This seems most likely when a new thread starts from pasted/attached context without an actual text instruction in the first message.
wminos commentedon Oct 8, 2026
This comment was prepared by Codex based on an investigation of my local setup. If it turns out to be unrelated to this issue, I’ll delete it.
I connect remotely to Codex running on my Mac from a Windows PC, an Android phone, an Android tablet, and an iPad. Some sessions created by another session using
create_threadwere missing on Windows and the Android phone, while they remained visible on the tablets.Unlike the cases described above,
thread/listwithuseStateDbOnly: truestill omitted the affected sessions. Their SQLite entries hadthread_source: "agent_created_thread", a nonemptyname, and an emptypreview.Codex tested individual metadata changes in an isolated database copy:
previewwith the existing session name restored both missing sessions, increasing the results from 5 to 7.title,first_user_message, orhas_user_eventindividually did not restore them.Codex then applied the same preview-only repair to the affected entries on my Mac, restoring visibility in my setup. This was a local metadata workaround; the cause of the empty previews remains unconfirmed.
This may be a related listing failure through a different path, since the database-only query also failed in this case.