feat(app): collapsible reasoning cards - #46344
Open
4ebuRushka wants to merge 3 commits into
Open
4ebuRushka wants to merge 3 commits into
4ebuRushka wants to merge 3 commits into
Conversation
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
4ebuRushka
force-pushed
the
feat/collapsible-reasoning
branch
from
August 31, 2026 06:01
229c315 to
e9e55a5
Compare
6 tasks
4ebuRushka
force-pushed
the
feat/collapsible-reasoning
branch
2 times, most recently
from
September 8, 2026 03:50
e320bce to
d71a9ab
Compare
Add collapsibleReasoning setting (default true) with persisted store, i18n (62 locales) and UI toggles in both settings-general variants. Render reasoning parts as collapsible cards in the style of tool calls (brain icon, 80-char subtitle, TextShimmer only on active block, max-height:320px scrollable body, copy button). Each reasoning part is its own card with open/userInteracted state. - Auto-collapse previous blocks in a chain: isLastPart via data.store.part[message.id].at(-1) — previous collapses immediately when next reasoning part appears, not at end of chain. Shimmer and PacedMarkdown streaming only on active (streaming && isLastPart). - Auto-scroll inside card: scrollRef/innerRef signals, autoFollow flag (pause >40px from bottom, resume at bottom), ResizeObserver + MutationObserver + continuous RAF tick while open && streaming && autoFollow — keeps tail visible during PacedMarkdown pacing and large gaps. - Wire collapsibleReasoning through MessagePartProps -> Part -> message-timeline (settings.general.collapsibleReasoning()). Complements anomalyco#45247 (/thinking toggle). Closes anomalyco#8789, anomalyco#14340, anomalyco#37115, anomalyco#21548, partially anomalyco#28322. Refs anomalyco#7866, anomalyco#33906. Co-authored-by: 4ebuRushka
Limit reasoning card to visible width and vertical scroll only. Outer container overflow-x hidden, overflow-y auto with max-width 100%. Reasoning markdown text uses overflow-wrap anywhere and word-break break-word with white-space normal so long lines wrap. Keep pre and pre code as white-space pre with overflow-x auto so code blocks retain internal horizontal scroll without stretching the card.
… opt-in toggle Variant B rework: remove the collapsibleReasoning setting entirely. Reasoning parts always render as collapsible cards while showReasoningSummaries is on, and stay hidden as before while it is off (rows.ts/groupParts untouched).
4ebuRushka
force-pushed
the
feat/collapsible-reasoning
branch
from
September 17, 2026 00:45
d71a9ab to
cd36715
Compare
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.
Issue for this PR
Closes #8789, Closes #14340, Closes #37115, Closes #21548. Partially addresses #28322. Refs #7866, #33906, #21515.
Type of change
What does this PR do?
Render reasoning parts as collapsible cards instead of flat markdown. Visibility follows the existing "show reasoning summaries" setting: ON = cards, OFF = hidden as before (
rows.ts/groupPartsuntouched).Collapsiblecard inBasicToolstyle:brainicon,Thinkingtitle (ui.sessionTurn.status.thinking), 80-char live subtitle from the first line,max-height:320pxscrollable body with copy buttonstreaming && isLastPart); auto-collapse on completion and when the next block appears — the previous block in areasoning→reasoningchain collapses immediately; shimmer andPacedMarkdown streaminggated byisLastParttoolOpenjournal, so it survives list remounts (scrolling)isLastPartviadata.store.part[message.id].at(-1)?.id === part.idscrollRef/innerRef,autoFollow(pause >40px from bottom, resume at bottom),ResizeObserver+MutationObserver+ continuousRAFtick whileopen && streaming && autoFollowoverflow-wrap: anywhere); ``` code blocks keep their own horizontal scroll without stretching the cardOpen state comes from the existing parent
toolOpen/onToolOpenChangejournal (same mechanism as tool parts). No new settings, no new i18n keys, no migrations, no leftover stored preferences to clean up.How did you verify your code works?
tsgo --noEmit -p packages/session-uicleanbun test --cwd packages/session-ui src/components/message-part.test.ts6 passi18n/parity: only the pre-existingdvfailures (identical on cleandev)oxlinton changed files: 0 errorsupstream/dev@c0f09afe; merge simulation shows 0 conflictsshowReasoningSummariesON/OFF OK, streaming auto-opens, completed auto-collapses,reasoning→reasoningandreasoning→toolchains collapse correctly, shimmer only on active, inner scroll follows without wheel and pauses when user scrolls upelectron-vite devHMR works, no TUI changes (session-uinot used bytui)Screenshots / recordings
Compact collapsible cards interleaved with tool calls, streaming card auto-opens and auto-scrolls, history stays compact. Before: flat markdown prologue filling history.
Checklist