Skip to content

fix(tui): clear first inline viewport render#21450

Merged
fcoury-oai merged 5 commits intomainfrom
codex/fix-first-frame-clear
May 7, 2026
Merged

fix(tui): clear first inline viewport render#21450
fcoury-oai merged 5 commits intomainfrom
codex/fix-first-frame-clear

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

Why

The alpha TUI can render the initial trust-directory prompt with stale terminal text showing through spaces when startup begins below existing shell output. The first inline viewport transition can happen while the previous viewport is still empty, so the old clear path no-ops before Ratatui draws the prompt. Ratatui then skips blank cells because its previous buffer also thinks those cells are blank, leaving old terminal contents visible inside the prompt.

What Changed

  • Clear from the new inline viewport top when the previous viewport is empty during a viewport transition.
  • Keep the existing clear-from-old-viewport behavior for normal viewport updates.
  • Add a VT100-backed regression test that pre-fills terminal contents, performs the first viewport clear, and verifies stale text inside the new viewport is removed while shell content above the viewport remains.

How to Test

  1. Start Codex alpha in a terminal that already has visible shell output above the cursor.
  2. Use a fresh untrusted project directory so the trust-directory prompt appears.
  3. Confirm the prompt text renders cleanly, with spaces staying blank instead of showing fragments of previous shell output.
  4. As a regression check, confirm content above the inline viewport is still preserved in terminal scrollback.

Targeted tests:

  • cargo test -p codex-tui first_viewport_change_clears_from_new_viewport_when_old_viewport_is_empty -- --nocapture
  • cargo test -p codex-tui

@fcoury-oai fcoury-oai force-pushed the codex/fix-first-frame-clear branch from 309b99c to 554598a Compare May 7, 2026 01:32
@fcoury-oai fcoury-oai enabled auto-merge (squash) May 7, 2026 02:28
@fcoury-oai fcoury-oai merged commit 5a4b270 into main May 7, 2026
26 checks passed
@fcoury-oai fcoury-oai deleted the codex/fix-first-frame-clear branch May 7, 2026 02:48
@github-actions github-actions Bot locked and limited conversation to collaborators May 7, 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.

2 participants