codex icon indicating copy to clipboard operation
codex copied to clipboard

Missing rollout leaves an unarchivable ghost thread in the Windows sidebar

Open mmmzzzxxx000 opened this issue 3 months ago • 6 comments

Bug: Missing rollout leaves an unarchivable “ghost” thread in the Windows sidebar

Summary

On the Codex/ChatGPT Windows desktop app, a local thread remained visible in the sidebar and repeatedly failed to archive because its rollout file was missing while the state database still retained the thread row and stale rollout path. The item survived full app restarts and was also treated as a pinned thread by the renderer even after the backend could no longer load it.

The UI eventually reported archive success only after the stale local state was cleaned up and an explicit unpin operation was sent. The app should self-heal this state without requiring manual SQLite/session cleanup.

Environment

  • Platform: Windows 10 Home China 22H2, build 19045.6466, x64
  • Desktop app release reported in logs: 26.814.41957
  • App server version: 0.148.0-alpha.15
  • Selected Codex runtime bundle: 26.819.11345
  • Date observed: 2026-08-20
  • Thread title: 11
  • Thread ID: 01a01437-8518-78d2-8485-d0512fcbc1c5
  • Deep link: codex://threads/01a01437-8518-78d2-8485-d0512fcbc1c5

Preconditions inferred from logs and local state

  1. state_5.sqlite retained a row for the thread.
  2. Its rollout_path pointed to a JSONL file that no longer existed.
  3. The renderer/sidebar still retained the thread in its pinned/recent state.

The stale path was equivalent to:

%USERPROFILE%\.codex\sessions\2026\08\18\rollout-...-01a01437-8518-78d2-8485-d0512fcbc1c5.jsonl

Steps to reproduce

The original cause of the missing rollout is unknown, but the broken state can be described as follows:

  1. Have a local thread row in state_5.sqlite whose rollout_path no longer exists.
  2. Keep that thread visible or pinned in the sidebar.
  3. Restart the desktop app.
  4. Try Archive from the thread overflow menu, sidebar context menu, or Recent tasks menu.

Actual behavior

  • The app repeatedly shows archive failure.
  • Restarting does not remove the sidebar item.
  • The stale thread can remain visible even though thread/read and turn/start report that the thread is missing/not loaded.
  • Archive may fail through two related paths:
    • internal OS error because the rollout file is missing;
    • no rollout found, followed by failure to persist the inactive-thread archive.
  • The renderer can continue trying to hydrate the item as a pinned thread.

Expected behavior

If a thread's rollout is missing but a state-database/sidebar record remains, Archive should still remove the item from active and pinned sidebar state. The app should transactionally reconcile or quarantine the stale database row, clear its pinned state, invalidate the renderer cache, and optionally surface a recoverability warning. It should not require the missing rollout file merely to hide/archive the sidebar entry.

Sanitized log evidence

Archive requested ... method=thread/archive
errorCode=-32603
failed to archive session: thread-store internal error: failed to archive thread:
The system cannot find the file specified. (os error 2)

Archive skipped because thread has no active rollout
errorMessage="no rollout found for thread id 01a01437-8518-78d2-8485-d0512fcbc1c5"

Failed to persist inactive thread archive
errorMessage="Inactive thread archive did not persist"

state db list_threads returned stale rollout path for thread
01a01437-8518-78d2-8485-d0512fcbc1c5
state db discrepancy during list_threads_db: stale_db_path_retained

thread/read ... errorCode=-32600
message="thread not loaded: 01a01437-8518-78d2-8485-d0512fcbc1c5"

Failed to read pinned thread
threadId=01a01437-8518-78d2-8485-d0512fcbc1c5

Recovery that ultimately worked

The user observed successful archiving only after all of the following stale state had been reconciled:

  1. removed the stale thread row and exact-ID references from local structured state;
  2. confirmed the missing rollout/session file had no remaining live index entry;
  3. explicitly set the thread's pinned state to false;
  4. retried Archive in the desktop app.

Suggested fix

When thread/archive encounters rollout_not_found or OS error 2:

  1. fall back to a state-database-only archive transaction;
  2. clear is_pinned and any renderer-side pinned ID for the thread;
  3. invalidate the sidebar query/cache;
  4. remove or quarantine stale rollout_path entries;
  5. return success if the thread is no longer present in active sidebar state.

This would prevent a permanently visible “ghost” thread and avoid requiring users to edit local databases manually.

mmmzzzxxx000 avatar Aug 20 '26 02:08 mmmzzzxxx000

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

  • #39182

Powered by Codex Action

github-actions[bot] avatar Aug 20 '26 02:08 github-actions[bot]

Additional reproduction from the same day, with a different failure variant:

Environment

  • Windows 11 x64, zh-CN
  • Codex Desktop package: OpenAI.Codex 26.818.2441.0
  • Codex CLI: 0.148.0-alpha.21
  • Observed: 2026-08-20, Asia/Shanghai (UTC+8)

Important difference

For this affected thread, the rollout JSONL file exists and is readable. The thread is also present in session_index.jsonl, and codex doctor --summary reports that the state database is healthy and the rollout/thread inventories agree.

Despite that, all archive paths fail:

thread/archive
errorCode=-32600
failureReason=rollout_not_found
message="no rollout found for thread id ..."

The CLI reports:

failed to archive thread: The system cannot find the file specified. (os error 2)

Recovery attempts

  1. Restarted Codex Desktop twice.
  2. Verified the rollout file and session-index entry.
  3. Ran a targeted dry-run: codex migrate-rollouts --thread <redacted-thread-id> --json --verbose
    • Result: eligible
  4. Ran the same targeted migration with --apply.
    • Result: migrated
    • Approximately 1.1 MB processed.
  5. Restarted the desktop app again.

After migration, the task became readable/idle, but Archive still fails with OS error 2. No conversations were deleted; backups were made before migration.

A second completed task also intermittently appears as notLoaded after restart. This may indicate that the archive path resolver is using a stale or differently normalized rollout path even when the file and catalog entry both exist.

Please consider handling rollout_not_found/OS error 2 by reconciling the state DB, session index, and resolved rollout path before failing the archive operation. I can provide a focused sanitized log excerpt and screenshot if needed.

80772673-sudo avatar Aug 20 '26 12:08 80772673-sudo

Hi, on Windows I was able to solve the issue with the following steps:

  1. Completely close the ChatGPT desktop app (Exit from the system tray).
  2. Go to %USERPROFILE%.
  3. Delete the .codex folder.
  4. Reopen the ChatGPT desktop app. The initial configuration will start again.
  5. Follow the setup steps.

After completing the setup, the ghost chats are no longer present.

This worked for me without having to manually edit the SQLite database or individual session files.

ezio-dalbo avatar Aug 31 '26 15:08 ezio-dalbo

I reproduced a related case after manually deleting local rollout/session files. Archive failed with Inactive thread archive did not persist, and the ghost task remained in the sidebar.

A local workaround that removed the ghost entry:

  1. Back up ~/.codex/session_index.jsonl and ~/.codex/sqlite/codex-dev.db.
  2. Remove only the affected thread_id from every matching line in session_index.jsonl.
  3. In codex-dev.db, remove the matching row from local_thread_catalog, then increment local_thread_catalog_metadata.catalog_revision.
  4. Restart Codex Desktop.

Removing session_index.jsonl entries alone was insufficient; the stale local_thread_catalog row kept the item visible. This is an unsupported recovery workaround, so the app should ideally reconcile a missing rollout and allow archive/remove without requiring the original rollout file.

mrwillystudio avatar Aug 31 '26 19:08 mrwillystudio

This still occurs on Windows with the OpenAI.Codex desktop package version 26.1103.4239.0 (observed on 2026-11-09). The affected chat originated in VS Code and is listed in the desktop sidebar. Selecting Archive shows “聊天归档未成功” (“Failed to archive chat”) and leaves it in the active list.

Read-only inspection of the affected local chat found:

  • state_5.sqlite still has the thread row with archived=0, is_pinned=0, and history_mode=paginated.
  • The recorded rollout_path points to a JSONL file that is absent. A search by thread ID found no matching rollout in the local Codex data directory.
  • thread_history_1.sqlite still has turn and item records for the same thread.

The user suspects the file might have been removed during disk-space cleanup. We have no evidence confirming when or how it disappeared or which cleanup tool might have been involved.

Please consider a supported archive or recovery path for this state that preserves the remaining paginated history. If the app cannot complete the archive, an error identifying the missing rollout and explaining the available recovery options would be more actionable than the generic toast.

Tracest avatar Nov 09 '26 03:11 Tracest

Possibly the same root cause as #62541 (macOS, same engine family): creating a new chat already issues thread/start, and the first send issues a second thread/start and dispatches the turn into the new thread (277–330 ms after creation). The pre-created thread keeps 0 turns and is missing from thread/list, which would leave exactly the kind of non-resumable, non-archivable reference described here.

Worth checking on the Windows build whether one click+send produces two thread/start calls on the Codex Desktop connection — the engine records them as otel spans in logs_2.sqlite, so it is verifiable without any extra tooling.

WGooold avatar Nov 19 '26 15:11 WGooold