feat(ui): inline collapsible thinking trail#16
Merged
Conversation
Surface the model's reasoning inline as a faint, collapsible trail (design section 31.19). stream_thinking now retains the thinking text (display-only — never recorded in history or fed back to the model) on a per-phase _Trail; the collapsed view shows the first 10 non-blank lines under a "thinking - N reasoning" header with a "+N hidden lines - press t to expand" footer, and the expanded view shows the full trail with a "press t to collapse" footer. t on an empty dock with no active approval toggles the latest trail (the active one while the model runs, the most-recent after); older trails freeze, with no per-trail selection by design. When there is no trail it falls through to ordinary self-insert (event.data * event.arg) so a message starting with t still types, repeat-count included. Any non-thinking transcript content finalizes the active trail, so a tool call between two reasoning phases yields two separate inline blocks. show_reasoning=False builds no trail; cancel/error/stale-turn cleanup clears only the active trail and never resets finished ones.
lavindeep
added a commit
that referenced
this pull request
Jul 2, 2026
feat(ui): inline collapsible thinking trail
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.
Surfaces the model's reasoning inline in the full-screen app as a faint, collapsible thinking trail (DESIGN §31.19). Additive and gated — a default session with no streamed thinking is byte-identical.
What it does
stream_thinkingnow retains the thinking text (display-only — never recorded in history or fed back to the model) on a per-reasoning-phase_Trail.thinking · N reasoningheader; once lines are hidden, footer… +N hidden lines · press t to expand. Expanded: full trail +press t to collapse. Caret▸/▾(ASCII>/v).ttoggles the latest trail — the active one while the model runs, the most-recent after. Gated to an empty dock with no active approval; older trails freeze (no per-trail selection, by design). With no trail it falls through to ordinary self-insert (event.data * event.arg, repeat-count included) so a message starting withtstill types.show_reasoning=Falsebuilds no trail; cancel/error/stale-turn cleanup clears only the active trail and never resets finished ones._sanitize_line-stripped (model-controlled text).Verification
Phase gate (green):
17 new tests (red-first), covering collapsed/expanded/footer wording, two-phase trails, new-turn-defaults-collapsed, abort/stale cleanup preserving finished trails,
show_reasoning=False, sanitization, theshow_plan_progressfinalize invariant, idle-toggle cache-bust, and allt-key edges (toggle / literal fall-through / numeric-arg repeat / dock-text / during-approval).Live validation —
nemotron-3-super:cloud, full-screen app (SHELLPILOT_UI=app):t→ latest flips to▾ thinking · 92 reasoning+press t to collapse; the older229trail stays▸(untouched).tagain → back to▸; dock stays empty (toggled, not typed).Confirmed end-to-end: real cloud thinking → inline collapsible trail, two-phase blocks, latest-only toggle, finished-trail reopen, approval-mode gating, done line.
Targets
ui-rework. Does not touchmain.