Skip to content

fix(desktop): only expand tool rows whose detail adds information - #6015

Closed
ggbdpq wants to merge 1 commit into
apache:mainfrom
ggbdpq:fix/5997-tool-row-detail-noise
Closed

ggbdpq wants to merge 1 commit into
apache:mainfrom
ggbdpq:fix/5997-tool-row-detail-noise

Conversation

@ggbdpq

@ggbdpq ggbdpq commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Every Desktop tool row carried an expand chevron because Astryx ChatToolCalls makes a row expandable whenever call.resultDetail != null, and standardToolCall always passed a <ToolDetailReveal> — even when expanding showed an empty panel, repeated the collapsed target, or a bare type token. This PR makes a row expandable only when its detail adds information, and renders summary results as their summarized body.

Concretely:

  • standardToolCall computes the detail decision first and passes resultDetail only when the detail adds information beyond the collapsed row (bug(desktop): tool rows expand to empty, repeated, or placeholder details #5997):
    • banners (sandbox-blocked, requires-bypass) always count as information;
    • a titleless single-line quiet text equal to the collapsed target does not;
    • a body of none without a banner does not;
    • results whose preview would be only a type token (image, archived_tool_result) do not.
  • A summary result now renders its summarized body through the same redaction and line-cap pipeline as the text branch, instead of [summary].
  • A client plugin contribution to the conversation.tool.detail slot for that tool name keeps the row expandable, via a new useMakaClientSlotEntryKeys hook that mirrors the keyed outlet's lookup (including its session-scope guard).

Rows with diffs, terminal or shell output, web search results, JSON, live output, or banners keep their current behavior. Tool grouping, the process disclosure lifecycle, output length bounds, and the requires-bypass retry action are unchanged. This is the first slice of #4863; the remaining #4863 scope (WebFetch citation cards, shared bounds) stays there.

Fixes #5997

Verification

Check Result
node --test dist/**/*.test.js in packages/ui (full suite, 721 tests, includes 8 new tool row expandability (#5997) cases) pass (0 fail)
New tests before the fix 5 red, exactly on the two symptoms: empty/repeat/token/plugin-miss rows render role="button" + chevron; summary detail renders [summary] instead of the body
npx biome check on the 4 changed files pass
npm run check:asf-headers pass
npm run typecheck:stories (desktop, covers packages/ui/stories/** against the changed source) pass
smoke:storybook visual smoke not run (requires a live storybook dev server and browser AX session; no tool-activity story is in its required-story list)

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: GLM-5.3-Flash (ZCode) — authored the failing tests, the fix, and this PR under the reporter's root-cause analysis in #5997.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/M Under 500 readable lines label Oct 9, 2026
Astryx `ChatToolCalls` makes a row expandable whenever
`call.resultDetail != null`, and `standardToolCall` always passed a
`<ToolDetailReveal>`, so every tool row carried a chevron even when
expanding it showed an empty panel, repeated the collapsed target (the
single-line quietText invocation fallback), or a bare type token
(`[summary]`, `[image]`, `[archived_tool_result]`).

`standardToolCall` now computes the detail decision first and passes
`resultDetail` only when the detail adds information beyond the
collapsed row: banners (sandbox-blocked, requires-bypass) always count,
a titleless single-line quiet text equal to the collapsed target and
results whose preview would be only a type token do not. A `summary`
result now renders its summarized body through the same redaction and
line-cap pipeline as `text`, and a client plugin contribution to the
`conversation.tool.detail` slot for that tool name keeps the row
expandable.

First slice of apache#4863.

Fixes apache#5997

Generated-by: GLM-5.3-Flash (ZCode)

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

Reviewed: full PR, one commit 33cc4bed on main-base 6d53ca8e (4 files, +288/-31). This is the first review, so there are no prior findings.

The approach looks right. resultDetail is now passed only when toolDetailAddsInformation says the panel shows something the collapsed row does not, and a matching conversation.tool.detail contribution keeps the row expandable.

  • useMakaClientSlotEntryKeys mirrors the keyed outlet exactly: same specDynamic lookup, same session-scope guard, same options.key === entryKey match. So a chevron is never shown over a panel the outlet would leave empty.
  • The repeated-target check compares the full invocation text against the capped target. A single-line command longer than 120 characters therefore differs from its …-truncated target and stays expandable, and so does any row whose target comes from intent. This avoids losing the tail of a long command.
  • Summary bodies go through the same redactSecrets → formatUserVisibleToolText → capLines → ToolCodeBlock plain-text path as text. original is never rendered, so there is no new injection or secret-leak surface.

No P0–P2 defects found.

P3

  • tool-activity.tsx:696: an empty or whitespace-only text result, or a summary whose summarized is empty, still counts as information. The row expands to an empty code block, which is the case #5997 describes.

  • tool-activity.tsx:696: rows with an archived_tool_result are now non-expandable, but the collapsed row says nothing about the archive. Before this PR the reader could at least expand to [archived_tool_result]; now there is no sign that the result exists but is not loaded (or is missing or corrupt). Consider surfacing the archive status in stats.

  • Overlap with #5999 (Colafornia, fix(ui): hide empty tool details and render summary bodies, head e0291438, opened earlier). It fixes the same issue #5997 with essentially the same design:

    • It gates resultDetail with an almost identical predicate (toolCallHasDetail).
    • It adds an equivalent keyed-slot hook under a different name (useMakaClientSlotOccupiedKeys).
    • It makes the same ToolResultPreview summary change.

    It also covers both P3s above, plus session-scope gating of the existing useMakaClientSlotOccupied. git merge-tree between the two heads conflicts in tool-activity.tsx and tool-result-preview.tsx. client-plugin-slots.tsx auto-merges, which would leave two duplicate exported hooks. Only one of the two should land. I'd suggest coordinating with #5999 rather than merging both.

No protocol files are touched, so there is no epoch impact.

CI: test and label pass on 33cc4bed. Mergeable against main; awaiting review.

return text !== collapsedTarget;
}
if (body.kind === 'result') {
return body.result.kind !== 'image' && body.result.kind !== 'archived_tool_result';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Every other result kind counts as information, including a text result whose text is empty or whitespace-only and a summary with an empty summarized. Both expand to an empty ToolCodeBlock, which is the case #5997 describes. Consider result.text.trim().length > 0 and result.summarized.trim().length > 0 here.

Also, hiding the archived_tool_result chevron removes the only sign the reader had that the result was archived. The row's stats still shows only outcomeWord. Consider adding the archive status (not_loaded / missing / corrupt) to the row.

* keyed outlet performs, including its session-scope guard, so a caller can
* ask "would this entryKey render?" without mounting the outlet (#5997).
*/
export function useMakaClientSlotEntryKeys(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: #5999 adds an equivalent hook, useMakaClientSlotOccupiedKeys. This file auto-merges between the two PRs, so landing both would leave two exported hooks that do the same thing. The two PRs also conflict in tool-activity.tsx and tool-result-preview.tsx, so only one should land.

@ggbdpq

ggbdpq commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: #5999 (opened earlier, same issue) implements the same design - the gated resultDetail predicate, the keyed-slot hook and the summary-body rendering - and covers the two observations from this review plus session-scope gating of the existing occupied-slot hook. @Colafornia's head should be the one to land; mine is freed. Thank you @Astro-Han for catching the overlap and for the archive-status observation.

@ggbdpq ggbdpq closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(desktop): tool rows expand to empty, repeated, or placeholder details

2 participants