fix(opencode): show bash commands instead of repeating their output - #7989
fix(opencode): show bash commands instead of repeating their output#7989brynne8 wants to merge 2 commits into
Conversation
OpenCode bash tool calls rendered the command output as the collapsed row title and again inside the expanded body while the actual command was never visible (pingdotgg#7307). The adapter dropped `state.input.command` and stuffed the output into `detail`, so clients fell back to reading `detail` as the command. Project the invocation into the shape clients already render for Claude/Codex: `detail`/`data.command` carry the command and the output moves to `data.rawOutput.content`. The unread raw `state` blob is no longer duplicated over the wire. Worked on by ox-alpha via opencode.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ 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 f08593b. Configure here.
ApprovabilityVerdict: Skipped Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically. |
The command-as-detail preference also applied to errored parts, and with data.state gone the error text was dropped entirely. Errored command parts now keep state.error as detail while the invocation stays in data.command. Worked on by ox-alpha via opencode.

Fixes #7307
Problem
With the OpenCode provider, bash tool calls showed the command output as the collapsed row title and the same output again inside the expanded body — the actual command being run was never visible (see screenshot in #7307). Claude and Codex users were not affected.
Root cause
The OpenCode adapter emitted
item.completedwithdetailset to the command's output (part.state.output) while never reading the real invocation atpart.state.input.command. Forcommand_executionitems, clients fall back to treatingdetailas the command when no structured command field is present, so:commandfallback = outputFix
Adapter-side, one place fixes web/desktop/mobile. The
message.part.updatedhandler now projects command tools into the payload shape clients already render for Claude/Codex:detail/data.commandcarry the command (state.input.command)data.rawOutput.content, which clients render once in the expanded viewdata.stateblob is no longer sent (nothing consumed it; it duplicated the whole output over the websocket)Error states keep surfacing
state.error; non-command tools are unchanged.Testing
OpenCodeAdapter.test.ts)command+ single output (session-logic.command-output.test.ts)Worked on by ox-alpha via opencode.
Note
Medium Risk
Changes provider event payloads for command tools, including dropping
data.state. Low blast radius but it is a wire-format change for OpenCode tool items.Overview
Fixes OpenCode bash rows showing stdout as the collapsed title (and again in the expanded body) instead of the actual command (#7307).
OpenCodeAdapternow readsstate.input.commandforcommand_executionitems.detail/data.commandcarry the invocation; completed output moves todata.rawOutput.content. Failures still usestate.errorasdetailwhile keepingdata.command. The unuseddata.stateblob is no longer sent.A client work-log test confirms the new payload renders as command + a single output block.
Reviewed by Cursor Bugbot for commit e343705. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
OpenCodeAdapterto show bash commands instead of repeating outputpayload.detailto the command string for command_execution items, and topayload.data.rawOutputfor the tool output on completioncommandFromToolInputhelper to extract a trimmed command from a tool part'sstate.input.commandpayload.detailshows the failure reason whilepayload.data.commandpreserves the original commandstateobject frompayload.data; consumers expectingdata.statemust usedata.commandanddata.rawOutputinsteadMacroscope summarized e343705.