Skip to content

Hide rewind preview when no user message exists#19510

Merged
etraut-openai merged 2 commits intomainfrom
etraut/esc-esc-before-first-turn
Apr 27, 2026
Merged

Hide rewind preview when no user message exists#19510
etraut-openai merged 2 commits intomainfrom
etraut/esc-esc-before-first-turn

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

Why

Fixes #19508.

In a fresh TUI session, pressing Esc twice entered the rewind transcript overlay even though there was no user message to rewind to. That produced an empty header-only transcript view and exposed a rewind flow that could not select a valid target.

What changed

The backtrack flow now checks whether a user-message rewind target exists before opening the transcript preview. If no target exists, Codex stays in the main TUI and shows No previous message to edit. instead of opening an empty overlay.

The same guard applies when starting rewind preview from the transcript overlay, and the first Esc no longer advertises the “edit previous message” hint when there is no previous message available.

Snapshot coverage was added for the unavailable rewind info message, along with a small target-detection test.

@etraut-openai etraut-openai marked this pull request as ready for review April 25, 2026 06:12
@vinhnx
Copy link
Copy Markdown
Contributor

vinhnx commented Apr 25, 2026

Awesome, thanks for the quick fix @etraut-openai!

Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it for both cases: no messages and with some messages.

Code looks good as well. Approved.

@etraut-openai etraut-openai merged commit 6c51bf0 into main Apr 27, 2026
25 checks passed
@etraut-openai etraut-openai deleted the etraut/esc-esc-before-first-turn branch April 27, 2026 16:51
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewind (double escape) should not be shown if there is no user's message.

3 participants