Repository navigation
Feature request: shard and lazily load long Codex sessions after compaction #22088
Description
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:
- Keep appending to the canonical rollout JSONL for durability.
- Build a shard manifest over the rollout file, e.g. json001.jsonl, json002.jsonl, etc.
- On session restore, load only:
- session metadata
- compaction summary
- recent messages
- shard index / manifest
- In the main conversation window, use virtualized scrolling.
- Hydrate old message ranges only when the user scrolls near them.
- Unload old hydrated ranges from memory when they leave the viewport.
- 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
Activity
github-actions commentedon May 11, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
RangeError: Invalid string lengthwhen loading sessions whose rollout JSONL exceeds V8's max string length #22004Powered by Codex Action