Agent output getting truncated in the middle of the terminal scrollback

Open 💬 4 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 ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗