feat(tui): auto-collapse reasoning blocks only when the reasoning phase ends - #82037
Closed
JElfferich wants to merge 1 commit into
Closed
feat(tui): auto-collapse reasoning blocks only when the reasoning phase ends#82037JElfferich wants to merge 1 commit into
JElfferich wants to merge 1 commit into
Conversation
…se ends Under display.sections.thinking: collapsed, the TUI now keeps the LIVE reasoning panel open while reasoning streams and collapses it the moment the reasoning phase ends (first tool call, final answer, or new turn). Previously 'collapsed' meant the panel was always collapsed — including the currently-streaming reasoning — and there was no way to get 'expanded while live, collapsed when done'. This makes 'collapsed' an auto preference: - turnController tags the open reasoning segment isLiveReasoning and seals the tag in endReasoningPhase/closeReasoningSegment - streamingAssistant passes reasoningActive only to the live segment, so sealed reasoning segments from earlier phases stay collapsed - ToolTrail auto-opens while reasoningActive under collapsed mode; expanded/hidden/MoA-reference semantics are unchanged Adds thinkingLiveCollapse.test.tsx covering open-on-stream, close-on- finish (including mid-turn rerender), and the expanded-mode no-op.
JElfferich
force-pushed
the
feat/tui-reasoning-collapse-on-finish
branch
from
August 8, 2026 21:56
4547a4e to
6ef4ef7
Compare
Contributor
|
Thanks for this fix! It was salvaged into #86771 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing since the work has landed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
display.sections.thinking: collapsednow behaves as an auto preference: the TUI keeps the live reasoning panel open while reasoning streams, and collapses it the moment the reasoning phase ends (first tool call, final answer, or new turn)expanded/hidden/ MoA-reference panel semantics are unchangedMotivation
With
thinking: collapsed, the TUI collapsed every reasoning block — including the one currently being generated — so users couldn't watch reasoning stream while keeping finished blocks tidy. There was no mode for "expanded while live, collapsed when done". This PR makescollapsedthat mode.Changes
ui-tui/src/app/turnController.ts—syncReasoningSegment()tags the open segmentisLiveReasoning;endReasoningPhase()/closeReasoningSegment()seal the tag when reasoning endsui-tui/src/components/streamingAssistant.tsx— passesreasoningActiveonly to the live segment (block.msg.isLiveReasoning), not to every blockui-tui/src/components/thinking.tsx—ToolTrailauto-opens whilereasoningActiveundercollapsedmode;expanded/hidden/MoA references keep manual/current semanticsui-tui/src/components/messageLine.tsx— threadsreasoningActivethrough toToolTrailui-tui/src/types.ts— newMsg.isLiveReasoningfieldui-tui/src/__tests__/thinkingLiveCollapse.test.tsx— new tests: open-on-stream, collapse-on-finish (incl. mid-turn rerender), expanded-mode no-opTest Plan
npm run typecheckpassesnpm run buildpassesthinkingLiveCollapse.test.tsx(4 tests) + existingdetails,messageLine,thinkingMoaReferenceVisibility,blockLayout,queueSubmissionsuites all passsubscriptionOverlay/ink-backpressure/appChromeBlockedTimers— unrelated, A/B-verified on unpatched HEAD)Notes for Reviewers
isLiveReasoningflag approach was chosen over "last thinking segment" heuristics because the turn controller already tracks the open segment index precisely, and the flag survives segment merging (mergeToolShelfIntospreads the target msg).display.sections.thinking: collapsedconfig value — no new config keys.Semantics change (reviewer note)
display.sections.thinking: collapsedpreviously meant "always collapsed". This PR redefines it as an auto preference: expanded while reasoning is live, collapsed when the reasoning phase ends. The strict "never expanded" behavior is still reachable viadisplay.sections.thinking: hidden, and manual chevron clicks mid-stream still win (the auto-open only re-applies when the reasoning phase changes). Alternative considered: a newautomode value leavingcollapsedstrict — rejected to avoid a second knob for the same concept; happy to split if maintainers prefer.