Skip to content

fix(chat): collapse tool result by default (consistent with reasoning)#75

Merged
xaspx merged 1 commit into
xaspx:mainfrom
tomekpanek:fix/tool-result-collapse
Jun 4, 2026
Merged

fix(chat): collapse tool result by default (consistent with reasoning)#75
xaspx merged 1 commit into
xaspx:mainfrom
tomekpanek:fix/tool-result-collapse

Conversation

@tomekpanek

Copy link
Copy Markdown
Contributor

Symptom

Inconsistency in how renderChatMessage (in src/js/chat/core.js) displays auxiliary content:

Section Default state Wrapping
msg.reasoning collapsed inside <details> with a summary
role === 'tool' content expanded rendered directly in a <div>

Tool results often span hundreds of lines (file listings, JSON blobs, shell output), so the chat scroll becomes dominated by raw tool output rather than the conversation. Reasoning sections behave correctly — click summary to expand. Tool results should match that pattern.

Fix

Wrap the role === 'tool' branch in a <details> with the same summary pattern used by reasoning. Summary shows a compact label so users can identify the tool at a glance:

  • With msg.tool_name present: ⚡ <tool_name> — <first line preview>…
  • Without: ⚡ Tool Result — <first line preview>…

Body is the same content that used to render directly, now collapsed inside the <details>.

Test plan

  • Load a chat session with several tool calls
  • Each tool message renders as a one-line collapsible summary
  • Click summary → tool output expands as before
  • Reasoning panels still collapsed by default (unchanged)
  • User/assistant messages unchanged
  • Long tool output no longer dominates the chat scroll

Verified

Tested on top of main (204e0e5, v3.6.0). UX matches reasoning panel — chat is much more readable in sessions heavy on tool use.

@xaspx xaspx merged commit 6770d11 into xaspx:main Jun 4, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants