Codex resume: --last, the picker, session IDs and errors
How codex resume works in 0.174: --last and --all, resuming by ID or name, /resume, codex exec resume, where ~/.codex/sessions lives, and no session found.
codex resume --last reopens the most recent Codex session started in the folder you are in. codex resume opens a picker of past sessions from that folder, codex resume --all lifts the folder filter, and codex resume <id or name> opens one directly. Inside a running session, /resume does the same. Scripted runs use codex exec resume --last "next instruction". Sessions are saved under ~/.codex/sessions on the machine where they ran, so a session started on a server is resumed on that server. As of Codex 0.174.0, December 4, 2026.
Every way back into a session
| Command | What it does |
|---|---|
codex resume | Opens the picker, filtered to sessions from the current folder |
codex resume --last | Skips the picker and reopens the newest session from the current folder |
codex resume --all | The picker (or, with --last, the newest session) across every folder |
codex resume <SESSION_ID> | Reopens one session by its UUID or by the name you gave it |
--include-non-interactive | Adds codex exec runs to the picker and to --last |
/resume | The picker from inside a running session |
codex fork, /fork | Copies a session into a new one with a fresh ID, leaving the original untouched |
codex exec resume | Continues a session non-interactively with a new prompt |
The flags are from OpenAI’s Codex command reference and the help text in the CLI source at 0.174.0. codex resume takes the same options as a plain codex, so --model, --sandbox, --ask-for-approval and -C apply to the resumed session; the one it refuses is --worktree. With --last, a quoted argument after it is sent as your first message, so codex resume --last "run the tests again" picks up and carries on in one step.
For Claude Code’s equivalents, side by side with these, see resuming a Codex or Claude Code session.
Using the picker
The picker opens titled “Resume a previous session” with the newest at the top. Start typing to search. Tab moves focus to the toolbar, where the arrow keys change three settings:
- Scope:
Cwdshows sessions from the current folder,Repo(when you are in a Git repository with linked worktrees) adds the same folder in those worktrees, andAllshows every folder. - Sort: by when a session was created or last updated.
- Status:
ActiveorArchived. Choosing an archived session unarchives it.
Two keys behave differently from what Claude Code users expect. Ctrl+A archives the highlighted session; it does not show all sessions as it does in Claude Code’s picker. An archived session is not deleted and comes back through the Archived status. And Esc, when the picker opened at startup and the search box is empty, skips the picker and starts a new session. Ctrl+T shows the highlighted session’s transcript before you commit to it.
Finding a session’s ID, or giving it a name
When you quit, Codex prints the command to come back:
To continue this session, run:
codex resume 123e4567-e89b-12d3-a456-426614174000CopiedA UUID is hard to remember, so name sessions you will return to: /rename auth-refactor inside the session, or /new auth-refactor to start one with a name. After that, codex resume auth-refactor works, and the exit message adds “Or run codex resume and select auth-refactor.” If a name could also be read as a UUID, the UUID wins. Inside a session, /status shows the ID on its Session line; it is also in the file name on disk, covered below.
Which folder the resumed session works in
Each session remembers the directory it was working in. If you resume from a different one, Codex asks which to use. To stop the question, set it once in ~/.codex/config.toml:
[tui]
resume_cwd = "session"Copied"session" always goes back to the session’s own folder; "current" always uses the folder you are in. An explicit -C <dir> on the command line overrides either. codex fork follows the same setting. The rest of the file is in the config.toml guide.
What comes back with a session
Codex “reloads the selected chat’s transcript so you can pick up where you left off,” with the history intact. It does not bring back a process: a command that was running when Codex exited is not still running. Around the transcript, from the docs and the 0.174.0 release notes:
- A session started read-only stays read-only across repeated resumes (fixed in 0.174.0).
codex exec resumereuses the session’s working directory, workspace roots and sandbox permissions. From 0.174.0 it also keeps the session’s approval policy and reviewer, unless you override them.- The service tier you chose carries through resumes and forks from 0.174.0.
- Anything you pass on the command line, such as
--modelor--sandbox, applies to the resumed session.
The docs do not say whether an interactive resume restores the model the session last used or starts on your configured default. Run /status after resuming: it shows the active model and approval policy, and /model changes the model if it is not the one you want.
Resuming from a script with codex exec
codex exec resume --last "now add a test for that fix"
codex exec resume <SESSION_ID> "summarise what changed"Copied--last here also looks only at the current folder until you add --all. Options that change the sandbox or the folder go before resume, as in codex exec --sandbox workspace-write resume --last "apply it". In a pipeline, run the first step with --json and read the ID from its first event, {"type":"thread.started","thread_id":"…"}, so a later step resumes exactly that run instead of whichever was newest. From 0.174.0, codex exec follows your configured approval policy rather than forcing it to never ask: when the policy would ask a person, it prints a warning on stderr and declines each request, and a resumed run inherits the policy of the session it continues. The full flag list, and how to set approvals for unattended runs, is in the codex exec guide.
A run made with codex exec --ephemeral writes no session file and cannot be resumed.
Where Codex stores sessions
Each session is one JSON Lines file, filed by the local date it started:
~/.codex/sessions/2026/12/04/rollout-2026-12-04T09-15-02-<uuid>.jsonlCopiedThe UUID at the end of the name is the session ID, so ls -t ~/.codex/sessions/*/*/*/rollout-* | head lists the newest when the picker is not to hand. Archived sessions move to ~/.codex/archived_sessions. The files stay plain text by default: Codex’s source carries an option still under development, off unless you turn it on, that compresses session files untouched for seven days into .jsonl.zst, which zstdcat reads and a plain grep does not.
All of this sits under CODEX_HOME, which defaults to ~/.codex and also holds your sign-in and config. Set it to another directory and Codex reads and writes sessions there instead; the directory must already exist. That is also why the same machine can show two different session lists: a different user, a sudo that changes HOME, or a service started with its own environment each look in a different ~/.codex.
Codex’s docs give no age limit after which sessions are deleted. If you use the opt-in memories feature, it draws on sessions up to 30 days old by default; the Codex memory guide covers how that differs from resuming.
On a server, and on another machine
Because sessions live in the ~/.codex of the machine where Codex ran, a session started on a server is resumed on that server: SSH in, cd to the project, and run codex resume --last. The session list on your laptop is a different list. OpenAI’s docs do not describe moving a session between machines.
Resume and tmux answer different losses. If your SSH connection drops, Codex running inside tmux keeps working and you reattach to the live process; see the tmux guide. If the server reboots or Codex crashes, the process is gone, and resume starts a new one on the saved transcript.
If your Codex is old enough that resume is not a recognised command, or the picker lacks the scope and status settings above, update it first (updating the Codex CLI).
When resume can’t find your session
With an ID or a name that matches nothing, Codex exits with:
No saved session found with ID auth-refactr. Run `codex resume` without an ID to choose from existing sessions.CopiedThe message says “ID” for names too, so check the spelling first. A name is looked up only among active sessions started interactively: an archived session, or a codex exec run without --include-non-interactive, is not found by name, though its UUID still works (or pick it from the Archived status in the picker).
The other cases fail more quietly:
codex resume --lastopens a blank session. When no session matches, it starts a new one rather than printing an error. Usually you are in a different folder from the one you worked in;cdthere, or add--all.- The picker says “No sessions yet”. Same folder filter: switch the scope to All, or relaunch with
--all. If the session was acodex execrun, add--include-non-interactive. - The session was archived. A stray Ctrl+A in the picker does this. Switch the status to Archived, or run
codex unarchive <id or name>. - A different
CODEX_HOME. Checkecho $CODEX_HOMEand which user you are; see the storage section above.
Tidying up: archive and delete
codex archive <id or name> (or /archive inside) takes a session off the lists and keeps its transcript; codex unarchive brings it back. The next command is permanent: it deletes the transcript, its saved side chats and any sessions it spawned.
codex delete <SESSION_ID>CopiedIt asks for confirmation. Adding --force skips the question, and only accepts a UUID, never a name.