Repository navigation
feat(tui): make reasoning blocks collapsible in show mode - #59498
ShiDikALexey wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
The change works as described. I ran the TUI from source on the base and on this branch with session.thinking: "show" and clicked a reasoning header. On the base nothing happens. With this PR the block folds to + Thought: <title> · <duration> and unfolds again on the next click. The new test and the nearby TUI tests pass (430 pass, 0 fail). Type errors are the same on the base and the PR, and none are in the changed files.
Public API: unchanged. This only touches the TUI's internal reasoning component; there are no config, SDK, plugin or CLI changes.
No blocking concerns. The new guard that skips the toggle when header text is selected uses the same check found elsewhere in the TUI code. Resetting each block's open/closed state when the session-wide Thinking setting changes keeps the new default predictable. The fold state still isn't kept when a block is re-rendered from scratch, the same as hide mode on the base, so it isn't a regression.
Related: #51229
There was a problem hiding this comment.
The new commit only merges dev into the branch. The PR's own changes to the two files are byte-for-byte the same as in my last review, and the merge didn't touch packages/tui. I reran the TUI check at the new head with session.thinking: "show": clicking the reasoning header still folds the block. The nearby TUI tests still pass (430 pass, 0 fail).
Public API: unchanged.
No new concerns.



Issue for this PR
Refs #51229 (reasoning blocks only).
Type of change
What does this PR do?
Reasoning blocks could only be collapsed by setting the session-wide
Thinkingoption tohide. Inshowmode the block was always fully expanded and the header did not respond to clicks.The reasoning header now toggles its block in both modes: expanded by default in
show, collapsed by default inhide. Clicking the header flips the current state, selecting header text does not fold the block, and changing the session-wide default clears per-block overrides so the new default applies.How did you verify your code works?
packages/tui/test/cli/tui/reasoning-disclosure.test.tsxdrives real mouse clicks and asserts the collapsed and expanded frames in both modes, including the reset after switching the session default.bun --cwd packages/tui test: 1527 pass, 16 skip, 11 fail. Those 11 failures are pre-existing Windows-environment issues in this checkout (symlinkEPERM, 5s timeouts, locale-specific1 234formatting); none are in the changed code or the new test.bun --cwd packages/tui typecheckand rootbun run typecheck: clean.bun run lint: 0 errors.Visual
Checklist
Added by the opencode bot (AI-generated).
Related: #51229