fix(tui): respect display.show_thinking when rendering stored messages (#98)#201
Merged
Merged
Conversation
stored_message_visible_text was concatenating ContentBlock::Reasoning with ContentBlock::Text in a single match arm, ignoring the display.show_thinking setting. Result: providers that emit reasoning_content (MiniMax, OpenRouter routing through Kimi/Qwen, Gemini's thinking blocks via the openrouter SSE path) leaked the chain-of-thought into the visible transcript even when the user had explicitly set show_thinking=false in their config. See issue #98. Split the match arm so Reasoning blocks are gated by display.show_thinking. Extract the inner pure logic into stored_message_visible_text_with_show_thinking so tests can pin the decision deterministically without mutating the global config. 3 tests in src/tui/app/state_ui_messages.rs: - reasoning_block_hidden_when_show_thinking_is_false (the bug) - reasoning_block_shown_when_show_thinking_is_true - empty_reasoning_block_is_skipped_either_way Closes #98
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.
What
stored_message_visible_text(insrc/tui/app/state_ui_messages.rs) was concatenatingContentBlock::ReasoningwithContentBlock::Textin a single match arm, ignoring thedisplay.show_thinkingsetting. Result: providers that emitreasoning_content(MiniMax, OpenRouter routing through Kimi/Qwen, Gemini's thinking blocks via the openrouter SSE path) leaked the chain-of-thought into the visible transcript even when the user had explicitly setshow_thinking=falsein their config.This addresses issue #98: #98
Changes
Reasoningblocks are gated bycrate::config::config().display.show_thinking.stored_message_visible_text_with_show_thinking(message, show_thinking)so tests can pin the decision deterministically without mutating the global config.reasoning_block_hidden_when_show_thinking_is_false(the bug)reasoning_block_shown_when_show_thinking_is_trueempty_reasoning_block_is_skipped_either_way(covers both polarities)Tests
Notes
The streaming path already respects
show_thinking(src/agent/turn_streaming_*.rs,src/tui/app/turn.rs:655). The bug was specifically in the rendering of already-stored messages — i.e. session reload, scrollback re-render, and any code path that goes throughstored_message_visible_text.