fix(tui): avoid duplicate live reasoning summaries#15758
fix(tui): avoid duplicate live reasoning summaries#15758etraut-openai merged 1 commit intoopenai:mainfrom
Conversation
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.
There was a problem hiding this comment.
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/contentdeltas 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.
|
@codex review |
There was a problem hiding this comment.
💡 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".
TL;DR
Fix duplicated reasoning summaries in
tui_app_server.During live turns, reasoning text is already rendered incrementally from
ReasoningSummaryTextDelta. When the same reasoning item later arrives viaItemCompleted, we should only finalize the reasoning block, not render the same summary again.What changed
ThreadItem::ReasoningitemsWhy
Without this, the first reasoning summary often appears twice in the transcript when
model_reasoning_summary = "detailed"andfeatures.tui_app_server = true.