codex - 💡(How to fix) Fix Codex Desktop startup rescans archived_sessions instead of incrementally updating session_index.jsonl [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#22583Fetched 2026-05-14 03:34:17
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Fix Action

Workaround

Move cold archived sessions out of archived_sessions so Codex does not see them during startup. This avoids the startup slowdown but does not fix the underlying indexing design.

Code Example

session_index_v2/
  meta.json
  records.jsonl
  state.json
  journal.jsonl

---

{
  "source_path": "archived_sessions/2026/05/session.jsonl",
  "size": 123456,
  "mtime_ms": 1778760000000,
  "head_hash": "sha256:...",
  "tail_hash": "sha256:..."
}
RAW_BUFFERClick to expand / collapse

Problem

Codex appears to rebuild session_index.jsonl by scanning files under archived_sessions during startup. On machines with large archived histories, this makes startup much slower than necessary.

Observed case:

  • archived_sessions contained about 2.2GB of JSON session data.
  • Codex startup rescanned archived files to rebuild the session index.
  • Archived sessions were rescanned even when they had already been indexed and had not changed.
  • Environment: Windows 11, Microsoft Store Codex App 26.506.3741.0, codex-cli 0.130.0.

Related issues

  • #20864 reports Desktop lag from scanning the hot sessions tree.
  • #18693 reports broad Desktop performance collapse with very large local histories.
  • This issue is the archived-history variant: even files already moved to archived_sessions can remain on the startup indexing hot path.

Expected behavior

Codex should treat the session index as a persistent cache and update it incrementally:

  • Load the existing index immediately on startup.
  • Only scan metadata for archived session files.
  • Only parse JSON for new or modified files.
  • Update the index when a session is archived, instead of waiting for the next startup.
  • Provide an explicit rebuild command for repair/migration cases.

Suggested design

Add a v2 index with a manifest/state file:

session_index_v2/
  meta.json
  records.jsonl
  state.json
  journal.jsonl

Use per-file fingerprints in state.json:

{
  "source_path": "archived_sessions/2026/05/session.jsonl",
  "size": 123456,
  "mtime_ms": 1778760000000,
  "head_hash": "sha256:...",
  "tail_hash": "sha256:..."
}

Startup flow:

  1. Load records.jsonl.
  2. Display known sessions immediately.
  3. Start a background reconcile job.
  4. Reconcile compares file metadata against state.json.
  5. Parse only changed or new files.
  6. Write updates through an append-only journal and compact later.

Acceptance criteria

  • If no archived files changed, startup does not parse archived JSON files.
  • Adding one archived file causes only that file to be parsed.
  • Modifying one archived file causes only that file to be reparsed.
  • Deleting an archived file writes a tombstone or removes the index entry.
  • Corrupt index/journal rows do not block startup.
  • A manual rebuild-session-index command exists for repair.

Workaround

Move cold archived sessions out of archived_sessions so Codex does not see them during startup. This avoids the startup slowdown but does not fix the underlying indexing design.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Codex should treat the session index as a persistent cache and update it incrementally:

  • Load the existing index immediately on startup.
  • Only scan metadata for archived session files.
  • Only parse JSON for new or modified files.
  • Update the index when a session is archived, instead of waiting for the next startup.
  • Provide an explicit rebuild command for repair/migration cases.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop startup rescans archived_sessions instead of incrementally updating session_index.jsonl [1 participants]