Urgent data loss: Codex cleanup deleted pinned task rollout files, leaving orphaned threads

Open 💬 1 comment Opened Aug 8, 2026 by iando-ai
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Codex version

codex-cli 0.147.0-alpha.1.2 bundled with ChatGPT Desktop (client version observed in app logs: 26.730.61309).

Subscription

ChatGPT Pro.

Platform

macOS 26.5.1, Apple Silicon.

Severity

Urgent data-loss / task-integrity incident. Four long-running pinned Codex Desktop tasks are present in the task database and sidebar metadata but cannot be opened or resumed because their rollout JSONL files were deleted by a Codex-driven storage cleanup.

What happened

A Codex task was asked to perform a safe Mac storage cleanup and preserve uncertain material in Google Drive. During that run, Codex generated and executed a cleanup script that did this:

find /Users/<user>/.codex/sessions -type f -size +200M -print0 |
while IFS= read -r -d '' file; do
  if ! lsof "$file" >/dev/null 2>&1; then
    rm -f -- "$file"
  fi
done

It also deleted archived session files older than 30 days and scheduled deletion of one still-open 13.2 GB pinned session after the process exited. The cleanup report incorrectly characterized the removed Codex session logs as disposable history and said the task was merely archived.

The result is that four important pinned tasks are now orphaned:

  • 019dc55b-3301-7711-b262-90bea0eda76d
  • 019e6170-68b9-7583-89b6-86e3b2dddb33
  • 019f3e97-7f52-7333-94a0-9a5d9858f657
  • 019faa3c-8720-7b40-b305-4e397f6c7954

The affected titles include “SEO GTM BUILD” and multiple outbound-motion tasks.

Current failure

Attempting to continue one affected task through the Codex Desktop thread API returns:

failed to resolve rollout path /Users/<user>/.codex/sessions/2026/04/25/rollout-2026-04-25T10-56-21-019dc55b-3301-7711-b262-90bea0eda76d.jsonl: file does not exist

The app can still list and pin the task records, but read_thread returns thread not loaded, and sending a follow-up fails with the missing-rollout error.

Diagnostics

codex doctor --json reports:

  • state DB integrity: OK
  • log DB integrity: OK
  • rollout files: 4,057
  • active DB rows: 4,118
  • stale DB rows: 998
  • warning: “state DB rows point at missing or unusable rollout files”
  • scan errors: 0
  • archived rollout files on disk: 0
  • archived rows in DB: 937

The four affected DB records still point at the exact missing rollout paths. There are no APFS/Time Machine local snapshots, no open deleted file descriptors, and no matching Google Drive copies. A prior Drive folder named “Codex Session Archives” contains only index/settings backup material, not transcript JSONL files.

Project/source files were checked separately and remain present; this incident is loss of Codex task transcripts rather than deletion of project Markdown files.

Expected behavior

  1. Codex should not classify ~/.codex/sessions or ~/.codex/archived_sessions as disposable cache/history during automated cleanup.
  2. Pinned or database-referenced task transcripts should be protected from model-generated deletion.
  3. Destructive cleanup under CODEX_HOME should require a backup/recovery path and explicit user confirmation.
  4. The app should detect orphaned thread rows and offer a supported recovery or “reconstruct from retained logs/server state” workflow.
  5. Please advise whether OpenAI can recover these four task transcripts from any retained backend/session upload, and whether the state database/log database can be used to rebuild valid rollout files.

Reproduction

  1. Have a local Codex Desktop installation with large pinned rollout JSONL files.
  2. Ask Codex to perform a “safe” storage cleanup and preserve uncertain data.
  3. Allow the agent to remove ~/.codex/sessions/*.jsonl files based only on file size and whether lsof reports them open.
  4. Restart Codex and try to open/resume the affected pinned task.
  5. The task metadata remains visible, but resume fails because the rollout path no longer exists.

This report is being filed immediately after the incident. No further files have been deleted or overwritten during recovery.

View original on GitHub ↗

1 Comment

github-actions[bot] contributor · 20 days ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #37419

Powered by Codex Action