Skip to content

Persisted VS Code threads fail to resume with "list_turns is not supported yet" #45703

Closed

Description

@maxime3gilot-source

What version of the IDE extension are you using?

26.908.40401

What subscription do you have?

Pro

Which IDE are you using?

VS Code

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

I can reproduce this with persisted VS Code threads.

The affected threads are still present locally:

  • state_5.sqlite exists and codex doctor reports integrity OK
  • the VS Code threads are present in the database
  • the corresponding rollout .jsonl files are still present on disk
  • codex resume --all correctly lists my older persisted threads

However, trying to resume some of them with: codex resume <UUID>

correctly resolves the rollout file, then fails with: "thread/resume failed: list_turns is not supported yet (code -32601)"

For another persisted VS Code thread, I instead get: "Error: failed to load a bounded thread history page"

I also tested older Codex versions, but the affected threads still could not be resumed. I have not modified the SQLite DB or rollout files.

So in my case the threads are discoverable and indexed correctly; the failure occurs specifically when Codex tries to load/resume their history.

Image Image

What steps can reproduce the bug?

  1. Open VS Code on Windows 11 with the OpenAI Codex extension.

  2. Open the Codex chat history and select an existing persisted conversation that previously worked normally.

  3. Try to resume/open the conversation.

  4. The conversation fails to load and Codex reports:

Failed to resume chat
list_turns is not supported yet

The affected conversations are still present locally and are still discoverable.

As an additional diagnostic, I tested the same affected threads with Codex CLI 0.154.0:

codex resume --all

The older VS Code threads are correctly listed.

Trying to resume one directly:

codex resume <THREAD_UUID>

locates the corresponding rollout file successfully, but then fails while loading the history with:

thread/resume failed:
list_turns is not supported yet (code -32601)

On another affected thread, I get:

Error: failed to load a bounded thread history page

codex doctor reports that state_5.sqlite exists and has valid integrity, and the affected threads and their rollout files are still present locally.

The issue therefore appears to happen during history loading/resume, rather than thread discovery.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    extension
    on Sep 15, 2026
  2. added
    bug
    windows-os
    app-server
    on Sep 15, 2026
  3. argszero commented on Sep 15, 2026

    @argszero

    Root-caused on main (7784318b5f). The -32601 is not a missing capability — it is a per-thread gate on the persisted history_mode, and the message is misleading for exactly this case.

    The chain

    1. thread/resume → paginated_resume_initial_turns_page calls thread_store.list_turns(...) (app-server/src/request_processors/thread_processor.rs:3371).
    2. LocalThreadStore does implement list_turns (thread-store/src/local/mod.rs:684) and advertises paginated support whenever a state DB is present: supports_paginated_history_lists() is implemented as self.state_db.is_some() (local/mod.rs:680). That is why the paginated path is chosen at all.
    3. The read then rejects per row, not per store: validate_thread_for_paginated_reads (thread-store/src/local/thread_history/read.rs:176) switches on metadata.history_mode at read.rs:200-203 — a Legacy row yields ThreadStoreError::Unsupported { operation }, while a Paginated row passes the check.
    4. Unsupported is then mapped by unsupported_thread_store_operation (thread_processor.rs:5867-5869) to method_not_found with the text list_turns is not supported yet — i.e. -32601.

    So the store is "supported" at the store level and "unsupported" at the row level, and the error the user sees describes the former while the condition is the latter. This also explains why everything else in your report looks healthy: codex doctor, codex resume --all, the state DB and the rollout files are all consistent — only history reads pass through this validator.

    Your second error is the same gate. failed to load a bounded thread history page is the TUI wrapper (tui/src/app_server_session/history.rs:151) around thread/turns/list, which lands on the same store call (thread_processor.rs:3206). Two user-visible strings, one validator.

    Why these threads stayed Legacy. ThreadHistoryMode defaults to Legacy (state/src/model/thread_metadata.rs:257; the column itself defaults to 'legacy', migration 0040_threads_history_mode.sql), and a row is only flipped to Paginated by the rollout migration (state/src/extract.rs:663). Startup migration (thread-store/src/local/rollout_migration/startup.rs:61) processes everything on its first run, but afterwards it is incremental and deliberately never revisits most rows:

    • permanently skipped rollouts are excluded from the candidate set forever — the intent is stated at startup.rs:294-295: "background skips are permanent now" (reasons empty / failed / malformed_session_meta; only busy is retried, startup.rs:164);
    • candidates must be newer than the last checked thread's creation time minus a 48h lookback (CURSOR_LOOKBACK_SECONDS = 48 * 60 * 60, startup.rs:44; filter at startup.rs:92-107), so rows older than that window are never reconsidered.

    This matches your note that downgrading Codex does not help: the mode is persisted per row and the resume path is version-independent.

    Recovery already exists. The manual migration enumerates all rollouts under CODEX_HOME and does not consult the skip list or the lookback window — the Manual trigger uses RolloutMigrationPaths::Discover (rollout_migration.rs:329-334; the skip table is read only in startup.rs:67 / :72):

    codex migrate-rollouts --thread THREAD_UUID          # dry run, reports only
    codex migrate-rollouts --thread THREAD_UUID --apply  # performs the migration
    

    A dry run first is worth it: the same command reports failed / malformed_session_meta for rollouts it cannot migrate, which would explain a row that stays Legacy even afterwards.

    Confirming which case you are in (state DB is state_5.sqlite in your Codex home; these are read-only queries):

    select id, history_mode, created_at from threads where id = 'THREAD_UUID';
    select rollout_path, skip_reason, skipped_at
      from rollout_migration_skipped_rollouts
     where rollout_path like '%THREAD_UUID%';
    select last_checked_thread_created_at, updated_at from rollout_migration_state;
    

    A row with history_mode = 'legacy' plus a matching skip_reason row means it was skipped permanently by design, and only the manual migration will retry it.

    Suggestion for a fix (maintainer's call which shape): the store-level gate and the row-level gate should not share one error. Either the resume/list path should fall back to the legacy read when history_mode = Legacy rather than reporting method-not-found, or unsupported_thread_store_operation should distinguish "no state DB" from "this thread is not migrated yet" and point at codex migrate-rollouts. Happy to prototype either if that is useful.

  4. maxime3gilot-source commented on Sep 16, 2026

    @maxime3gilot-source
    Author

    I checked and found an inconsistency for the affected thread.

    For the same thread UUID :

    • state_5.sqlite reports history_mode = 'legacy'
    • the rollout session_meta contains "history_mode": "paginated"
    • codex migrate-rollouts --thread <UUID> --json reports "status": "already_paginated"

    So the rollout itself appears to be migrated, but the corresponding thread metadata in state_5.sqlite is still legacy.

    That would seem to explain both behaviors:

    • migrate-rollouts does nothing because it considers the rollout already paginated
    • thread/turns/list still hits the Legacy per-thread gate when resuming

    Is there a supported way to resync/update the persisted history_mode in the state db for this case or should migrate-rollouts be repairing this mismatch ?

    Thank you

  5. argszero commented on Sep 16, 2026

    @argszero

    That is exactly the state I could not verify from the original report — thanks for digging into the DB. Short answer: there is a supported resync, and your command did not run it — --json is not the switch, --apply is.

    Why --json could not have changed anything

    --json only selects the output format. The mode is chosen by --apply alone (codex-rs/cli/src/migrate_rollouts.rs:23-25, :70-74):

    /// Publish the migration. Without this flag the command only reports eligible sessions.
    #[arg(long)]
    apply: bool,
    ...
    let mode = if command.apply {
        RolloutMigrationMode::Apply
    } else {
        RolloutMigrationMode::DryRun
    };

    and in dry-run the store is built without a state DB at all (:88-96):

    let state_db = if mode == RolloutMigrationMode::Apply { Some(...) } else { None };

    Every promotion is guarded on that DB (codex-rs/thread-store/src/local/rollout_migration.rs:1090 — if let Some(state_db) = &self.state_db), so a dry run cannot write state_5.sqlite by construction.

    That is also why already_paginated says nothing about your SQLite row: the migration decides it from the rollout file only. migrate_rollout_path builds its metadata from codex_rollout::read_session_meta_line(&path) (rollout_migration.rs:384) and short-circuits when that header says paginated (:481), returning RolloutMigrationStatus::AlreadyPaginated (:517). Your two sources of truth were simply never compared.

    The resync

    codex migrate-rollouts --thread <UUID> --apply
    

    In Apply mode the already-paginated branch calls promote_legacy_name (rollout_migration.rs:513-517), which calls mark_thread_paginated — the only production writer of that column (codex-rs/state/src/runtime/threads.rs:68-93):

    UPDATE threads SET history_mode = 'paginated', name = CASE ... END WHERE id = ?

    Notes on running it:

    • Idempotent. If the row is already paginated and has a non-empty name it returns early (rollout_migration.rs:1098-1105), so a repeat run is harmless. This "rerun rewrites the row" behaviour is documented by migration_repairs_a_missing_paginated_name_when_rerun (codex-rs/thread-store/src/local/rollout_migration_tests.rs:2277), which asserts status AlreadyPaginated while the SQLite row is repaired.
    • Visible side effect: if the row's name is empty it gets backfilled from the legacy title/name index, so the thread may show a display name it did not show before. Worth knowing if you diff the DB afterwards.
    • Backing up state_5.sqlite (and its -wal) before an apply run costs nothing.
    • After that the read gate should pass: validate_thread_for_paginated_reads rejects only ThreadHistoryMode::Legacy (thread-store/src/local/thread_history/read.rs:200-203).

    Two gaps your mismatch did expose

    I would call these gaps rather than your error:

    1. Nothing repairs this automatically. The startup migration also classifies from the rollout header (rollout_migration/startup.rs:268-272) and, when every candidate comes back Paginated/Skipped, it skips the migration run entirely and only advances its cursor (:116, :127). So a rollout whose header says paginated while its row says legacy is never reconciled on its own — it stays -32601 until someone runs --apply by hand. That is exactly your case.
    2. A dry run cannot show the divergence. The report carries one status derived from the rollout, so already_paginated reads as "nothing to do" while the row is stale. Reporting the row's history_mode next to it (or a "would promote on --apply" note) would have told you immediately.

    I am happy to put up a patch for either. (1) is a design call — startup deliberately avoids re-reading rollouts — but (2) looks like a low-risk reporting improvement.

    Could you confirm what the row says after --apply? If it is still legacy, that is a different and more interesting bug, and the per-thread statuses printed by --apply would be the next thing I would want to see.

  6. maxime3gilot-source commented on Sep 16, 2026

    @maxime3gilot-source
    Author

    Confirmed — this fixed the issue on my machine.

    For the affected thread, I had the following inconsistent state:

    • rollout session_meta: history_mode = "paginated"
    • state_5.sqlite: history_mode = "legacy"

    Running:

    codex migrate-rollouts --thread <UUID> --apply --json

    still reported status: "already_paginated", but the apply run updated the SQLite state. After that, the thread resumed successfully in Codex CLI and opened normally again in the VS Code extension.

    I then checked my other VS Code threads and found 106 still marked as legacy. I applied the same migration to those threads, and afterwards:

    SELECT COUNT(*)
    FROM threads
    WHERE source = 'vscode'
      AND history_mode = 'legacy';

    returned:

    0
    

    After reloading VS Code, the previously affected conversations are opening normally again.

    One additional issue I encountered: a global

    codex migrate-rollouts --apply --json

    aborted because one rollout was missing its SQLite metadata, so I had to migrate the valid SQLite-backed threads individually.

    Based on this reproduction, two improvements might be worth considering:

    1. Automatically reconcile a thread whose rollout is already paginated while its SQLite metadata is still legacy, so manual migrate-rollouts --apply is not required.
    2. Make the error more actionable than list_turns is not supported yet when this specific metadata mismatch is detected.

    It may also be worth allowing a global rollout migration to continue past a rollout with missing SQLite metadata, while reporting that rollout separately.

    Thanks again — the diagnosis and the --apply recovery path solved the issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-serverbugextensionwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions