Skip to content

CLI TUI remains visually corrupted after stream disconnect, while resumed session renders normally #22726

Closed

Description

@gormanity

What version of Codex CLI is running?

Observed affected session metadata:

cli_version: 0.128.0

Current installed CLI after/while investigating:

codex-cli 0.130.0

What subscription do you have?

ChatGPT account / subscription-authenticated Codex CLI.

Which model were you using?

gpt-5.5

What platform is your computer?

macOS / Darwin 25.5.0 arm64

What terminal emulator and version are you using?

Ghostty 1.3.1

TERM=xterm-ghostty

What issue are you seeing?

After an internet/network interruption during an active Codex CLI TUI turn, the session recovered enough to continue accepting prompts and completing later turns, but the live terminal UI remained visually corrupted.

Image

The normal Codex TUI formatting/decorations were mostly gone. Instead, the terminal displayed raw/plain transcript-like content, including patch diff lines and raw SVG/XML text, with minimal normal Codex UI framing. This persisted across later prompts in the same still-open session.

The saved session history was also affected in the live view: scrolling/history in that still-open TUI remained corrupted. A functioning workaround was to close the affected TUI session and then reopen the same session with resume. After resuming, the session was usable again and rendered normally.

This appears to be a live TUI renderer/display-state recovery issue after stream disconnect, not permanent loss of the underlying session data.

What steps can reproduce the bug?

I do not have a deterministic repro yet. Observed sequence:

  1. Start an existing interactive Codex CLI TUI session in Ghostty.
  2. Run a task that includes normal tool calls and terminal output.
  3. Network connectivity drops or becomes unstable during the model turn.
  4. Codex retries the sampling request several times.
  5. The turn eventually errors with stream disconnected before completion.
  6. Continue prompting in the same still-open TUI session.
  7. Later turns can complete, but the visual terminal UI and visible session history remain corrupted and show raw/plain transcript-like content instead of the normal TUI rendering.
  8. Close the affected TUI and reopen the same session via resume.
  9. The resumed session renders normally again.

What is the expected behavior?

After stream disconnect/retry failure, Codex should either:

  • recover the TUI into the normal formatted/decorated state, or
  • fail the turn cleanly while preserving a sane terminal display state.

If later turns can run and complete, the TUI display should also recover. If the live TUI cannot recover automatically, resuming should not be required to restore normal rendering.

What happens instead?

The model/session layer appears to recover, but the live TUI display stays degraded/corrupted. The affected session continued accepting prompts and completed a later turn, while the terminal still showed raw/plain content instead of normal Codex TUI formatting. Closing and resuming the session worked around the issue.

Diagnostic evidence

Sanitized identifiers:

thread_id: 019df0f1-a0b7-7b11-b71f-f3f2c8f72141
session file: ~/.codex/sessions/2026/05/04/rollout-2026-05-04T11-04-20-019df0f1-a0b7-7b11-b71f-f3f2c8f72141.jsonl
log file: ~/.codex/log/codex-tui.log

Relevant codex-tui.log excerpt around the apparent failure:

2026-05-14T21:21:06Z stream disconnected - retrying sampling request (2/5)
2026-05-14T21:22:25Z stream disconnected - retrying sampling request (3/5)
2026-05-14T21:22:30Z stream disconnected - retrying sampling request (4/5)
2026-05-14T21:22:35Z stream disconnected - retrying sampling request (5/5)
2026-05-14T21:22:42Z Turn error: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)

Later, the same affected thread completed another turn:

2026-05-14T21:35:44Z task_complete turn_id=019e2866-bb09-73f1-9b8d-ce65e3e39907

So the session was not permanently dead. The persistent failure was the live TUI rendering state.

Related issues checked

I found related stale/reconnect/rendering issues, but not an exact match for this symptom:

This report is specifically about a local CLI TUI session where a stream disconnect failure is followed by continued usable session state but persistently corrupted/raw-looking live TUI rendering, while closing and resuming the same session restores normal rendering.

Activity

  1. etraut-openai commented on May 15, 2026

    @etraut-openai
    Contributor

    If you see this again, please use /feedback to upload logs and session details and post the session ID here.

  2. added
    bug
    TUI
    on May 15, 2026
  3. added a commit that references this issue on May 18, 2026
    deb159d
  4. etraut-openai commented on May 18, 2026

    @etraut-openai
    Contributor

    This will be fixed in an upcoming release.

  5. added a commit that references this issue on Jun 27, 2026
    cf88e96
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

    TUIbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions