Skip to content

fix(ui): keep errored tools collapsed instead of force-expanding - #1036

Merged
Astro-Han merged 5 commits into
mainfrom
fix/tool-trow-errored-stay-collapsed
Jul 15, 2026
Merged

Astro-Han merged 5 commits into
mainfrom
fix/tool-trow-errored-stay-collapsed

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In Desktop sessions, a failed tool force-expanded its trow group (and the legacy boxed card), spreading the error banner and raw output across the conversation. This PR keeps failed tools collapsed:

  • The attention checks in deriveToolActivityPresentation and trowNeedsAttention narrow from waiting_permission || errored to waiting_permission only. Permission prompts keep the force-open behavior — they are actionable and a collapsed summary would hide them. Errors are no longer an attention state.
  • The failure signal is not lost: the collapsed summary line still shows "N 个失败" in destructive color with a red kind icon (the boxed card shows the 「失败」status label), and the error banner + raw diagnostics stay one click away behind the disclosure.
  • A manual collapse is no longer overridden when the tool later errors (manuallySet semantics unchanged).
  • ToolActivity gains a controlled open prop (the existing ToolErrorDetails test pattern) so tests can render the expanded body in static markup; production callers never pass it and are unaffected.

The #741 error-collapse contract's goal (a verbose failure must not dominate the conversation) still holds under the collapsed default; its tests now pin the collapsed default and the expanded banner/inner-diagnostics behavior separately.

Verification

  • @maka/ui full suite: 160/160 pass, including a new trow-level regression test (errored tool stays collapsed, summary keeps "1 个失败").
  • @maka/desktop full main suite: 2549/2549 pass (including the test:checks console/a11y/copy checks).
  • typecheck (ui + desktop, incl. the storybook tsconfig) and biome lint on changed files pass.
  • E2E / screenshot runs skipped: no e2e spec or visual-smoke fixture relies on errored tools auto-expanding (verified by repo-wide search).
image

Review focus

A Codex review round on the initial commit found three P2 gaps created by removing the force-open fallback; all are fixed in follow-up commits on this branch:

  • Live groups hid the failed count, and errored rows inside an expanded group were tint-only. The live-summary suppression was justified by the force-open fallback that this PR removes, so summarizeTrowTools(live) now keeps the "N 个失败" clause (the count is monotonic mid-group — no jitter), and an errored ToolTrowRow carries a visible "· 失败" word.
  • Five body-rendering tests had moved to waiting_permission, silently leaving the errored branches they pin. They now keep status: 'errored' and mount the panel via the open prop (byte-identical to the old auto-open renders); the automation contract uses the honest completed + open.
  • The computed-style zero-visual fixture still mirrored waiting_permission || errored open-by-default. It now matches production (waiting_permission only), with the rich inner parts on the open permission card and the errored card joining the collapsed set; the cascade contract regex is updated in lockstep. A fourth commit aligns the intent-redaction contract's source pin with the row-label refactor.

Follow-up verification: @maka/ui 161/161, @maka/desktop 2549/2549 (incl. checks), typecheck + biome lint clean, and a headless check:chat-visual smoke run confirming every rewritten fixture id resolves and computes.

An errored tool no longer counts as an attention state: the trow group
and the boxed card stay collapsed when a tool fails, and an earlier
manual collapse is no longer overridden by the error transition. The
failure signal stays on the summary line ("N 个失败" in destructive
color, red kind icon), and the error banner + raw diagnostics remain
one click away behind the disclosure.

Permission prompts keep the force-open behavior — they are actionable
and a collapsed summary would hide them.

ToolActivity gains a controlled `open` prop (the ToolErrorDetails
pattern) so tests can render the expanded body in static markup; the
#741 error-collapse contract now pins the collapsed default and the
expanded body separately.
Codex review on the collapsed-error change found two spots where the
failure signal degraded to a destructive tint once errors stopped
force-opening:

- summarizeTrowTools suppressed the "N 个失败" clause for live groups.
  The suppression was justified by the force-open fallback that no
  longer exists, and the failed count is monotonic mid-group, so the
  clause now rides the live summary too (the live option only adds the
  正在 prefix).
- An errored ToolTrowRow inside an expanded group showed only a red
  intent. The row label now carries a visible "· 失败" word.
The collapsed-error change had switched five body-rendering tests to
waiting_permission as the static-markup mounting seam, which silently
moved them off the errored branches they pin (error banner, raw-details
disclosure, pty_control banner suppression). With the open prop added
in this PR, the tests can keep status: 'errored' and mount the panel
explicitly — byte-identical to the old auto-open renders.

The automation preview contract is status-agnostic (it exercises the
result parser), so it now uses the honest status: 'completed' + open.
…d default

The zero-visual harness still mirrored the old disclosure default
(waiting_permission || errored render OPEN) and rode its rich inner
parts on the open errored card. openByDefault now matches production
(waiting_permission only); the rich inner parts ride the open
waiting_permission card, and the errored card joins the collapsed set
so the zero-visual proof covers the new default. The cascade contract
regex is updated to pin the new line.

Verified end-to-end: every fixture id (incl. tool-dot-waiting_permission
and the now-collapsed tool-item-errored) resolves and computes in the
headless run.
…ctor

The contract pinned the literal JSX {formatToolIntent(item.intent)}; the
errored-row change routes intent through a rowLabel computation instead.
The invariant is unchanged — intent is still only consumed via
formatToolIntent and raw {item.intent} still never reaches JSX.
@Astro-Han
Astro-Han merged commit b9ca021 into main Jul 15, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the fix/tool-trow-errored-stay-collapsed branch July 25, 2026 15:14
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.

1 participant