fix(grok): bound cumulative tool output updates #7279
Mergedlnieuwenhuis(GitHub profile, opens in a new tab)merged 2 commits into
main fromrefs/pull/7279/headmerged by t3dotgg(GitHub profile, opens in a new tab) 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/server/src/provider/acp/AcpSessionRuntime.ts line 903Resolvedby lnieuwenhuis(GitHub profile, opens in a new tab)@@ -875,9 +886,18 @@886+ lastEmittedDetailLength: tracked?.lastEmittedDetailLength,887+ skippedSinceEmit: tracked?.skippedSinceEmit ?? 0,888+ });875889 const next = new Map(current);876890 if (nextToolCall.status === "completed" || nextToolCall.status === "failed") {877891 next.delete(nextToolCall.toolCallId);878892 } else {879- next.set(nextToolCall.toolCallId, nextToolCall);893+ next.set(nextToolCall.toolCallId, {894+ state: nextToolCall,895+ lastEmittedDetailLength: decision.emit896+ ? nextToolCall.detail?.length897+ : tracked?.lastEmittedDetailLength,898+ skippedSinceEmit: decision.skippedSinceEmit,899+ });880900 }881- return [{ previous, merged: nextToolCall }, next] as const;901+ return [{ merged: nextToolCall, decision }, next] as const;882902 });883- if (!shouldEmitToolCallUpdate(previous, merged)) {903+ if (!decision.emit) {apps/server/src/provider/acp/AcpRuntimeModel.ts lines 343 to 353OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -285,0 +333,21 @@333+ return { text: undefined, content };334+ }335+ const joined = chunks.join("\n");336+ if (joined.length <= TOOL_CALL_CONTENT_MAX_CHARS) {337+ return { text: joined, content };338+ }339+ const bounded = boundToolCallOutputText(joined);340+ // Collapse the text entries into a single bounded one, in place, and leave every other341+ // entry kind (diffs, images, resource links) alone so non-terminal tool calls from other342+ // ACP agents keep rendering everything they sent.343+ let collapsed = false;344+ const boundedContent = content.flatMap((entry) => {345+ if (toolCallContentText(entry) === undefined) {346+ return [entry];347+ }348+ if (collapsed) {349+ return [];350+ }351+ collapsed = true;352+ return [{ type: "content", content: { type: "text", text: bounded } } as const];353+ });
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) added labelsvouch:trusted
t3dotgg(GitHub profile, opens in a new tab) removed labelsvouch:unvouched
t3dotgg(GitHub profile, opens in a new tab) 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:
6e338183-2feb-4216-a440-b33aec12cbc4You 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