codex - 💡(How to fix) Fix iTerm2 + zsh: --no-alt-screen still does not produce usable native scrollback [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20063Fetched 2026-04-29 06:23:19
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2closed ×1

Code Example

codex --no-alt-screen

---

codex -c 'tui.alternate_screen="never"' --no-alt-screen

---

script -q /tmp/codex-iterm2.tlog codex --no-alt-screen
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.125.0

What subscription do you have?

No response

Which model were you using?

No response

What platform is your computer?

macOS 26.1 arm64 (Build 25B78)

What terminal emulator and version are you using (if applicable)?

iTerm2 3.7.0beta1

What shell are you using?

zsh

What issue are you seeing?

In iTerm2 with zsh, codex --no-alt-screen still does not behave like a true scrollback-preserving inline terminal mode.

Once the conversation exceeds one screen, native terminal scrollback is not reliably usable for reviewing earlier content. This appears similar to other reports where alternate screen is disabled, but Codex still performs fullscreen redraw behavior in the main buffer.

What steps can reproduce the bug?

  1. Open iTerm2.
  2. Start zsh.
  3. Run:
    codex --no-alt-screen
  4. Interact until the conversation exceeds terminal height.
  5. Try to scroll up using iTerm2’s native scrollback.
  6. Observe that earlier content is missing, truncated, or not preserved like normal append-only terminal output.

I also tested:

codex -c 'tui.alternate_screen="never"' --no-alt-screen

with the same result.

What is the expected behavior?

With --no-alt-screen, Codex should preserve previous conversation output in the normal terminal scrollback buffer, so earlier content can be reviewed using native terminal scrolling.

What do you see instead?

The currently visible rendered screen is available, but prior conversation history is not reliably preserved as native terminal scrollback.

Additional information

This looks like --no-alt-screen is disabling alternate screen entry, but Codex still uses fullscreen redraw patterns in the main buffer instead of a true inline / append-only renderer.

Potentially relevant behavior to confirm:

  • cursor addressing (CSI row;col H)
  • screen clears (CSI 2J)
  • scrollback purge (CSI 3J)
  • line clears (CSI K)
  • scroll regions (CSI r)
  • reverse index (ESC M)

If useful, I can attach a terminal capture produced with:

script -q /tmp/codex-iterm2.tlog codex --no-alt-screen

and inspect whether the output contains fullscreen control sequences instead of plain append-only terminal output.

Related issues

  • #2558
  • #10331
  • #14277

Those appear to describe the same class of problem in other terminals: --no-alt-screen helps partially, but does not yet provide a true scrollback-safe inline mode everywhere.

extent analysis

TL;DR

The issue can be mitigated by investigating and potentially modifying Codex's terminal control sequences to use append-only rendering instead of fullscreen redraw patterns.

Guidance

  • Investigate the terminal capture produced with script -q /tmp/codex-iterm2.tlog codex --no-alt-screen to confirm whether the output contains fullscreen control sequences instead of plain append-only terminal output.
  • Verify the usage of cursor addressing, screen clears, scrollback purge, line clears, scroll regions, and reverse index in the Codex output to identify potential causes of the issue.
  • Compare the behavior of Codex with other terminals and versions to determine if this is a specific issue with iTerm2 or a more general problem.
  • Consider modifying the Codex configuration or code to use true inline/append-only rendering instead of fullscreen redraw patterns when --no-alt-screen is enabled.

Example

No code snippet is provided as the issue requires investigation and potential modification of Codex's internal behavior.

Notes

The issue appears to be related to Codex's rendering mode and its interaction with the terminal emulator. The provided related issues suggest that this is a known problem that has been partially addressed but not fully resolved.

Recommendation

Apply workaround: Investigate and modify Codex's terminal control sequences to use append-only rendering, as this is likely to provide a true scrollback-safe inline mode.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix iTerm2 + zsh: --no-alt-screen still does not produce usable native scrollback [2 comments, 3 participants]