fix(web): render persisted bash tool output in expanded turns #7184
Closedmaslinedwin(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/7184/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/session-logic.ts line 1441OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1384,0 +1421,21 @@1421+1422+ const chunks: string[] = [];1423+ for (const entryValue of content) {1424+ const text = asTrimmedString(entryValue) ?? asTrimmedString(asRecord(entryValue)?.text);1425+ if (text) {1426+ chunks.push(text);1427+ }1428+ }1429+ return chunks.length > 0 ? chunks.join("\n") : null;1430+}1431+1432+function extractPersistedToolResult(payload: Record<string, unknown> | null): string | null {1433+ const data = asRecord(payload?.data);1434+ const item = asRecord(data?.item);1435+ const candidates = [data?.result, item?.result];1436+ for (const candidate of candidates) {1437+ const text = extractToolResultText(candidate);1438+ if (!text) {1439+ continue;1440+ }1441+ const output = stripTrailingExitCode(text).output;@@ -239,3 +244,6 @@239244 if (entry.detail) {240245 parts.push(entry.detail);241246 }247+ if (entry.output) {248+ parts.push(entry.output);249+ }
- apps/web/src/components/chat/MessagesTimeline.tsx lines 2432 to 2432Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2370,10 +2418,14 @@23702418 </div>23712419 </div>23722420 </div>2373- {expanded && canExpand && expandedBody ? (2421+ {expanded && canExpand ? (23742422 <div23752423 className="mt-1 ms-7 cursor-default border-s border-border/45 ps-3 pt-0.5"23762424 onClick={stopRowToggle}23772425 onPointerDown={stopRowToggle}23782426 >2379- <pre className={toolCallExpandedBodyClassName}>{expandedBody}</pre>2427+ {expandedSections.preamble ? (2428+ <pre className={toolCallExpandedBodyClassName}>{expandedSections.preamble}</pre>2429+ ) : null}2430+ {expandedSections.output ? (2431+ <ToolCallOutputBlockapps/web/src/components/chat/MessagesTimeline.tsx lines 2152 to 2154OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2120,3 +2137,18 @@2120213721212138 const stopRowToggle = (e: { stopPropagation: () => void }) => e.stopPropagation();212221392140+const ToolCallOutputBlock = memo(function ToolCallOutputBlock(props: {2141+ output: string;2142+ expanded: boolean;2143+ onToggleExpanded: () => void;2144+}) {2145+ const presented = presentExpandedToolOutput(props.output, props.expanded);2146+ return (2147+ <div className="mt-1">2148+ <div className="mb-0.5 flex items-center justify-end gap-1">2149+ {presented.truncated ? (2150+ <Button2151+ type="button"2152+ size="xs"2153+ variant="ghost"2154+ className="h-5 px-1.5 text-[11px] text-muted-foreground"apps/web/src/components/chat/MessagesTimeline.tsx lines 2438 to 2442Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2373,7 +2421,19 @@2373- {expanded && canExpand && expandedBody ? (2421+ {expanded && canExpand ? (23742422 <div23752423 className="mt-1 ms-7 cursor-default border-s border-border/45 ps-3 pt-0.5"23762424 onClick={stopRowToggle}23772425 onPointerDown={stopRowToggle}23782426 >2379- <pre className={toolCallExpandedBodyClassName}>{expandedBody}</pre>2427+ {expandedSections.preamble ? (2428+ <pre className={toolCallExpandedBodyClassName}>{expandedSections.preamble}</pre>2429+ ) : null}2430+ {expandedSections.output ? (2431+ <ToolCallOutputBlock2432+ output={expandedSections.output}2433+ expanded={outputExpanded}2434+ onToggleExpanded={() => setOutputExpanded((value) => !value)}2435+ />2436+ ) : null}2437+ {expandedSections.files ? (2438+ <pre className={toolCallExpandedBodyClassName}>{expandedSections.files}</pre>2439+ ) : null}
- @@ -856,3 +864,7 @@856864 if (commandPreview.rawCommand) {857865 entry.rawCommand = commandPreview.rawCommand;858866 }867+ const output = extractPersistedToolResult(payload);868+ if (output && output !== detail && output !== commandPreview.command) {869+ entry.output = output;870+ }apps/server/src/orchestration/ActivityPayloadProjection.ts line 368OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -341,3 +356,13 @@341356 }342357 if ("command" in data) {343358 projectedData.command = data.command;359+ } else {360+ const inputCommand = asRecord(data.input)?.command;361+ if (inputCommand !== undefined) {362+ projectedData.command = inputCommand;363+ }364+ }365+366+ const commandResult = projectCommandResult(data.result);367+ if (commandResult) {368+ projectedData.result = commandResult;apps/mobile/src/lib/threadActivity.ts line 662Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -659,4 +666,3 @@659666 appendUniqueBlock(`MCP call\n${JSON.stringify(entry.toolData, null, 2)}`);660667 }661668 appendUniqueBlock(entry.rawCommand ?? entry.command);662- appendUniqueBlock(entry.detail);
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
b3b950a0-d479-4926-a7ab-e4bace8f69d5You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.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.
❤️ Share