openai / openai/codex

Resume is slow for large legacy sessions due to duplicate full-history processing

Open
#38,349 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug performance session
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

Problem

Resuming some large legacy sessions can take 10–20 seconds or more from selecting the session in the resume picker to a usable composer.

I added temporary timing instrumentation to a local fork and observed the following for one legacy session:

  • 18,795 persisted rollout items and about 219 turns
  • Server history reconstruction: 7.9 seconds
  • Client initial transcript hydration: 4.9 seconds
  • Complete client bootstrap: 14.7 seconds
  • Configuration loading and thread creation were comparatively small (tens to hundreds of milliseconds)

The client requests excludeTurns=true, but the server still reconstructs the full legacy history to initialize the resumed model. The client then separately reads and hydrates the transcript for display, so the same large history is effectively processed twice before the composer is ready.

Suggested improvements

These are proposals based on the timings above; I have not implemented or tested them yet. I will update this issue after testing them in my fork.

  1. Keep the full history available to the resumed model, but return/display only a bounded initial transcript page.
  2. Make older legacy transcript content load lazily when the user scrolls upward.
  3. Reuse the server-side parsed history or an indexed/projection representation instead of reparsing the same rollout for client display.
  4. Migrate legacy rollouts to the paginated/thread-store representation in the background, or maintain a durable parsed/indexed projection.

The first improvement should reduce time-to-ready most directly, while the latter options should reduce the server-side parsing cost.

Environment

This was observed with a local amended build based on Codex alpha code. The measurements came from /home/.../.codex/logs_2.sqlite; no user prompt contents are included here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing resume-picker handling of excludeTurns=true and the server history reconstruction versus client transcript hydration described in the measurements. The issue names no source files or tests; completion would require choosing and validating a bounded initial transcript, lazy loading, history reuse, or a durable parsed representation, with time-to-ready and parsing cost improved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.