Repository navigation
Description
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:
- The backend / OpenAI upstream is actively streaming
response.output_text.deltaevents in real time. - Tens of thousands of tokens (megabytes of payload) are arriving at the client socket continuously.
- 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\nto commit the line. - Because no newline is emitted, the line buffer never commits a line to the transcript, and the status indicator remains stuck on
Working. - Only when the user presses
Escor when the response reaches completion (e.g. atmax_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?
- Launch
codexin interactive TUI mode. - 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."
- Observe:
- The TUI displays
• Working (Xm Ys • esc to interrupt)and spins. - No characters appear on screen for the duration of the turn.
- Pressing
Escimmediately interrupts and reveals that thousands of tokens had already been received.
- The TUI displays
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