Windows Codex CLI loses terminal scrollback history after long responses
What version of Codex CLI is running?
codex-cli 0.145.0
What subscription do you have?
Plus
Which model were you using?
gpt-5.6sol
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What terminal emulator and version are you using (if applicable)?
VS Code
Codex doctor report
## Windows: Codex CLI loses terminal scrollback history after long responses
### Codex version
codex-cli 0.145.0
### Platform
- Windows 10 x64
- Windows 11 x64
### Terminal environment
Tested with:
- VS Code integrated terminal
- Windows Terminal
Terminal supports VT processing and truecolor output.
Installation method:
- npm
### Describe the bug
When Codex generates a long response, once the output exceeds the visible terminal height, previous content disappears permanently.
The terminal scrollback buffer does not contain the missing content. Scrolling up with the mouse wheel or terminal scrollbar cannot recover the previous output.
It looks like Codex CLI is rendering the conversation inside a fixed-height TUI region and discarding content outside that region.
Other CLI AI coding tools (for example Claude Code) do not have this issue in the same terminal environment. Their previous output remains available through normal terminal scrolling.
### Steps to reproduce
1. Install Codex CLI on Windows.
2. Start a conversation.
3. Ask Codex to generate a long response (for example a large code explanation, architecture design, or file diff).
4. Wait until the response exceeds one terminal screen height.
5. Try scrolling back.
### Expected behavior
The complete conversation history should remain available through terminal scrollback, like normal CLI applications.
### Actual behavior
Older output disappears after leaving the visible terminal area.
### Additional information
I tested this on both Windows 10 and Windows 11, and the issue reproduces consistently.
The terminal itself works correctly with other CLI applications, so this appears to be related to Codex CLI's TUI rendering behavior rather than terminal configuration.
### Possible improvement
Please consider providing a non-TUI output mode or a setting that preserves normal terminal scrollback behavior, similar to traditional CLI output.
What issue are you seeing?
Codex CLI loses terminal scrollback history after long responses on Windows.
When Codex generates a response longer than the visible terminal area, previous output disappears permanently. Scrolling up with the terminal scrollbar or mouse wheel cannot recover the missing content.
It seems that Codex CLI renders output inside a fixed-height TUI area and discards content outside the visible region.
Environment:
- Codex CLI version: 0.145.0
- OS: Windows 10 x64 / Windows 11 x64
- Installation method: npm
- Terminal: VS Code integrated terminal and Windows Terminal
Other CLI AI coding tools such as Claude Code work correctly in the same terminal environment, where previous output remains available through normal terminal scrolling.
What steps can reproduce the bug?
- Install Codex CLI on Windows.
- Open Codex CLI in a terminal.
- Ask Codex to generate a long response, for example:
- a large code explanation
- architecture design
- a large file diff
- Wait until the response exceeds one terminal screen height.
- Try scrolling back using the terminal scrollbar or mouse wheel.
Actual result:
The previous output is missing and cannot be recovered from the terminal scrollback buffer.
This happens consistently on both Windows 10 and Windows 11.
No special code snippet is required to reproduce this issue. Any sufficiently long Codex response triggers it.
What is the expected behavior?
The complete Codex response should remain available in the terminal scrollback buffer.
Users should be able to scroll back and review previous output, similar to normal CLI applications.
Long responses should not disappear after leaving the visible terminal area.
Additional information
I tested this with multiple terminals:
- VS Code integrated terminal
- Windows Terminal
The terminal scrollback works normally with other CLI applications, so this does not appear to be a terminal configuration issue.
The issue seems related to Codex CLI's TUI rendering behavior on Windows.
A possible improvement would be providing a non-TUI output mode or an option to preserve normal terminal scrollback behavior.
1 Comment
I can reproduce this on
codex-cli 0.146.0in Windows Terminal withPowerShell 7.6.3 on Windows 11 (
10.0.22621 x64).Importantly, the issue still reproduces when starting Codex with:
```powershell
codex --no-alt-screen
So this is not only alternate-screen behavior. In this mode, the visible
history is still limited to approximately the current terminal viewport
height. Making the terminal window taller reveals more history, but scrolling
up cannot recover content that has moved out of the viewport.
Ctrl+T can still show the missing content in the transcript overlay, so the
transcript data is retained; only the main terminal scrollback is lost.
I inspected the source matching 0.146.0 (rust-v0.146.0,
e363b08c9175ac1cbe5893615dd2cb9ddf95043b). In inline mode, finalized
history is inserted using a partial DECSTBM scroll region:
queue!(writer, SetScrollRegion(1..area.top()))?;
https://github.com/openai/codex/blob/e363b08c9175ac1cbe5893615dd2cb9ddf95043b/codex-rs/tui/src/insert_history.rs#L193-L245
On Windows Terminal, rows that scroll out of this partial region do not enter
the main terminal scrollback. This matches the viewport-height-dependent
behavior.
The source also has a Windows-specific uncertainty here:
// TODO(nornagon): is this supported on Windows?
https://github.com/openai/codex/blob/e363b08c9175ac1cbe5893615dd2cb9ddf95043b/codex-rs/tui/src/insert_history.rs#L331-L348
The main TUI event stream also ignores mouse events, while the Ctrl+T
transcript overlay has its own internal scrolling. A Windows Terminal /
ConPTY integration test that verifies actual scrollback contents would likely
catch this.