Codex Desktop resume can fail when shell snapshot tmp file disappears during validation
What version of the Codex App are you using (From “About Codex” dialog)?
26.616.81150
Additional version signal from local logs: client_version="0.142.0" appears in ~/.codex/logs_2.sqlite during the resumed turn.
What subscription do you have?
ChatGPT auth. Exact plan intentionally omitted / not relevant to the local shell snapshot failure.
What platform is your computer?
macOS 26.4, build 25E246
Darwin 25.4.0 arm64
What issue are you seeing?
Codex Desktop can fail to resume an existing local thread because a shell snapshot temporary file disappears between the "successfully created" log entry and the validation step.
In the affected case, local thread state was otherwise healthy:
~/.codex/state_5.sqlitereturnedokforPRAGMA quick_check.- The affected thread row existed in
state_5.sqlite. - The affected thread was not archived.
- The thread
cwdexisted. - The thread
rollout_pathexisted. - A broader local scan found no missing rollout files.
The failure was isolated to shell snapshot validation. Logs showed the same .tmp-* snapshot path being created, then immediately missing during validation:
2026-06-24 22:43:20|INFO|codex_core::shell_snapshot|shell_snapshot{thread_id=<thread-id>}: Shell snapshot successfully created: ~/.codex/shell_snapshots/<thread-id>.tmp-1782312199006855000
2026-06-24 22:43:20|ERROR|codex_core::shell_snapshot|shell_snapshot{thread_id=<thread-id>}: Shell snapshot validation failed: Snapshot command exited with status exit status: 127: zsh:.:1: no such file or directory: ~/.codex/shell_snapshots/<thread-id>.tmp-1782312199006855000
2026-06-24 22:43:20|WARN|codex_core::shell_snapshot|shell_snapshot{thread_id=<thread-id>}: Failed to delete shell snapshot at "~/.codex/shell_snapshots/<thread-id>.tmp-1782312199006855000": Os { code: 2, kind: NotFound, message: "No such file or directory" }
This looks like a temp-file lifecycle / atomicity issue in the shell snapshot path, not a missing transcript or corrupt state database.
What steps can reproduce the bug?
I do not yet have a minimal deterministic reproduction from a clean machine, but the local reproduction pattern was:
- Use Codex Desktop on macOS with existing local threads.
- Resume / continue an existing local thread.
- Observe that the resume path fails or becomes unreliable even though the thread DB row, rollout JSONL, and cwd all exist.
- Inspect
~/.codex/logs_2.sqliteforcodex_core::shell_snapshotentries. - See a
.tmp-*shell snapshot path logged as successfully created and then immediately missing during validation.
A local workaround was successful:
mv ~/.codex/shell_snapshots ~/.codex/shell_snapshots.bak-<timestamp>
mkdir -p ~/.codex/shell_snapshots
chmod 755 ~/.codex/shell_snapshots
After this, sending a minimal follow-up to the previously affected thread succeeded. The thread returned OK, moved back to idle, and there were no new Shell snapshot validation failed logs in the checked window.
What is the expected behavior?
If the thread DB row, rollout JSONL, and cwd exist, Codex Desktop should be able to resume the thread.
More specifically:
- shell snapshot creation/validation should use a stable path or atomic write/rename sequence so validation cannot race with cleanup of the same
.tmp-*path; - if shell snapshot restoration fails, the UI should degrade gracefully, for example by opening the historical transcript and warning that the executable shell environment could not be restored;
- a transient shell snapshot cache failure should not make the whole conversation appear unrecoverable.
Additional information
Related issues I checked before filing:
- #20220: zsh shell snapshot omits PATH / Homebrew tools on macOS. Related area, but different failure mode.
- #21659: Windows Desktop cannot resume local chats until app restart. Related resume path, but PowerShell/Windows-specific.
- #29187: Windows thread switching slow due shell snapshot unsupported for PowerShell. Related shell snapshot path, different platform and symptom.
This report intentionally avoids including account IDs, auth headers, local secrets, full local paths to private projects, or rollout contents.