Codex older sessions missing from resume: where they went and how to get them back
Published · Updated · Checked against Codex CLI 0.166.0
Usually they are still there. codex resume lists only sessions for the current working directory, hides non-interactive runs, and hides archived sessions. Look at the rollout files on disk before anything else: if they exist, you are dealing with filtering or a known index bug in the desktop app, and if they do not, nothing in Codex brings them back.
Check the disk
Codex writes one JSONL "rollout" file per session; where Codex stores sessions covers the layout.
ls ~/.codex/sessions
find ~/.codex/sessions -name 'rollout-*.jsonl' | sort | head
find ~/.codex/sessions -name 'rollout-*.jsonl' | wc -l
If CODEX_HOME is set, use it in place of ~/.codex. Old files present means filtering is the likely cause. No old files means they were deleted, by you, by a cleanup script, or by codex delete; skip to "When the files are gone".
Filtering
This is the common cause. The table comes from the CLI docs and codex resume --help:
| What | Behaviour | Fix |
|---|---|---|
| Directory scope | "codex resume scopes --last to the current working directory unless you pass --all" | codex resume --all |
| Picker scope | In the TUI, /resume offers Cwd, Repo and All scopes | Switch the scope to All |
| Non-interactive runs | codex exec sessions are left out | codex resume --include-non-interactive |
| Archived | /archive removes a session from active lists but keeps the transcript | codex unarchive <SESSION> |
If the directory you start in differs from the session's saved directory, Codex asks which to use, and setting tui.resume_cwd to "current" or "session" skips the prompt.
You can also resume by ID or by name without the picker. The ID is in the rollout file name, for example rollout-2026-11-03T00-11-54-<id>.jsonl.
codex resume --all
codex resume 01a19d08-1371-79c2-b1ac-48042e4d6ef1
The desktop app and its index
If codex resume --all shows the session but the desktop app does not, two open issues may be the reason.
openai/codex#17540, opened 12 April 2026, describes older local threads vanishing from the sidebar and sidebar search after a restart while still present on disk. The reporter found them in state_5.sqlite, session_index.jsonl and the rollout files, and saw many threads.cwd values stored with a \\?\C:\... prefix on Windows. Later commenters report Windows and macOS cases. The proposed causes (path normalization, a limited recent-thread slice, empty previews for long first messages) are commenters' analysis, and no maintainer has commented. One user reported that codex resume --all on CLI 0.133.0 made a thread visible in the desktop app again; that is a single report.
openai/codex#26104, opened 3 June 2026, is also open. Older chats were listed but showed no messages, and opening large legacy chats spiked memory; the largest file in that report was about 624 MB. Later builds reduced the memory growth, and no maintainer replied. A commenter's workaround is to back up ~/.codex/sessions and ~/.codex/session_index.jsonl, move the oversized file out, and fix backslash paths inside old files. That edits your history by hand, so copy everything first, and it may not apply to small files.
Whichever it is, the CLI reading the file is the most direct test. If codex resume --all works, the data is intact.
When the files are gone
Try these in order:
- A filesystem snapshot or Time Machine copy of
~/.codex/sessions/. - Your own copy of the folder.
~/.codex/history.jsonl. The config reference sayshistory.persistencecontrols whether Codex saves session transcripts there. What a given entry holds is unconfirmed, so read one before relying on it.
Disk cleanup is a frequent source of "missing" sessions. Commenters in openai/codex#34061, an open issue about session files growing to hundreds of GiB, warn that deleting rollout files without pruning the matching rows in state_5.sqlite and thread_history_1.sqlite leaves dead codex resume entries. The proper delete is codex delete <session ID>, which a maintainer comment in #24948 says shipped in CLI 0.141.0. See Codex sessions disk usage.
Keeping a copy
Rollout files are append-only JSONL, so a copy outside ~/.codex protects against your own cleanup scripts and against bugs alike.
mkdir -p ~/codex-sessions-backup
rsync -a ~/.codex/sessions/ ~/codex-sessions-backup/sessions/
rsync -a ~/.codex/session_index.jsonl ~/codex-sessions-backup/
There is no --delete, so removals do not propagate. Backing up Claude Code and Codex sessions covers other methods.
What Sealkeep adds
Sealkeep keeps an encrypted, verified copy of each Codex session as it finishes. sealkeep search <query> --content finds one by what was said in it, and sealkeep recover <archive-id> --native --overwrite backup puts a full session back at its native path while keeping anything already there. With its disk-reclaim option on, it leaves a tiny same-session resume pointer, so the session still resumes and can search its preserved memory.
It does not fix the desktop sidebar or the SQLite index, and it cannot recover sessions deleted before it was installed. Reclaim needs Sealkeep Cloud today; with your own bucket, every original stays on disk.
FAQ
Does /archive delete a session?
No. The docs say it removes the session from active lists and keeps the transcript. /delete permanently removes it.
Where is the session ID?
In the rollout file name and in the first line of the file. On one install, ~/.codex/session_index.jsonl maps IDs to thread names.
Why does codex resume --last pick a different session than I expect?
It is scoped to the current working directory unless you pass --all.