fix: html_render pages show inline when OpenCode or ACP agents wrap the call #17031
main fromrefs/pull/17031/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:S
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
maria-rcks closed this
maria-rcks reopened this
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
coderabbitai[bot](GitHub profile, opens in a new tab) requested changes
packages/shared/src/toolOutput.ts lines 102 to 103OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -98,3 +95,9 @@9895 const nested = readResult(content, budget, depth + 1);9996 return { ...nested, failed: failed || nested.failed };10097 }98+ // Bare MCP text blocks (`{ type: "text", text: "<json>" }`) carry the99+ // result as a string with no envelope keys. Some ACP agents (CodeBuddy)100+ // persist the block itself, so parse its text but keep the object when101+ // the text holds no result data.102+ if (typeof value.text === "string") {103+ const nested = readResult(value.text, budget, depth + 1);- packages/shared/src/toolOutput.ts lines 111 to 111OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -98,3 +95,17 @@9895 const nested = readResult(content, budget, depth + 1);9996 return { ...nested, failed: failed || nested.failed };10097 }98+ // Bare MCP text blocks (`{ type: "text", text: "<json>" }`) carry the99+ // result as a string with no envelope keys. Some ACP agents (CodeBuddy)100+ // persist the block itself, so parse its text but keep the object when101+ // the text holds no result data. The text parses on an isolated budget so102+ // an oversized text field cannot invalidate outer metadata (e.g. a valid103+ // threadId) through the shared exceeded flag.104+ if (typeof value.text === "string") {105+ const textBudget: ResultReadBudget = {106+ remainingBytes: MAX_PARSED_BYTES,107+ remainingNodes: MAX_ENVELOPE_NODES,108+ exceeded: false,109+ };110+ const nested = readResult(value.text, textBudget, depth + 1);111+ if (!textBudget.exceeded && (nested.data !== undefined || nested.failed)) {
coderabbitai[bot](GitHub profile, opens in a new tab) requested changes
packages/shared/src/toolOutput.ts lines 112 to 113OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -98,3 +95,19 @@9895 const nested = readResult(content, budget, depth + 1);9996 return { ...nested, failed: failed || nested.failed };10097 }98+ // Bare MCP text blocks (`{ type: "text", text: "<json>" }`) carry the99+ // result as a string with no envelope keys. Some ACP agents (CodeBuddy)100+ // persist the block itself, so parse its text but keep the object when101+ // the text holds no result data. The `type` gate keeps ordinary objects102+ // that happen to have a text note (e.g. `{ threadId, text: "{...}" }`)103+ // on the existing path so outer metadata is preserved. The text parses104+ // on an isolated budget so an oversized text field cannot invalidate105+ // outer metadata through the shared exceeded flag.106+ if (value.type === "text" && typeof value.text === "string") {107+ const textBudget: ResultReadBudget = {108+ remainingBytes: MAX_PARSED_BYTES,109+ remainingNodes: MAX_ENVELOPE_NODES,110+ exceeded: false,111+ };112+ const nested = readResult(value.text, textBudget, depth + 1);113+ if (!textBudget.exceeded && (nested.data !== undefined || nested.failed)) {coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
ehfreema(GitHub profile, opens in a new tab) changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
t3dotgg(GitHub profile, opens in a new tab) closed this
t3dotgg(GitHub profile, opens in a new tab) reopened this
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelstakeover
juliusmarminge added labelspr:in-progress
juliusmarminge assignedjuliusmarminge
juliusmarminge removed labelspr:in-progress
juliusmarminge added labelspr:needs-julius
juliusmarminge removed labelspr:needs-julius
juliusmarminge added labelspr:in-progress
juliusmarminge added labelspr:needs-julius
juliusmarminge removed labelspr:in-progress
juliusmarminge removed labelspr:needs-julius
juliusmarminge added labelspr:in-progress
juliusmarminge removed labelspr:in-progress
juliusmarminge added labelspr:gate-failed
juliusmarminge removed labelspr:gate-failed
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:needs-julius
tanstack-source added labelsbug
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.








Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
Walkthrough
The ACP adapter and shared output reader handle additional MCP identity and output shapes. HTML render extraction accepts
executeitems, including outputs with anhtmlRenderreference in JSON text.Changes: ACP MCP tool handling
packages/shared/src/t3McpToolPresentation.ts,packages/provider-acp/src/server/runtimeModel.ts,packages/shared/src/t3McpToolPresentation.test.ts,packages/provider-acp/src/server/runtimeModel.test.tspackages/provider-acp/src/server/adapter.ts,apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.tsOkayOutputstrings and applies output normalization to dynamic-tool items. Tests cover MCP envelopes, supported Grok values, and pass-through cases.packages/shared/src/toolOutput.ts,packages/shared/src/toolOutput.test.ts,packages/shared/src/htmlRender.test.tsreadResultreads array entries fromtextorcontent, unwraps nested text, and parses eligible text blocks within a separate budget.htmlRenderFromToolItemacceptsexecuteitems. Tests cover HTML render metadata in these output shapes.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk:
Minimal · up to
dcebcThe change makes pages published through execute render inline and recognizes more tool output shapes. No actionable merge-blocking risk remains in the supplied context.
Architecture risk:
Low · up to
c0222The change affects 3 systems.
Changed systems:
packages/shared,packages/provider-acp,apps/serverArchitecture concerns No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
executetool output containing JSON text and expectshtmlRenderFromToolItemto return itshtmlRenderreference.acpMcpToolCallOutputfor use in adapter tests.OkayOutputstrings are extracted, and non-string or absentOkayOutputvalues and plain objects pass through unchanged.acpMcpToolCallOutputnow returns a string fromoutput.OkayOutputwhen the raw output has noresultorerrorenvelope and that field is a string; otherwise, it preserves the raw output. Existing MCP envelope handling remains.Pre-merge checks:
4
#16745].htmlRenderFromToolItemaccepts completedexecuteitems. The shared reader accepts JSON text,contentblocks, and bare MCP text blocks. The A…#16745]. The ACP unwrapping, identity recovery, label normalization, parser safeguards, and tests support recognition of the samehtmlRenderreference across the reported to…Full details: Linked Issues check
Explanation
The changes meet the coding requirements in [
#16745].htmlRenderFromToolItemaccepts completedexecuteitems. The shared reader accepts JSON text,contentblocks, and bare MCP text blocks. The ACP adapter unwraps the reported output envelope before projection. The identity and label handling preserves the tool identity for the reported provider shapes. The existing cleanup path still receives the attachment ID from the shared reader, and focused tests cover these paths.Full details: Out of Scope Changes check
Explanation
The changes stay within [
#16745]. The ACP unwrapping, identity recovery, label normalization, parser safeguards, and tests support recognition of the samehtmlRenderreference across the reported tool envelopes. No unrelated product behavior is demonstrated.Full details: Description check
Explanation
The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the issue and fix, links the related issue and maintainer direction, reports focused test and check results, and clearly identifies verification gaps.
Finishing Touches
🧪 Generate unit tests (beta)
ℹ️ Recent review info
⚙️ Run configuration
61d98175-4d73-4640-b033-58ebe8634007📥 Commits
Reviewing files that changed from the base of the PR and between c0222ea7e34370ff3ea7b67d466125a2e55fc6be and dcebc1c697dde4f9138fd799febb87c9ca834f6f.
📒 Files selected for processing (2)
packages/shared/src/toolOutput.test.tspackages/shared/src/toolOutput.ts🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.