Skip to content

fix(web): show tool call output instead of the duplicated command - #6496

Closed
myNameArnav wants to merge 10 commits into
pingdotgg:mainfrom
myNameArnav:fix/expanded-tool-call-output
Closed

fix(web): show tool call output instead of the duplicated command#6496
myNameArnav wants to merge 10 commits into
pingdotgg:mainfrom
myNameArnav:fix/expanded-tool-call-output

Conversation

@myNameArnav

@myNameArnav myNameArnav commented Aug 13, 2026

Copy link
Copy Markdown

Problem

Expanding a tool call in the work log showed the same information twice. Providers mirror the command into more than one payload field:

  • Grok/Cursor (ACP) set detail equal to data.command (deriveToolActivityPresentation returns detail: command for command executions).
  • OpenCode fills both command and detail with the tool's output.
  • Codex repeats the raw wrapped command in both rawCommand and detail.
  • Claude mirrors the command into detail as Bash: <command>.

buildToolCallExpandedBody joined command/rawCommand and detail as separate blocks with no dedupe, so the same text rendered twice — and the real output never showed for Grok.

Fix

  • Show the output: command tools whose detail is just the command now prefer the actual output summary (rawOutput) instead — web extractToolDetail and the mobile threadActivity mirror.
  • Dedupe the renderer: buildToolCallExpandedBody drops exact duplicate blocks, covering the Codex raw-vs-detail case and file paths that repeat detail.
  • The header preview ("Ran command - git status") is unchanged; the expanded body now reads git status + one line of output.

Same fix path covers every harness (Grok, Cursor, OpenCode, Codex, Claude); mobile rendered detail only once and now gets the output summary too.

Before / After

Expanded git status tool call, same thread:

Before After
image image

Before: git status twice. After: git status once plus the actual output (On branch applib/fix-tool-output).

Worked with OpenCode on macOS.


Note

Low Risk
Presentation-only changes to work-log derivation and expanded tool bodies; no auth, persistence, or execution paths touched.

Overview
Fixes expanded work-log tool rows that repeated the same command text and hid real output when providers mirror the command into detail (ACP/Grok, Claude) or duplicate it across command/rawCommand/detail (OpenCode, Codex).

Web and mobile derivation now treat command executions whose detail equals the command as a mirror and set detail from a short stdout/stderr/content summary via summarizeToolRawOutput (stderr-only results included). Mobile also keys tool lifecycle collapse on toolCallId so in-progress and completed rows still merge after detail becomes an output summary.

Web expanded body uses dedupeToolCallExpandedBodyBlocks before joining blocks so identical command/raw/detail strings render once. Server activity payload projection applies the same stderr summarization when slimming rawOutput for clients.

Reviewed by Cursor Bugbot for commit 537ba6f. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix tool call rows to show output summary instead of duplicating the command

  • When a tool call's detail field mirrors the command string, extractToolDetail in session-logic.ts now returns a concise output summary (stdout, stderr, or file count) instead of repeating the command.
  • New summarizeToolRawOutput and summarizeToolTextOutput helpers produce short summaries from raw output, including stderr-only results.
  • Tool call rows with the same toolCallId now collapse together via deriveToolLifecycleCollapseKey, even when detail differs between in-progress and completed states.
  • dedupeToolCallExpandedBodyBlocks in MessagesTimeline.logic.ts strips duplicate blocks from expanded tool call bodies before rendering.
  • Behavioral Change: Detail text for command-execution rows will change from repeating the command to showing output summaries where available.

Macroscope summarized 537ba6f.

ACP providers (Grok, Cursor) and Claude mirror the command into the tool
call's detail field, and OpenCode fills both command and detail with the
same output, so expanding a tool call rendered the same text twice.
Command tools whose detail is just the command now prefer the actual
output summary, and the expanded body drops exact duplicate blocks so
Codex's raw command no longer repeats either.

Worked with OpenCode on macOS.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 276628b3-ebb5-4164-94be-057ad30438dd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 13, 2026
Comment thread apps/mobile/src/lib/threadActivity.ts
Command results that write only to stderr (failed builds, missing
modules) shipped no output summary: the server projection dropped
stderr-only rawOutput, and both clients' output summarizers stopped at
stdout. Add the stderr fallback at all three layers so the expanded
tool row shows the error line instead of nothing.
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 13, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 660c416

This is a focused UI bug fix that prevents duplicate command text from appearing in tool call displays. The changes are limited to presentation logic with comprehensive test coverage, and don't affect data processing or storage.

You can customize Macroscope's approvability policy. Learn more.

@myNameArnav

Copy link
Copy Markdown
Author

Seems like #6498 and this PR fix the same issue.

Comment thread apps/mobile/src/lib/threadActivity.ts
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 13, 2026 19:15

Dismissing prior approval to re-evaluate 660c416

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 537ba6f. Configure here.

}
// The provider mirrored the command into `detail` (ACP/Grok, Claude):
// the row already shows the command, so surface the actual output.
return summarizeRawOutputForDetail(payload, normalizedHeading);

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.

OpenCode rows collapse together

Medium Severity

When a command tool’s detail mirrors the command and there is no output summary, detail is now cleared. The fallback collapse key still keys on detail, so providers without toolCallId (OpenCode in the new tests) share [itemType, label, ""]. Adjacent distinct tool.updated rows with the same title incorrectly merge into one row.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 537ba6f. Configure here.

@myNameArnav

Copy link
Copy Markdown
Author

Closing: superseded by #4083, merged to main (143f713). This branch's feature (show command output instead of duplicated command in work rows) landed there with a different implementation.

Note: the collapse regression Bugbot flagged here (adjacent distinct tool rows without a toolCallId merging into one once detail is cleared — 'OpenCode rows collapse together') is present in the merged implementation too, since main's collapse key still keys on [itemType, label, detail].

@myNameArnav

Copy link
Copy Markdown
Author

Superseded by #4083 (merged). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant