[Bug]: ACP acp-mcp-call html_render persists as command_execution (inline_work_output=0) on multi-line, wrapped, stdin, truncated, or Windows calls #43699
Before submitting#
- I searched existing issues and did not find a duplicate. (Checked #38123, #38434, #39362, and #43286. #38123 / #39362 cover Antigravity's customization budget dropping large T3 MCP tool schemas such as
html_render; #38434 was closed by #38898 after addingTERMINAL_OUTPUT_MARKERparsing for single-line directacp-mcp-callcalls on Antigravity. This issue reports the remaining ACPacp-mcp-callturn-item projection bug affecting all ACP adapters whenever the shell invocation is multi-line, wrapped, stdin-piped, truncated, or uses the Windows launcher.) - I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Start a thread on any ACP provider (
Antigravity,acp-registry,Grok,Kiro, orfx) wherehtml_renderis invoked through the documentedacp-mcp-callterminal fallback (for example on Antigravity whenhtml_renderis evicted by #38123, or on Gemini Enterprise / ACP agents that rely on the shell fallback). - Invoke
acp-mcp-call html_renderin any of these common shell forms:- Multi-line wrapper script (common when agents avoid bash JSON/Unicode quoting issues):
node -e ' const cp = require("child_process"); const payload = JSON.stringify({ path: "/abs/path/page.html", title: "Report", height: 420 }); const ep = process.env.T3_ACP_MCP_ENTRYPOINT; const args = [...(ep ? [ep] : []), "acp-mcp-call", "html_render", payload]; process.stdout.write(cp.execFileSync(process.env.T3_ACP_MCP_NODE, args, { env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" }, encoding: "utf8" })); ' - Heredoc / stdin (
-), even thoughAcpMcpStdioBridge.ts:390,396explicitly supports-:ELECTRON_RUN_AS_NODE=1 "$T3_ACP_MCP_NODE" ${T3_ACP_MCP_ENTRYPOINT:+"$T3_ACP_MCP_ENTRYPOINT"} acp-mcp-call html_render - <<'EOF' {"path":"/abs/path/page.html","title":"Report","height":420} EOF - Multi-line JSON argument (
acp-mcp-call html_render '{\n "path": ...\n}'). - Inline HTML > 8,000 chars on Antigravity, where
boundCommandLine(apps/server/src/provider/acp/AntigravityProtocol.ts:34,245-254,673) appends"\n\n[Command truncated]". - Documented Windows PowerShell fallback (
packages/provider-core/src/server/orchestrationInstructions.ts:60):'{"path":"...","title":"Report","height":420}' | & $env:T3_ACP_MCP_CALL html_render -
- Multi-line wrapper script (common when agents avoid bash JSON/Unicode quoting issues):
- Inspect the resulting turn item in
orchestration_v2_projection_turn_itemsand in the chat timeline.
Expected behavior#
The HTML page published by acp-mcp-call html_render is projected as a completed dynamic_tool (t3-code.html_render) with inline_work_output = 1 and renders inline above the assistant reply on Web and Mobile, matching native MCP calls and single-line direct acp-mcp-call calls.
Actual behavior#
acp-mcp-call html_render succeeds against T3's HTTP /mcp server, saves the HTML attachment, records the HtmlRenderReference in McpProviderSessions.recordHtmlRender (apps/server/src/htmlRender/HtmlRender.ts:551-562), and prints {"content":[],"structuredContent":{"htmlRender":{...}},"isError":false} to stdout—but no inline HTML frame renders in chat.
Instead, the turn item persists as type = 'command_execution' with inline_work_output = 0, and the user only sees the html_preview PNGs in the activity stream.
Root cause in the codebase (main @ b5c725b27d)#
ACP_MCP_FALLBACK_CALLrejects multi-line, wrapped, truncated, and Windows launcher commands (packages/provider-acp/src/server/runtimeModel.ts:1112,1259-1271):const ACP_MCP_FALLBACK_CALL = /(?:^|[\s"'=])acp-mcp-call[\s"']+([A-Za-z0-9_.-]+)(?:\s+(.+?))?\s*$/u;- No
/s(dotAll) flag and anchored to$: any newline anywhere afteracp-mcp-call(heredocs, multi-line JSON, multi-line scripts, or Antigravity's"\n\n[Command truncated]"suffix) makes.exec(command)returnnull. - Wrapper scripts (
node -e/python3 -cpassing["acp-mcp-call", "html_render", ...]) fail because of the comma/syntax between tokens. - Windows
$env:T3_ACP_MCP_CALL/acp-mcp-call.cmd(packages/provider-acp/src/server/adapter.ts:1161,1226) does not matchacp-mcp-call[\s"']+. - When
extractMcpToolCallIdentityreturnsundefined,packages/provider-acp/src/server/adapter.ts:5697,5855-5870falls through tobuildAcpStandardToolTurnItem(type: "command_execution",adapter.ts:2234-2243). ProjectionStore.ts:3234setsinline_work_output = 1only whenevent.payload.type === "dynamic_tool" && isInlineWorkOutput(payloadJson), and Web (apps/web/src/session-logic.ts:696-700), Mobile (apps/mobile/src/lib/threadActivity.ts:2630-2634),attachmentStore.ts:140,ThreadFind.ts:438, andGuestShareService.ts:677all requiredynamic_tool+htmlRenderFromToolItem(item).
- No
Secondary gap for non-Antigravity ACP adapters (
packages/shared/src/toolOutput.ts:115-120):readResultunwrapsvalue.outputonly after Antigravity's"\nCommand output:\n"marker (added in #38898), not{ stdout },{ combinedOutput }, or marker-less{ output }. Ifacp-mcp-callused-(stdin) or unparseable shell quoting,acpMcpFallbackInputreturnsundefined, somcpSessions.takeHtmlRender(threadId, input)(adapter.ts:5780) also fails.
Related false positive in the same regex (
packages/provider-acp/src/server/runtimeModel.ts:1266-1270):- Unlike every other T3 matcher in
extractMcpToolCallIdentity(runtimeModel.ts:1193,1224,1243,1255), theacp-mcp-callbranch does not validatematch[1]againstT3_MCP_TOOL_NAMES. Running a normal shell command that mentions"acp-mcp-call"(e.g.my-cli search "acp-mcp-call" --flag) gets misclassified asdynamic_toolt3-code.--flag.
- Unlike every other T3 matcher in
Suggested T3-native fix#
- Recover unclaimed
McpProviderSessionsrenders on completed ACPexecuteitems (mirroring OpenCode 2 Code Mode atpackages/provider-opencode/src/server/v2/adapter.ts:1553-1597):- Because
acp-mcp-call html_renderalready hits/mcpwith the thread's bearer token and records theHtmlRenderReferenceviaHtmlRender.publish(HtmlRender.ts:551-562),packages/provider-acp/src/server/adapter.tscan verify/consume anyMcpProviderSessionsrender published by a completedcommand_execution(byattachmentIdfrom output or unclaimed renders recorded during that command) and emit a synthetic completeddynamic_tool(t3-code.html_render,output: { htmlRender: page }). That works regardless of shell wrapper or stdout format and prevents spoofed shell output from rendering unissued attachments.
- Because
- Harden
ACP_MCP_FALLBACK_CALLandreadResult:- Support multi-line commands and Windows
T3_ACP_MCP_CALL/acp-mcp-call.cmdinruntimeModel.ts:1112. - Gate
match[1]onT3_MCP_TOOL_NAMESto eliminate false positives. - Unwrap
{ stdout },{ combinedOutput }, and marker-less{ output }JSON inpackages/shared/src/toolOutput.ts:115-120.
- Support multi-line commands and Windows
Impact#
Major degradation or frequent failure
Version or commit#
v0.1.13-nightly.20261125.5245, verified still present on main @ b5c725b27d (including v0.1.13-nightly.20261125.5258).
Environment#
macOS (arm64), T3 Code desktop/web (v0.1.13-nightly.20261125.5245), Antigravity ACP (gemini-4-neon). Affects all 5 ACP adapters sharing makeAcpAdapterV2 (Antigravity, acp-registry, Grok, Kiro, fx).
Workaround#
Force a plain single-line direct shell invocation of acp-mcp-call html_render '{"path":...,"title":...,"height":...}' (no node -e / python3 -c wrapper, no heredoc/newlines, ≤ 8,000 chars) on Antigravity so ACP_MCP_FALLBACK_CALL matches and #38898's TERMINAL_OUTPUT_MARKER parser extracts htmlRender.
tanstack-source added labelsbug
ericlitman(GitHub profile, opens in a new tab) linked this to #45060
Sign in to join this conversation.