Codex history thread disappears when initial prompt is stored only as pasted-text attachment
What version of the IDE extension are you using?
26.616.31447
What subscription do you have?
Team
Which IDE are you using?
VS Code
What platform is your computer?
Linux 6.12.91-1-MANJARO x86_64
What issue are you seeing?
A Codex conversation disappeared from both the VS Code Codex extension sidebar history and the Codex TUI history/resume view.
The session was created from a large pasted prompt. Codex converted the prompt into a pasted-text.txt attachment, but the actual first user message body in the JSONL session was empty/near-empty and only referenced the attachment.
The thread still existed on disk in ~/.codex/sessions/..., and it had a row in ~/.codex/state_5.sqlite, but it was hidden from both history surfaces. This made it look like the conversation had vanished completely.
The first user message in the JSONL looked roughly like this:
# Files mentioned by the user:
## You are an LLM coding agent helping implement ...: ~/.codex/attachments/<id>/pasted-text.txt
The attached pasted text file(s) contain the user's request. Read and act on that content.
The actual prompt only existed in:
~/.codex/attachments/<id>/pasted-text.txt
After I manually inserted the real pasted prompt into the first user-message records in the session JSONL, the thread reappeared in history.
This seems like a shared Codex history/indexing issue, not only a VS Code extension rendering issue, because the thread was missing in both VS Code and Codex TUI.
What steps can reproduce the bug?
- Open Codex in VS Code.
- Start a new conversation.
- Paste a large prompt into the composer.
- Let Codex convert the prompt into a pasted-text attachment.
- Submit the request without adding extra text outside the pasted content.
- Let the conversation proceed normally.
- Reload VS Code and/or open Codex TUI history/resume.
- Observe that the thread may be missing from history even though the JSONL session and attachment still exist on disk.
The core failure appears to be that the first user message is treated as empty because the real content is stored in the pasted-text attachment rather than inline in the JSONL user message.
What is the expected behavior?
Attachment-only or pasted-text-backed prompts should still produce a valid visible history entry.
Additional information
Manual recovery steps that fixed it:
- Found the session JSONL in ~/.codex/sessions/....
- Found the real prompt in ~/.codex/attachments/<id>/pasted-text.txt.
- Backed up:
- the JSONL session file
- session_index.jsonl
- state_5.sqlite
- Edited the session JSONL so the first user message records contained the actual pasted prompt:
- response_item with payload.type = "message" and role = "user"
- event_msg with payload.type = "user_message"
- Updated the SQLite row with a non-empty first_user_message, preview, and title.
- Updated session_index.jsonl.
The thread only reappeared after the actual first prompt was restored into the JSONL user-message records. This suggests re-indexing from JSONL can regenerate an empty/invalid first message if the pasted-text attachment is not considered.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗