Codex App session list can hide sessions whose first user message is an empty diff-comment wrapper
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.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗