Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): render persisted bash tool output in expanded turns #7184

Closedmaslinedwin(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/7184/headopened View on GitHub

Fixes #6388. Expanded Command-run entries now show the persisted tool output, and tool-only turns keep their tool entries behind the Worked-for fold.

Claude Bash tool.completed payloads store stdout on data.result.content. The snapshot mapper dropped that field (no data.item / data.rawOutput), and the work-log model had no output slot — so expanding a Command-run row only showed the command line and short detail.

  • Project data.input.command and a bounded data.result.content on the wire
  • Copy the persisted result onto WorkLogEntry.output and render it when the row is expanded (preview + show more / copy; collapsed rows still show the command)
  • Keep tool-only settled turns expandable so the tool activity is visible behind "Worked for …"

Note

Medium Risk Touches shared activity projection and work-log derivation across server, web, and mobile; payload size and fold behavior change user-visible timelines, but changes are bounded and covered by extensive tests.

Overview Expanded Command-run rows now show real tool stdout instead of only the command line and short detail. The server projection forwards data.input.command and a bounded data.result.content (32k cap) for command-like tools—including Claude Bash—while still stripping large Read/Grep dynamic-tool bodies. Web and mobile work-log derivation adds an output field from persisted data.result, keeps MCP summaries out of a duplicate output block, and resolves commands from data.input.command.

On web, expanded tool rows split preamble, output, and changed files; ToolCallOutputBlock previews huge output at 4k with show more/less and copy. deriveTurnFolds treats tool-only completed turns as expandable so work entries stay behind “Worked for …”. Completed commands are no longer marked failed when stdout merely mentions phrases like “command not found” or “exit code 1”.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ddb2bce454aee00d4cf7873deed03c3e305ef066. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Render persisted bash tool output in expanded work log turns

  • Adds an output field to WorkLogEntry populated from persisted tool results (e.g. Claude Bash) via new extractPersistedToolResult helpers in session-logic.ts and threadActivity.ts.
  • Projected activity payloads for command-like tools now include a bounded data.result.content field (capped at 32,768 chars) in ActivityPayloadProjection.ts.
  • Expanded work rows in MessagesTimeline.tsx render output via a new ToolCallOutputBlock component with Show more/less toggle (preview capped at 4,000 chars) and a copy button.
  • Fixes tool-only completed turns so they remain expandable and reveal their work entries instead of being hidden.
  • MCP summarized results are excluded from the output field to avoid duplication with existing toolData rendering.
Macroscope summarized ddb2bce.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: b3b950a0-d479-4926-a7ab-e4bace8f69d5

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. @@ -239,3 +244,6 @@
      239244 if (entry.detail) {
      240245 parts.push(entry.detail);
      241246 }
      247+ if (entry.output) {
      248+ parts.push(entry.output);
      249+ }
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium src/session-logic.ts:247

      A successfully completed command that prints persisted stdout containing command not found, ENOENT, or exit code 1 is marked as failed, so it loses the success affordance despite its successful lifecycle status. entry.output is included in the error-phrase heuristic without being known to represent an execution error; restrict heuristics to error-specific output or rely on explicit lifecycle/exit status.

      -  if (entry.output) {
      -    parts.push(entry.output);
      -  }
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/session-logic.ts around lines 247-249:
      
      A successfully completed command that prints persisted stdout containing `command not found`, `ENOENT`, or `exit code 1` is marked as failed, so it loses the success affordance despite its successful lifecycle status. `entry.output` is included in the error-phrase heuristic without being known to represent an execution error; restrict heuristics to error-specific output or rely on explicit lifecycle/exit status.

      Fixed in ddb2bce454aee00d4cf7873deed03c3e305ef066. Failure heuristics no longer scan entry.output. Completed-success commands whose stdout mentions command not found / ENOENT / exit code 1 keep the success affordance; explicit lifecycle/status and error-shaped detail/command still fail.

      Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    4. Three findings in the new expanded Command-run output UI in apps/web/src/components/chat/MessagesTimeline.tsx. The keyboard one is a real interaction regression: the expanded body now contains focusable controls but only stops pointer events from reaching the row toggle.

      Posted via Macroscope — UI Consistency
    5. Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2c23bd196817fdd9be22c13805a1a00562917fce. Configure [here](https://www.cursor.com/dashboard/bugbot).
    6. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      1 blocking correctness issue found. This PR introduces new user-facing capability to render bash tool output across mobile, server, and web apps. It adds a new data field (output) propagated through multiple layers with new extraction logic and a new UI component. The scope of changes spanning three apps with new behavior warrants human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    7. Confirmed the underlying behavior is still present on stable 0.0.40: for non-MCP tools (e.g. Claude's native Bash) the projected payload carries the command but the output is absent entirely — not truncated, missing — while MCP results keep only the short first-line summary. So #4083 didn't cover this path.

      Two notes that may help review, from a local reference implementation with offline fixtures:

      • Handling the general non-MCP data.result shape (rather than Bash specifically), plus the SDK's structured stdout/stderr when present, covers every native tool, not just commands.
      • A separate, larger explicit bound for the new output field keeps every collapsed row byte-identical while making the expanded view useful; a truncation flag records when the bound was hit.

      Happy to share fixtures/cases if useful.

    8. Note: GPT-6 on behalf of shivam (@shivamhwp).

      The mobile expanded/copy path still trims persisted stdout at ddb2bce. buildWorkEntryExpandedBody sends entry.output through appendUniqueBlock, which pushes value.trim(). Leading indentation and trailing whitespace disappear even though extractPersistedToolResult now preserves them. Append the output block verbatim and keep trimming/deduplication for command, detail and file metadata.

      During rebase, preserve main's image filtering, tool labels and lazy expanded-body construction. Main now derives detail from command output, so carrying over the output !== detail guard can suppress the new output field. Keep the expanded output independently of that preview. The old tool-only fold condition is equivalent to main's existing null-terminal behavior; retain the current fold logic and adapt the regression to it.

    9. Thanks for the PR. We're not taking changes to the orchestration and provider layers right now: that part of the server is being rewritten for V2, and merging into the current code would either conflict with or be thrown away by that work.

      Closing for now. If this is still an issue once V2 lands, please reopen (or open a fresh PR against the new code) and we'll take a proper look.

    10. juliusmarminge closed this

Sign in to join this conversation.