openai / openai/codex

TUI: Ctrl+L clears the Ctrl+T transcript until switching away and back

Open
#43,392 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI TUI
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.153.4 (installed via pnpm)

What subscription do you have?

API key authentication with a custom provider.

Which model were you using?

Configured model: gpt-6-astra.

What platform is your computer?

Ubuntu 22.04.1 LTS running under WSL2.

Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 x86_64
What terminal emulator and version are you using (if applicable)?

Windows Terminal (version not recorded), with zellij 0.44.3. TERM=xterm-256color.

Codex doctor report

Summary of local codex doctor --json output; full output omitted here because it contains local paths, session identifiers, and custom endpoint details:

  • Codex version: 0.153.4; platform: linux-x86_64.
  • Installation, configuration loading, and database integrity checks passed.
  • Terminal multiplexer detected: zellij 0.44.3.
  • Warnings: 59 active rollout files missing corresponding state DB rows; 20 rollout scan errors; latest-version network probe timed out. Cached latest version: 0.153.4.
  • The relationship of these warnings to this UI issue has not been established.
What issue are you seeing?

I reproduced this on my local machine: pressing Ctrl+L clears the terminal display, but also removes earlier conversation exchanges from the Ctrl+T transcript viewer.

Switching away from the conversation and back using /side restores the transcript. The same conversation's history is therefore unavailable immediately after clearing, but available again after switching views.

What steps can reproduce the bug?
  1. Start a conversation and complete several exchanges.
  2. Open Ctrl+T, verify those exchanges are visible, and close the viewer.
  3. While Codex is idle, press Ctrl+L.
  4. Open Ctrl+T again: the earlier exchanges are missing.
  5. Close the viewer, switch to a side conversation using /side, and return to the original conversation.
  6. Open Ctrl+T: the earlier transcript is restored.
What is the expected behavior?

Ctrl+L should clear the terminal display while preserving access to the current conversation's history through Ctrl+T. Switching conversations should not be necessary to recover the transcript.

Additional information

Root cause analysis

The current upstream clear-terminal handler calls clear_terminal_ui(...), then reset_app_ui_state_after_clear(). The reset implementation delegates to reset_transcript_state_after_clear(), which calls self.transcript_cells.clear() and resets associated transcript state.

This couples terminal clearing with discarding the loaded UI transcript, explaining the missing earlier exchanges. The observed /side recovery shows those exchanges remain recoverable; this report does not claim that persisted conversation data or model context is deleted.

Proposed fix

Separate display-only clearing for Ctrl+L from the full transcript reset. Preserve history for Ctrl+T, clear pending terminal output, and maintain a display boundary so subsequent redraws or resizes do not unintentionally print the cleared history again. Reuse existing rendering state where possible.

Simply removing transcript_cells.clear() may be insufficient because the same reset also clears reflow and related state. Keep the full reset for operations that actually replace or reset the conversation.

Regression coverage should verify terminal clearing, preservation of earlier exchanges in Ctrl+T, visibility of new exchanges, and consistent behavior across resizing and conversation switching.

Related issues

  • #3259: Requests /clear to start a new conversation and clear the terminal. Related background, but different from display clearing within an existing conversation.
  • #9362: Closed as a duplicate of #3259; mentions Ctrl+L as a screen-clearing workaround but does not report the transcript disappearing.

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 in codex-rs/tui/src/app/input.rs at the Ctrl+L clear-terminal handler, then follow reset_app_ui_state_after_clear and reset_transcript_state_after_clear in history_ui.rs. Reproduce the issue and inspect the existing transcript and rendering state around these functions. Done means Ctrl+L clears the display while Ctrl+T retains earlier and new exchanges across resizing and conversation switching, with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.