Skip to content

Feature request: shard and lazily load long Codex sessions after compaction #22088

Closed

Description

@olet

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

26

What subscription do you have?

pro

What platform is your computer?

win

What issue are you seeing?

Feature request: shard and lazily load long Codex sessions after compaction

Problem:
Long Codex Desktop sessions can become very slow or freeze. After a session has been compacted, older raw transcript content is usually no longer needed in active model context. Its main remaining value is occasional user backscroll / audit / recovery. Keeping the full pre-compaction transcript parsed, rendered, or resident in memory makes long-running sessions unstable.

Additional observed behavior:

In Codex Desktop 26.506.31421 on Windows, once a session becomes very long, even basic controls become sluggish. Clicking Send or Stop does not respond immediately; the UI freezes or stalls for a while before the action is reflected.

This suggests the problem is not only model latency or context size. The main window/event loop appears to be doing too much work over the accumulated session history, likely from keeping old transcript/render state hot or reprocessing too much session data during user actions.

The desired behavior is that Send/Stop should remain responsive regardless of total historical session length. After compaction, pre-compaction raw history should be cold backscroll data, not part of the hot UI/runtime state.

Requested behavior:
After compaction, Codex should treat earlier raw history as cold history, not hot context.

Suggested design:

  1. Keep appending to the canonical rollout JSONL for durability.
  2. Build a shard manifest over the rollout file, e.g. json001.jsonl, json002.jsonl, etc.
  3. On session restore, load only:
    • session metadata
    • compaction summary
    • recent messages
    • shard index / manifest
  4. In the main conversation window, use virtualized scrolling.
  5. Hydrate old message ranges only when the user scrolls near them.
  6. Unload old hydrated ranges from memory when they leave the viewport.
  7. Never reinsert pre-compaction raw transcript into active model context unless explicitly requested for some recovery/debug flow.

Why this matters:
For long sessions, old transcript text is no longer active reasoning context after compaction. It should behave like paged storage, similar to chunked map loading in a game: visible nearby chunks stay hot, distant chunks stay on disk.

Expected result:

  • Long sessions remain responsive.
  • Backscroll still works.
  • Session files remain durable.
  • Memory usage is bounded by viewport/recent-context size rather than total transcript length.

What steps can reproduce the bug?

What is the expected behavior?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appcontextIssues related to context management (including compaction)enhancementNew feature or requestperformancesessionIssues 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