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:
- Start at the latest assistant message.
- Scroll upward to earlier output.
- One or more complete lines are missing in terminal history.
- 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:
- Starts a fresh tmux session.
- Emits filler lines.
- Emits numbered stream lines (
S-0001toS-0400) using a Codex-like history insertion escape pattern. - 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.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗