Skip to content

Recover legacy Codex thread names in the native state database #395

Description

@huzhongyyuan

Problem

Older Codex versions persisted renamed thread names in session_index.jsonl, while newer native surfaces also read threads.name from state_5.sqlite. After provider/relay changes, those legacy sessions remain resumable but their renamed titles can be absent in Codex CLI or Codex for VS Code.

Proposed behavior

On CC-Switch startup, perform a safe one-time backfill for each applicable Codex state database:

  • fill only blank/null threads.name values from matching session_index.jsonl entries;
  • never overwrite a current non-empty name;
  • preserve archive status and all unrelated fields;
  • cover the default Codex DB and configured sqlite_home;
  • take a SQLite backup and use a crash-consistent per-DB migration ledger;
  • protect against concurrent writers/source changes and bound startup work.

I have an implementation with focused race, rollback, replacement-DB, archive, malformed-input, size-limit, and sqlite_home tests and will open the PR after this issue as requested by the contribution guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions