Skip to content

[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

Backlog

Description

@ericlitman

Before submitting

Area

apps/server

Steps to reproduce

  1. Start a thread on any ACP provider (Antigravity, acp-registry, Grok, Kiro, or fx) where html_render is invoked through the documented acp-mcp-call terminal fallback (for example on Antigravity when html_render is evicted by [Bug]: Antigravity ACP drops the 8 T3 MCP tools >1,280B (incl. delegate_task & t3_thread_launch) without call_mcp_tool or T3_ACP_MCP_NODE fallback #38123, or on Gemini Enterprise / ACP agents that rely on the shell fallback).
  2. Invoke acp-mcp-call html_render in 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 though AcpMcpStdioBridge.ts:390,396 explicitly 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 -
  3. Inspect the resulting turn item in orchestration_v2_projection_turn_items and 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)

  1. ACP_MCP_FALLBACK_CALL rejects 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 after acp-mcp-call (heredocs, multi-line JSON, multi-line scripts, or Antigravity's "\n\n[Command truncated]" suffix) makes .exec(command) return null.
    • Wrapper scripts (node -e / python3 -c passing ["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 match acp-mcp-call[\s"']+.
    • When extractMcpToolCallIdentity returns undefined, packages/provider-acp/src/server/adapter.ts:5697,5855-5870 falls through to buildAcpStandardToolTurnItem (type: "command_execution", adapter.ts:2234-2243).
    • ProjectionStore.ts:3234 sets inline_work_output = 1 only when event.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, and GuestShareService.ts:677 all require dynamic_tool + htmlRenderFromToolItem(item).
  2. Secondary gap for non-Antigravity ACP adapters (packages/shared/src/toolOutput.ts:115-120):

  3. 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), the acp-mcp-call branch does not validate match[1] against T3_MCP_TOOL_NAMES. Running a normal shell command that mentions "acp-mcp-call" (e.g. my-cli search "acp-mcp-call" --flag) gets misclassified as dynamic_tool t3-code.--flag.

Suggested T3-native fix

  1. Recover unclaimed McpProviderSessions renders on completed ACP execute items (mirroring OpenCode 2 Code Mode at packages/provider-opencode/src/server/v2/adapter.ts:1553-1597):
    • Because acp-mcp-call html_render already hits /mcp with the thread's bearer token and records the HtmlRenderReference via HtmlRender.publish (HtmlRender.ts:551-562), packages/provider-acp/src/server/adapter.ts can verify/consume any McpProviderSessions render published by a completed command_execution (by attachmentId from output or unclaimed renders recorded during that command) and emit a synthetic completed dynamic_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.
  2. Harden ACP_MCP_FALLBACK_CALL and readResult:
    • Support multi-line commands and Windows T3_ACP_MCP_CALL / acp-mcp-call.cmd in runtimeModel.ts:1112.
    • Gate match[1] on T3_MCP_TOOL_NAMES to eliminate false positives.
    • Unwrap { stdout }, { combinedOutput }, and marker-less { output } JSON in packages/shared/src/toolOutput.ts:115-120.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions