TUI backtrack stops at the bounded initial page when no user prompt is loaded
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of Codex CLI is running?
Official rust-v0.151.0 source (tag commit 78c290807ce710180111df227df3b7a4fe845452). The same short-circuit remains in main at 88f776588f5e73467e7659c268f8358a9a2378b6.
What subscription and model were you using?
Not relevant. This is a local TUI pagination state-machine defect and the deterministic reproduction makes no provider request.
What platform is your computer?
Windows x64. The regression fixture is cross-platform Rust/TUI code.
What issue are you seeing?
After resuming a long paginated thread, the bounded newest transcript page can legitimately contain no user-message cell even though the app-server has a trustworthy cursor for older history.
In that state:
- Open the transcript with
Ctrl+T. - Press
Escto begin backtrack/edit selection. - Codex checks only the currently loaded transcript cells.
- Because that bounded page has no user cell, Codex closes the overlay and reports
No previous message to edit.
It never requests the older pages that contain the user prompt. The direct empty-composer Esc/Esc flow reaches the same loaded-cell-only decision.
This differs from #7356/#7363, which fixed continuity while paging inside an already-open overlay, and from #37421, where a visible selected prompt could not be resolved during fork. Here no prompt is selectable because backtrack exits before following the existing older cursor.
Deterministic reproduction
I added a synthetic paginated rollout with one older user prompt followed by 205 completed assistant items in the newest turn. After bounded resume hydration:
- the loaded transcript has zero user cells;
has_older_historyis true;- the older prompt is reachable after at least three
thread/items/listpage requests.
On unchanged 0.151.0, the regression failed twice at the first backtrack action because the transcript overlay closed immediately instead of loading older history.
The current short-circuit is here:
Expected behavior
When backtrack starts and the loaded tail has no eligible user prompt:
- keep the transcript overlay open;
- while the app-server owns a trustworthy older cursor, request one older page at a time;
- after each page, stop at the newest eligible user prompt as soon as one is present;
- if beginning-of-history is reached with no prompt, close the overlay and show the existing message;
- fail closed if the active thread changes or the cursor is unavailable.
This remains bounded by the existing page size and stops at the first usable prompt; it does not require eagerly loading all history.
Regression coverage
A local fix uses a pending backtrack-target sentinel and the app-server-owned advancing cursor. The new 205-item regression passes and verifies that the prompt is selected/highlighted only after three or more older-page requests. Existing focused coverage also remains green: 17 backtrack tests, 3 pagination tests, and the transcript-Home all-pages test.
No thread identifiers, prompts from a real session, local paths, credentials, databases, or raw logs are included. Per the repository contribution policy, I am not opening an unsolicited PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codex-rs/tui/src/app_backtrack.rs at the short-circuit around lines 268-293, then inspect the focused backtrack and pagination tests. Reproduce the bounded resume state with the synthetic 205-item rollout and trace older-page requests through the app-server cursor. Done means the overlay stays open, selects the older prompt after paging, and preserves the existing no-prompt behavior at beginning of history.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100