Skip to content

Codex Desktop App becomes laggy because it scans all ~/.codex/sessions rollout files instead of respecting Desktop-visible session index/state #20864

Description

@8th-block

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.429.30905 (2345)

What subscription do you have?

Pro and Business

What platform is your computer?

Darwin 25.3.0 arm64 arm

What issue are you seeing?

Summary

Codex Desktop App becomes slow/unresponsive when ~/.codex/sessions contains many rollout JSONL files.

The important point: these session files are not only created by Codex Desktop. They are also created by other Codex clients that share the same CODEX_HOME, including CLI, codex exec, app-server clients, VS Code-style clients, and subagents.

Desktop appears to scan/read the entire ~/.codex/sessions folder, even though ~/.codex/session_index.jsonl contains a much smaller set of sessions that seem to be the intended Desktop-visible history.

Clearing or moving files out of ~/.codex/sessions immediately fixes the Desktop UI lag.

Environment

  • Codex Desktop App: Version 26.429.30905 (2345)
  • Codex CLI: codex-cli 0.128.0
  • OS: macOS
  • Platform: Apple Silicon / Darwin
  • CODEX_HOME: default ~/.codex

Actual behaviour

Codex Desktop App becomes laggy as ~/.codex/sessions grows.

In my local case:

find ~/.codex/sessions -type f -name '*.jsonl' | wc -l
# 109

du -sh ~/.codex/sessions
# 78M

wc -l ~/.codex/session_index.jsonl
# 22

The Desktop app becomes responsive again after clearing/moving files out of ~/.codex/sessions.

What steps can reproduce the bug?

  1. Use Codex Desktop App with the default CODEX_HOME.
  2. Also use Codex CLI / app-server / other Codex clients that share the same CODEX_HOME.
  3. Let ~/.codex/sessions accumulate many rollout JSONL files.
  4. Open Codex Desktop App.
  5. Observe Desktop UI lag/slowness.
  6. Move or clear old files from ~/.codex/sessions.
  7. Reopen Codex Desktop App.
  8. Observe that the lag is resolved.

What is the expected behavior?

Codex Desktop App should not eagerly scan or parse every rollout JSONL file under ~/.codex/sessions.

Desktop should only load the sessions it needs for its UI, using a bounded/indexed source of truth such as:

  • ~/.codex/state_5.sqlite
  • ~/.codex/session_index.jsonl
  • Desktop-visible source filters
  • lazy loading when a specific thread is opened

The Desktop UI should not degrade just because other Codex clients share the same CODEX_HOME.

Evidence / investigation

The sessions folder contains rollout files from multiple sources, not just Desktop-created sessions.

Observed source breakdown included:

vscode: 64
exec: 22
cli: 3
subagent / guardian / thread_spawn: multiple

Meanwhile:

~/.codex/session_index.jsonl: 22 entries
~/.codex/sessions: 109 rollout files

Archived sessions are physically moved out of the hot sessions tree into:

~/.codex/archived_sessions/

and state_5.sqlite marks them as archived. This suggests that files physically present under ~/.codex/sessions are on the Desktop hot path.

Additional information

Suggested fix

Make Codex Desktop App avoid full eager scans of ~/.codex/sessions.

Possible approaches:

  • Use state_5.sqlite or session_index.jsonl as the bounded source for Desktop history.
  • Filter by Desktop-relevant sources before touching rollout JSONL contents.
  • Lazy-load rollout files only when opening a specific thread.
  • Avoid scan-and-repair work across all rollout files during normal Desktop startup or history rendering.
  • Add a way to hide/archive non-Desktop sessions from Desktop history.

The core issue is that Codex Desktop App appears to pay an O(number/size of all rollout files) cost for a shared sessions directory that is written by many Codex clients.

Activity

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

    appIssues related to the Codex desktop appbugSomething isn't workingperformancesessionIssues involving session (thread) management, resuming, forking, naming, archiving

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions