[CLI/TUI] Resume renders the full thread history instead of bootstrapping the latest turn

Open
#34,663 9 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
cli

Research direction

Start in codex-rs/tui/src/app_server_session.rs at thread_resume_params_from_config, then read the app-server README sections for excludeTurns and initialTurnsPage. Trace the resume request and add a TUI regression test asserting that bootstrap history contains only the latest completed turn while the rollout remains unchanged and full context is preserved.

Written by the indexing model from the issue text.

Description

CLI enhancement performance session TUI windows-os

What version of Codex CLI is running?

Reproduced on codex-cli 0.145.0 (also observed on 0.144.6).

What subscription do you have?

ChatGPT subscription (exact tier not disclosed).

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Windows 11 Professional, build 10.0.26200, x64.

What terminal emulator and version are you using?

Windows Terminal 1.24.11911.0, PowerShell, no terminal multiplexer.

Codex doctor report

Fresh codex doctor --json result, summarized to exclude local paths, user
names, thread identifiers, and private configuration details:

  • standalone Windows installation;
  • CLI 0.145.0;
  • Windows Terminal detected;
  • config load and rollout/database parity both healthy;
  • overall status ok and current version not older than the latest release.

What issue are you seeing?

Resuming a long Codex CLI thread in the TUI visibly rebuilds the entire previous
conversation before reaching the prompt. Multi-day sessions therefore spend
noticeable time replaying old turns and produce a long scrolling sequence, even
though only the most recent completed turn is needed for the initial human-facing
view.

The desired behavior is display truncation, not history deletion: keep the full
rollout and full model continuity, but show only the latest completed
user/assistant turn in the TUI. The terminal does not need an older-history
expansion interface; if prior context matters, the user can ask Codex directly.

What steps can reproduce the bug?

  1. Create or use a Codex CLI thread with several large turns over multiple days.

  2. Close the TUI normally.

  3. In Windows Terminal, run codex resume <thread-id>.

  4. Observe that the TUI renders/replays the historical turns before settling at
    the current prompt.

  5. Compare the app-server resume paths for the same stored thread:

    • default thread/resume returns the full thread.turns payload;
    • thread/resume with excludeTurns: true and
      initialTurnsPage: {limit: 1, sortDirection: "desc", itemsView: "full"}
      returns only the newest turn page for a legacy thread.

Private thread identifiers and transcript contents are intentionally omitted.

What is the expected behavior?

On resume, the TUI should become interactive after rendering only the latest
completed turn. Older turns should not be rendered in the terminal. The complete
conversation should remain stored and remain available to Codex as model context,
so the user can ask Codex for earlier context when needed. Resuming must not
truncate, compact, rewrite, or replace the rollout.

Additional information

One legacy rollout was 6,046,582 bytes and contained eight reconstructed turns.
Elapsed time is from one local trial and is not intended as a stable performance
claim.

CLI Resume path Time Response bytes Returned turns
0.144.6 Default full resume 1.176 s 509,897 8
0.144.6 One-turn page 0.931 s 29,672 1
0.145.0 Default full resume 1.860 s 510,100 8
0.145.0 One-turn page 0.174 s 29,875 1

On 0.145.0, the one-turn request reduced response data by about 94.1% and
elapsed time by about 90.6% in this single trial. The rollout SHA-256, file
size, and modification time were identical before the upgrade and after both
requests. The active session count also remained unchanged.

The app-server already documents excludeTurns, initialTurnsPage, and cursor
pagination:

https://github.com/openai/codex/blob/main/codex-rs/app-server/README.md

At the rust-v0.145.0 release commit, the TUI's
thread_resume_params_from_config constructs ThreadResumeParams and finishes
with ..ThreadResumeParams::default(). That leaves exclude_turns = false and
initial_turns_page = None, so the terminal client requests the full legacy
history:

https://github.com/openai/codex/blob/25af12f7e61572b0bc18ddb1008be543b91519b0/codex-rs/tui/src/app_server_session.rs#L1539-L1588

Suggested acceptance criteria
  1. Resume a large legacy thread without rendering every historical turn first.
  2. Show the latest completed user/assistant turn at bootstrap.
  3. Do not add an older-history expansion requirement to the terminal view.
  4. Preserve the original rollout byte-for-byte during a display-only resume.
  5. Preserve the full model-visible thread context.
  6. Let the user recover earlier context by asking Codex naturally.
  7. Add a TUI regression test asserting one-turn bootstrap history.
Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

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.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.