Skip to content

Agent output getting truncated in the middle of the terminal scrollback #24849

Open

Description

@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.

Activity

  1. changed the title [-]Repro artifacts for line truncation / missing middle output line (issue #15380)[/-] [+]Agent output getting truncated in the middle of the terminal scrollback[/+] on May 28, 2026
  2. grnbtqdbyx-create commented on May 31, 2026

    @grnbtqdbyx-create
  3. cowwoc commented on Jun 4, 2026

    @cowwoc
    Author

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

  4. DMIGitH commented on Jul 13, 2026

    @DMIGitH

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

  5. cowwoc commented on Aug 20, 2026

    @cowwoc
    Author

    @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: #15380, #26570, #27644, #30745

  6. DMIGitH commented on Aug 20, 2026

    @DMIGitH

    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.

  7. cowwoc commented on Aug 21, 2026

    @cowwoc
    Author

    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.

  8. michael-jennings commented on Aug 27, 2026

    @michael-jennings

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

  9. cowwoc commented on Aug 27, 2026

    @cowwoc
    Author

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

  10. garysassano commented on Sep 12, 2026

    @garysassano

    Additional current-version evidence from WSL and the VS Code integrated terminal.

    Environment:

    • Codex CLI: codex-cli 0.154.0
    • VS Code: 1.137.0, integrated terminal using xterm.js
    • OS: WSL Ubuntu
    • TERM=xterm-256color
    • No tmux, screen, or Zellij

    After submitting a new prompt, several middle rows from a previous assistant response disappeared from the visible scrollback while the rest of the conversation remained visible. The missing rows were part of a Markdown table. The complete response remained in the local Codex session JSONL, confirming that the model output was retained and the failure was in terminal rendering or scrollback.

    This extends the report to a current 0.154.0 installation and a VS Code xterm.js host. It also appears related to #27644.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions