Skip to content

fix(tui): avoid duplicate live reasoning summaries#15758

Merged
etraut-openai merged 1 commit intoopenai:mainfrom
fcoury:fix/tui-app-server-reasoning-dupe
Mar 25, 2026
Merged

fix(tui): avoid duplicate live reasoning summaries#15758
etraut-openai merged 1 commit intoopenai:mainfrom
fcoury:fix/tui-app-server-reasoning-dupe

Conversation

@fcoury
Copy link
Copy Markdown
Contributor

@fcoury fcoury commented Mar 25, 2026

TL;DR

Fix duplicated reasoning summaries in tui_app_server.

image

During live turns, reasoning text is already rendered incrementally from ReasoningSummaryTextDelta. When the same reasoning item later arrives via ItemCompleted, we should only finalize the reasoning block, not render the same summary again.

What changed

  • only replay rendered reasoning summaries from completed ThreadItem::Reasoning items
  • kept live completed reasoning items as finalize-only
  • added a regression test covering the live streaming + completion path

Why

Without this, the first reasoning summary often appears twice in the transcript when model_reasoning_summary = "detailed" and features.tui_app_server = true.

Skip re-rendering reasoning `summary` and raw `content` when a live
`ThreadItem::Reasoning` arrives via `ItemCompleted`.
`tui_app_server` already renders the same text incrementally from
`ReasoningSummaryTextDelta`, so replaying it on completion duplicates
the visible reasoning block.

Add a regression test that streams a reasoning summary delta and then
completes the same reasoning item. The test proves the duplicate on
current `main` before the fix and ensures the completed live item only
finalizes the reasoning stream instead of painting the same summary
twice.
Copilot AI review requested due to automatic review settings March 25, 2026 11:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes duplicate rendering of agent reasoning summaries in the TUI app-server path by preventing already-streamed reasoning text from being re-rendered when the corresponding ItemCompleted reasoning item arrives.

Changes:

  • Only replays reasoning summary/content deltas from completed reasoning items when rendering from replay (from_replay), while keeping live completions as finalize-only.
  • Adds a regression test covering the live reasoning streaming + item completion scenario to ensure the summary isn’t duplicated.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
codex-rs/tui_app_server/src/chatwidget.rs Adjusts reasoning item completion rendering to avoid re-appending already-streamed reasoning text in live mode.
codex-rs/tui_app_server/src/chatwidget/tests.rs Adds a regression test to ensure a live-streamed reasoning summary isn’t rendered twice upon item completion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fcoury
Copy link
Copy Markdown
Contributor Author

fcoury commented Mar 25, 2026

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af2c1cc296

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@KooshaPari

This comment was marked as off-topic.

Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@etraut-openai etraut-openai merged commit c6ffe9a into openai:main Mar 25, 2026
35 of 40 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants