#10996: fix(control-ui): hide tool call blocks when thinking/working toggle is off
app: web-ui
stale
Cluster:
UI Enhancements and Fixes
## Summary
Fixes #10985
The "Toggle assistant thinking/working output" button in the Control UI only hides tool **result** messages (role `toolResult`), but does not hide assistant messages whose content consists solely of tool **call** items (`toolcall`, `tool_use`, etc.) with no user-visible text. This causes tool call blocks (showing tool name + "Completed" status) to remain visible even when the toggle is off.
## Changes
### `ui/src/ui/chat/message-normalizer.ts`
- Added `isToolOnlyMessage()` helper that detects messages that are purely tool-related:
- Messages with role `toolresult` / `tool_result`
- Messages with `toolCallId` or `tool_call_id`
- Messages whose content array contains only tool call/result type items (with no meaningful text)
- Thinking blocks are ignored (not considered user-visible text)
### `ui/src/ui/views/chat.ts`
- Replaced the narrow `role === "toolresult"` check in `buildChatItems()` with the new `isToolOnlyMessage()` helper
### `ui/src/ui/chat/message-normalizer.test.ts`
- Added comprehensive tests for `isToolOnlyMessage()` covering all edge cases
## Expected Behavior
When the toggle is OFF, only clean assistant text is displayed. Tool call blocks like `sessions_spawn Completed` or `exec Completed` are hidden.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Adds `isToolOnlyMessage()` to classify messages that are purely tool-call/result related (ignoring empty text + thinking blocks).
- Uses this helper in `ui/src/ui/views/chat.ts` to hide tool-only blocks when the “show thinking/working” toggle is off.
- Extends `message-normalizer.test.ts` with coverage for tool-only classification edge cases.
<h3>Confidence Score: 3/5</h3>
- This PR is close to safe to merge, but the current tool-only detection can hide legitimate assistant text in some message shapes.
- Main behavioral change is localized and well-tested, but `isToolOnlyMessage()` treats the presence of `toolCallId`/`tool_call_id` as sufficient to hide a message when the toggle is off. If any assistant messages include user-visible text alongside a toolCallId, those messages will incorrectly disappear.
- ui/src/ui/chat/message-normalizer.ts, ui/src/ui/views/chat.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11010: fix(control-ui): hide tool call cards when thinking toggle is off
by Annaxiebot · 2026-02-07
89.5%
#11526: fix(control-ui): hide tool-only assistant messages when thinking is...
by Annaxiebot · 2026-02-07
88.9%
#20317: feat(webchat): add toggle to hide tool calls and thinking blocks
by nmccready · 2026-02-18
81.1%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
79.9%
#9248: Fix: Webchat UI goes grey/unresponsive after Slack message tool calls
by vishaltandale00 · 2026-02-05
79.1%
#12079: TUI: improve thinking UX, tool readability, and live running status...
by rubenfb23 · 2026-02-08
78.4%
#17448: ui: make tool cards collapsible with inline expansion
by karimStekelenburg · 2026-02-15
78.3%
#17552: fix(agents): suppress tool error warnings when assistant already re...
by AytuncYildizli · 2026-02-15
77.8%
#6502: fix(tui): skip empty text for tool-only assistant turns
by douvy · 2026-02-01
77.5%
#6819: fix(tui): handle unstructured tool results and errors in tool execu...
by TreyDong · 2026-02-02
77.1%