Agent output getting truncated in the middle of the terminal scrollback

Open 💬 9 comments Opened May 28, 2026 by cowwoc

Problem statement

While reading assistant output in the terminal, entire lines can disappear from the middle of previously rendered output.

Observed user workflow:

  1. Start at the latest assistant message.
  2. Scroll upward to earlier output.
  3. One or more complete lines are missing in terminal history.
  4. Missing lines are still present in transaction/log view.

The original reporter also observes this in Windows Terminal without tmux.

Repro environment used here

  • Linux container environment
  • tmux available
  • Deterministic harness added under repro/

Repro script

Run:

./repro/tmux_scrollback_repro.sh

Script behavior:

  1. Starts a fresh tmux session.
  2. Emits filler lines.
  3. Emits numbered stream lines (S-0001 to S-0400) using a Codex-like history insertion escape pattern.
  4. Captures pane history and checks for missing sequence entries.

Expected result

No missing S-#### lines.

Observed result

Deterministic missing middle line in this environment (commonly S-0391).

Example output:

capture_file=/tmp/codex-scroll-repro/capture.txt

missing_file=/tmp/codex-scroll-repro/missing.txt

missing_count=1

missing_examples:

S-0391

Control run

Run:

./repro/tmux_scrollback_repro.sh --plain

Observed control result:

  • missing_count=0

Attached artifacts

  • Repro harness: repro/tmux_scrollback_repro.sh
  • Repro notes: repro/line_truncation_repro.md
  • Testcase baseline: codex-rs/tui/tests/suite/vt100_history.rs (incremental_stream_history_keeps_all_numbered_lines)

Direct links are in the issue comments.

Related issues

This issue might be related to #15380.

View original on GitHub ↗

9 Comments

grnbtqdbyx-create · 2 months ago

I packaged this repro shape into a trace-to-skill@0.1.65 demo/report checklist so future scrollback truncation reports can include the same evidence fields instead of only screenshots:

npx trace-to-skill@0.1.65 demo terminal-output-integrity
npx trace-to-skill@0.1.65 codex-report ./runs --output openai-codex-terminal-output.md

The detector keys on the useful details from this thread/class: tmux_scrollback_repro.sh, missing_count, missing numbered stream lines such as S-0391, the control run, terminal capture, raw transcript/log proof, terminal dimensions/scrollback settings, streaming state, and whether /resume or transcript mode recovers the missing lines.

Not a Codex fix, just a small evidence normalizer for maintainers and reporters.

Release: https://github.com/grnbtqdbyx-create/trace-to-skill/releases/tag/v0.1.65

cowwoc · 2 months ago

@fcoury-oai were you able to reproduce the problem using the testcase?

DMIGitH · 1 month ago

This is just getting worse. Adding the tui alternate_never feels like a slight reduction but not even close to being a fix.

cowwoc · 7 days ago

@etraut-openai I can still reproduce this issue on v1.148.0. This is particularly painful because I can't safely scroll back through the terminal history without risking permanent gaps in the output.

The issue is 100% reproducible in my environment, and I've provided a deterministic testcase. Could someone from the Codex team please try running it on your end?

I'd be happy to prepare a PR if you’re open to reviewing and accepting a fix. Please let me know whether that would be useful and where you'd recommend starting.

Potentially related issues: https://github.com/openai/codex/issues/15380, https://github.com/openai/codex/issues/26570, https://github.com/openai/codex/issues/27644, https://github.com/openai/codex/issues/30745

DMIGitH · 7 days ago

It is a major PITA but in the cli window resizing the window causes the entire contents to be redrawn. At that point I can safely scroll up and view the trashed text.

cowwoc · 7 days ago

I tested Codex 0.149.0, which includes PR #39619.

Findings:

  • The relevant TUI scrollback tests passed: 4 passed, 0 failed.
  • The deterministic Linux/tmux reproduction from this issue still failed: missing_count=1, with S-0391 missing.
  • The plain-output control passed with missing_count=0.

PR #39619 is clearly related because it fixes the Windows Terminal path by avoiding partial DEC scroll regions and preserving scrollback. However, it ultimately did not fix the same problem reproduced here under Linux/tmux. The issue remains reproducible in that environment.

michael-jennings · 15 hours ago

same issue. how is this a freaking thing since may 27

cowwoc · 13 hours ago

@michael-jennings This issue isn't getting enough visibility. If you want it fixed, try to recruit more users to vote for it.