Skip to content

fix(web): stop tool-name prefix from duplicating command detail - #7799

Closed
Exotic209093 wants to merge 3 commits into
pingdotgg:mainfrom
Exotic209093:fix/bash-detail-tool-prefix-dedup
Closed

fix(web): stop tool-name prefix from duplicating command detail#7799
Exotic209093 wants to merge 3 commits into
pingdotgg:mainfrom
Exotic209093:fix/bash-detail-tool-prefix-dedup

Conversation

@Exotic209093

@Exotic209093 Exotic209093 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #7711. item.completed payloads for Bash tool calls carry the same command in two places: payload.data.input.command (bare) and payload.detail (the same command with a Bash: prefix baked in). extractToolDetail in apps/web/src/session-logic.ts is supposed to suppress detail when it's redundant with the already-rendered command preview, but it only stripped a trailing complete/completed suffix before comparing — never the leading <toolName>: prefix. So the normalized command and normalized detail never matched, and the redundant detail line rendered a second time under every Bash tool call.

Fix

Strip a leading "<toolName>: " prefix (read from payload.data.toolName) from detail before the redundancy comparison in extractToolDetail.

Test plan

  • Added a regression test in session-logic.command-output.test.ts reproducing the exact payload shape from the issue (command in data.command, detail prefixed with Bash: ); confirmed it fails before the fix and passes after.
  • vp test run apps/web/src/session-logic.command-output.test.ts apps/web/src/session-logic.test.ts — 79 passed.
  • vp run --filter @t3tools/web typecheck — clean.
  • vp lint on changed files — clean.

Note

Low Risk
Small display-only change in work-log detail comparison, with a targeted regression test and no auth or data-handling impact.

Overview
Stops work-log command rows from repeating the same command under Bash (and similar) tool calls.

extractToolDetail already hid detail when it matched the command preview, but payloads often prefix detail with "<toolName>: ". The comparison now strips that prefix (from data.toolName) so redundant detail is dropped. Adds a regression test for the Bash-prefixed payload shape.

Reviewed by Cursor Bugbot for commit a8af60d. Configure here.

Note

Strip tool-name prefix from command detail in web output

  • Server's projectActivityPayload now propagates data.toolName into the projected payload for non-mcp_tool_call items, so the web client can detect redundant headings.
  • Web client adds stripToolNamePrefix helper in session-logic.ts which removes a case-insensitive <toolName>: prefix from a string; extractToolDetail applies it before comparing detail to the command preview.
  • Detail that only differs from the command by a matching tool-name prefix is now treated as a duplicate and omitted; unrelated labeled details such as warning: true are preserved.
  • Risk: stripToolNamePrefix only strips when the prefix exactly matches payload.data.toolName; mislabeled or missing toolName values will leave the prefix visible rather than dropping the detail.

Macroscope summarized 6b5e461.

extractToolDetail compared payload.detail against the command preview
verbatim, so a detail like "Bash: <cmd>" never matched the bare
command and rendered as a second, redundant line under every Bash
tool-call activity. Strip a leading "<toolName>: " prefix (from
payload.data.toolName) before the redundancy comparison.

Fixes pingdotgg#7711
@coderabbitai

coderabbitai Bot commented Aug 21, 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: a7cdac13-4ae0-4d0a-898d-ccb2b4e09898

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:S 10-29 changed lines (additions + deletions). labels Aug 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8af60d9ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/session-logic.ts

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

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a8af60d. Configure here.

Comment thread apps/web/src/session-logic.ts
@macroscopeapp

macroscopeapp Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6b5e461

Macroscope's review found this PR approvable — This is a well-scoped UI display fix that prevents duplicated tool-name prefixes from showing in command detail. The changes follow existing patterns, are well-tested, and only affect display normalization without modifying stored data or core logic.

You can add or adjust custom eligibility rules. Learn more.

Bots review caught that the previous approach read payload.data.toolName,
but ActivityPayloadProjection.ts rebuilds command-activity data from
scratch server-side and never copies toolName across, so the check was
a no-op on real traffic (only the test's synthetic payload had the
field). Detail's redundancy check now matches the prefix structurally:
if detail ends with the (already-projected) command or raw command
preceded by a "<word>: " heading, treat it as the same duplicate case a
literal match already covers. Added a negative test guarding against
detail that merely happens to contain the command as a trailing
substring.
@Exotic209093

Copy link
Copy Markdown
Contributor Author

Good catch — toolName gets dropped by ActivityPayloadProjection.ts for command activities, so the field-based check was dead on real traffic. Pushed a fix that matches the prefix structurally against detail/command instead (no dependency on a field that never survives projection), plus a negative test for coincidental suffix matches.

Comment thread apps/web/src/session-logic.ts Outdated
Macroscope flagged a real false positive in the previous structural
prefix match: a legitimate detail like "warning: true" was wrongly
treated as a duplicate of command "true" purely because it happened to
end with the command text after a colon-terminated label.

The safer, precise fix both bots originally suggested: preserve
data.toolName through projectActivityPayload for command activities,
matching what the MCP tool-call branch already does. The web client's
prefix strip goes back to comparing against that exact field instead of
guessing at any "word:" heading, so only a genuine "<toolName>: <command>"
duplicate gets suppressed.
@Exotic209093

Copy link
Copy Markdown
Contributor Author

Updated again: Macroscope's follow-up finding was right too — the structural suffix match could drop a legitimate detail like warning: true when the command happened to be true. Went with the fix both bots suggested originally: toolName now survives ActivityPayloadProjection.ts for command activities (mirrors what the MCP branch already does), so the client goes back to comparing against that exact field instead of a heuristic. Added a regression test for the false positive and a projection-side test proving toolName now reaches the client.

@t3dotgg

t3dotgg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened.

Closing as superseded by merged #9120. Main preserves tool names and removes synthetic command echoes in shared work-log code, so web and mobile use the same rule. Genuine output remains visible even when it matches the command.

@t3dotgg t3dotgg closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 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.

[Bug]: Bash command shown twice in tool-call activity — dedup check doesn't strip the "Bash: " prefix baked into detail

2 participants