Skip to content

[Improve] Collapse consecutive same-type completed tool calls in chat#317

Draft
roomote-roomote[bot] wants to merge 2 commits into
developfrom
feature/collapse-same-type-tool-calls-2t9s0slkhwijj
Draft

[Improve] Collapse consecutive same-type completed tool calls in chat#317
roomote-roomote[bot] wants to merge 2 commits into
developfrom
feature/collapse-same-type-tool-calls-2t9s0slkhwijj

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Bruno Bergher. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

Related issue

N/A — internal product cleanup requested over Slack.

Why this PR exists

  • A maintainer explicitly invited this PR in the linked issue or discussion
  • I am a maintainer / this is internal Roomote work

What changed

Task conversation view now collapses consecutive same-type tool calls into one multi-call row after the second call settles (completed or failed). More same-type completions append into that group.

  • Different tool types stay separate (for example read_file vs search_files, shell vs MCP).
  • Shell/execute commands are included in the same collapsing path.
  • Subagent rows stay individual so nested child-session output keeps working.
  • Generic multi-call headers use readable plural labels (e.g. Used 2 get issue calls, Edited 2 files).
  • Call/result pairs without a toolCallId still count once via payload signature.
  • Individual tool/command components are unchanged; grouping still uses the existing AI Elements Tool shell and AcpGroupedToolMessage.

How it was tested

  • pnpm --filter @roomote/web check-types
  • Targeted Vitest for ACP grouping + grouped tool UI (including header-label and missing-toolCallId cases)
  • Pre-push: lint:fast, check-types:fast, knip

Browser screenshots were not captured: no Storybook story for this component, and the seeded sandbox transcript does not reliably include enough consecutive completed same-type tools to show the collapsed UI honestly.

Checklist

  • The PR title follows the repo convention: [Fix], [Feat], [Improve], [Refactor], [Docs], or [Chore] followed by a user-facing description
  • This PR is small and scoped to one change
  • pnpm lint and pnpm check-types pass locally
  • I added tests or included a clear manual validation note above
  • I removed secrets, tokens, private keys, and customer data from code, logs, and screenshots
  • If this change should appear in the changelog, I ran pnpm changeset

Group identical tool types (including shell) into one multi-call entry
once the second settled call completes, without mixing different tools.
@roomote-roomote

roomote-roomote Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

1 issue outstanding. See task

  • apps/web/src/app/(sandbox)/task/[taskId]/messages/acp/render-blocks.ts:469-477 — Generic (non-exploration, non-execute) grouped tools render an ungrammatical/inconsistent header. Fixed: lowercase tool name + N <name> calls, plus Edited N files for edit tools.
  • apps/web/src/app/(sandbox)/task/[taskId]/messages/acp/render-blocks.ts:383-385 — Dead branch: resolveGroupedToolDisplayKind returns 'subagent' for kind === 'subagent', but resolveToolGroupKey returns null for subagent payloads (line 337), so subagent messages never build a grouped item. Fixed: removed unreachable subagent display kind.
  • apps/web/src/app/(sandbox)/task/[taskId]/messages/acp/render-blocks.ts:873-889 — Potential duplicate-row edge when toolCallId is null. Fixed: missing toolCallId pairs now fall back to a payload signature and still prefer tool_result.
  • apps/web/src/app/(sandbox)/task/[taskId]/messages/acp/render-blocks.ts:577-585 — The fallback key is based only on title, command, and display label, so every no-toolCallId invocation of the same operation shares one key. Two legitimate consecutive reads of the same file (or repeated identical commands) collapse to one representative and silently hide the other invocation; use a pairing-safe identity or retain distinct same-signature results.

Reviewed 81b63f1

@roomote-roomote

roomote-roomote Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all 3 open review items on this PR in 81b63f1:

  1. Generic multi-call headers now read like Used 2 get issue calls (and Edited N files for edit tools).
  2. Removed the unreachable subagent display-kind branch.
  3. Missing toolCallId call/result pairs are deduped by payload signature so one invocation no longer becomes two group items.

Validation: @roomote/web typecheck + grouping Vitest (44 tests).

See task

Polish generic group labels, drop the dead subagent display kind, and
dedupe missing-toolCallId call/result pairs by payload signature.
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