Skip to content

Codex TUI hangs on "Working" without rendering output when stream contains long text without newlines #44956

Closed

Description

@wignerStan

What version of Codex CLI is running?

0.153.4

What subscription do you have?

ChatGPT Pro

Which model were you using?

gpt-6-astra, gpt-5.6-luna

What platform is your computer?

Darwin 24.6.0 arm64 (macOS 15.6.0)

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

iTerm2 (Build 3.6.10) / Ghostty

Codex doctor report

not available

What issue are you seeing?

In Codex TUI, when an assistant model generates a continuous sequence of tokens that does not contain any newline character \n (for example, space-separated numbers, raw unformatted JSON, minified code, or continuous stream data), the TUI appears completely hung on:

• Working (Xm Ys • esc to interrupt)

with the spinner running indefinitely, without rendering any visible tokens to the terminal viewport.

By capturing the network traffic on the client connection, we verified that:

  1. The backend / OpenAI upstream is actively streaming response.output_text.delta events in real time.
  2. Tens of thousands of tokens (megabytes of payload) are arriving at the client socket continuously.
  3. However, Codex TUI's streaming markdown renderer (chatwidget/streaming.rs) uses newline-buffered streaming logic (newline-committed streaming behavior). Incoming text deltas are queued in memory waiting for a newline character \n to commit the line.
  4. Because no newline is emitted, the line buffer never commits a line to the transcript, and the status indicator remains stuck on Working.
  5. Only when the user presses Esc or when the response reaches completion (e.g. at max_output_tokens, which can take 15–20+ minutes on large token generations) does the entire multi-megabyte buffer suddenly get flushed and dumped to the screen at once.

To the user, this appears as an apparent stall / freeze with no logs and an artificially huge TTFT.

What steps can reproduce the bug?

  1. Launch codex in interactive TUI mode.
  2. Send a prompt that requests a long sequence without line breaks, for example:

    "Generate a list of 500 random integers between 1 and 1000 separated only by spaces on a single line, with no newlines, no numbering, and no preamble."

  3. Observe:
    • The TUI displays • Working (Xm Ys • esc to interrupt) and spins.
    • No characters appear on screen for the duration of the turn.
    • Pressing Esc immediately interrupts and reveals that thousands of tokens had already been received.

What is the expected behavior?

The streaming renderer should not strictly gate display commits on \n. When an in-progress line exceeds the terminal width or a reasonable token/time threshold, the TUI should soft-wrap and render partial tokens in real time, so the user can see streaming progress even when the model does not emit newline characters.

Additional information

Reference in codex-rs/tui/src/chatwidget/streaming.rs:

  • Line commits rely on newline-delimited chunks (newline-committed streaming behavior).
  • A long unsegmented token stream starves stream_controller.queued_lines(), holding the entire output in memory while keeping the bottom status indicator active.

Activity

  1. added
    bug
    CLI
    TUI
    on Sep 12, 2026
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

    CLITUIbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions