Skip to content

bug(cli): reasoning summaries may be omitted and some responses stream events can crash the CLI #16801

@steveday763

Description

@steveday763

What version of Codex is running?

codex-cli 0.118.0

Which model were you using?

gpt-5.4

What platform is your computer?

Linux x86_64

What issue are you seeing?

I started investigating a TUI rendering issue where reasoning summaries are present in the session JSONL but not shown in the live TUI.

While validating a minimal local fix for that, I also ran into crashes in the same Responses stream handling path, for example:

  • ReasoningSummaryPartAdded without active item
  • OutputTextDelta without active item

So there appear to be two closely related problems here:

  1. completed reasoning items can contain summary text that is recorded but not rendered live
  2. the stream state machine is brittle when reasoning/output-text events arrive before the corresponding active item is established

What steps can reproduce the bug?

  1. Run Codex CLI on the Responses API path.
  2. Enable reasoning summaries in config, for example:
model_reasoning_effort = "xhigh"
model_reasoning_summary = "auto"
use_experimental_reasoning_summary = true
hide_agent_reasoning = false
show_raw_agent_reasoning = false
model_supports_reasoning_summaries = true
  1. Start a session that returns reasoning summary data.
  2. Observe that the reasoning summary may be recorded in the session log but not shown in the live TUI.
  3. While validating that path, some streams can also trigger crashes because reasoning/output-text events arrive before the corresponding active item is active.

What is the expected behavior?

  • If a completed reasoning item contains summary text, the live TUI should render it.
  • The client should handle these event-ordering edge cases without crashing.

Additional information

I found a session entry like this in the JSONL log:

{
  "timestamp": "2026-04-04T14:53:06.784Z",
  "type": "response_item",
  "payload": {
    "type": "reasoning",
    "summary": [
      {
        "type": "summary_text",
        "text": "..."
      }
    ]
  }
}

This suggests the reasoning summary is present in the stream/session log, but the live TUI still does not render it.

The crashes I hit while validating this path were:

  • ReasoningSummaryPartAdded without active item
  • OutputTextDelta without active item

I put together a small branch in my fork with two commits covering both aspects:

  • branch: steveday763/fix/reasoning-and-output-delta-ordering
  • commits:
    • 7a1a825 fix(tui): render live reasoning summaries from completed items
    • 9795819 fix(core): tolerate orphan reasoning and output text events

Metadata

Metadata

Assignees

Labels

TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayagentIssues related to the core agent loopbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions