codex - 💡(How to fix) Fix `codex resume` picker is slow with many local sessions because thread/list scans rollout files [1 comments, 2 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#19517Fetched 2026-04-26 05:16:05
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1

Root Cause

Source inspection suggests the picker requests thread/list sorted by updatedAt. The local rollout listing path must stat all rollout files to sort by mtime, then read rollout heads for matching rows. This happens even when the SQLite state DB exists because the picker sends useStateDbOnly: false, and the backend uses a filesystem-first scan-and-repair path for filtered listings.

RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.125.0

What subscription do you have?

ChatGPT Pro

Which model were you using?

What platform is your computer?

Linux 6.17.0-22-generic x86_64

What terminal emulator and version are you using (if applicable)?

What issue are you seeing?

Running codex resume can take several seconds before the resume picker becomes usable when the local ~/.codex/sessions directory contains many rollout files.

Source inspection suggests the picker requests thread/list sorted by updatedAt. The local rollout listing path must stat all rollout files to sort by mtime, then read rollout heads for matching rows. This happens even when the SQLite state DB exists because the picker sends useStateDbOnly: false, and the backend uses a filesystem-first scan-and-repair path for filtered listings.

On one local profile there are about 574 rollout files across 141 day directories, and codex resume can appear to hang/thinking for around 10 seconds.

What steps can reproduce the bug?

  1. Accumulate many local sessions under ~/.codex/sessions/YYYY/MM/DD/.
  2. Run codex resume with no session id.
  3. Observe the delay before the resume picker is populated.

What is the expected behavior?

The resume picker should open quickly, ideally using the SQLite state DB or another lightweight index for updatedAt ordering, and only scan rollout JSONL files as a fallback or background repair path.

Additional information

Relevant code paths:

  • codex-rs/tui/src/resume_picker.rs sends thread/list with sortKey: updatedAt and useStateDbOnly: false.
  • codex-rs/rollout/src/list.rs documents that updatedAt ordering must scan all files up to the scan cap because updated time is not encoded in filenames.
  • codex-rs/rollout/src/recorder.rs performs filesystem-first listing before querying SQLite in the scan-and-repair path.

extent analysis

TL;DR

The delay in the codex resume command can be mitigated by optimizing the rollout file listing process, potentially by utilizing the SQLite state DB for sorting and filtering.

Guidance

  • Investigate modifying the codex-rs/tui/src/resume_picker.rs to set useStateDbOnly: true when the SQLite state DB exists, to prioritize database queries over filesystem scans.
  • Review the codex-rs/rollout/src/list.rs and codex-rs/rollout/src/recorder.rs code paths to optimize the filesystem-first scan-and-repair approach, potentially by introducing a caching mechanism or improving the efficiency of the rollout file listing process.
  • Consider introducing a threshold for the number of rollout files to determine when to switch from a filesystem-based approach to a database-based approach for sorting and filtering.
  • Verify the performance impact of these changes by testing with a large number of rollout files and measuring the time it takes for the resume picker to become usable.

Example

No code example is provided as the issue requires a deeper understanding of the Codex CLI codebase and its internal workings.

Notes

The provided information suggests that the issue is related to the way the Codex CLI handles rollout file listing and sorting. However, without further investigation and testing, it is difficult to provide a definitive solution. The suggested guidance points are intended to help mitigate the issue, but may require additional modifications and testing to fully resolve the problem.

Recommendation

Apply workaround: Modify the codex-rs/tui/src/resume_picker.rs to set useStateDbOnly: true when the SQLite state DB exists, and investigate optimizing the rollout file listing process to improve performance. This approach prioritizes database queries over filesystem scans, which may help reduce the delay in the codex resume command.

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…

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 resume` picker is slow with many local sessions because thread/list scans rollout files [1 comments, 2 participants]