Skip to content

Commit d47591f

Browse files
fix(acp): OMP threads show html_render pages (pingdotgg#33677)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent ad91636 commit d47591f

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

‎packages/provider-acp/src/server/runtimeModel.test.ts‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,68 @@ describe("extractMcpToolCallIdentity", () => {
13801380
}
13811381
});
13821382

1383+
// regression: #33667 OMP mounts MCP tools as xd:// devices and calls them through `write`.
1384+
it("recovers T3 identity from OMP xd:// device writes but not its doc reads", () => {
1385+
const args = {
1386+
html: '<svg width="320" height="120"><rect width="300" height="100" fill="#4f46e5"/></svg>',
1387+
title: "Static SVG",
1388+
};
1389+
const result = {
1390+
htmlRender: { attachmentId: "synthetic-attachment-html", title: "Static SVG", height: 136 },
1391+
message: "Shown to the reader above your reply.",
1392+
};
1393+
const text = JSON.stringify(result);
1394+
const created = toolCallFromUpdate({
1395+
sessionUpdate: "tool_call",
1396+
toolCallId: "toolu_015ATZG99gw99Rrp4htieLux",
1397+
title: "Rendering static SVG",
1398+
kind: "execute",
1399+
status: "pending",
1400+
rawInput: { path: "xd://mcp__t3_code_html_render", content: JSON.stringify(args) },
1401+
});
1402+
const completed = mergeToolCallState(
1403+
created,
1404+
toolCallFromUpdate({
1405+
sessionUpdate: "tool_call_update",
1406+
toolCallId: "toolu_015ATZG99gw99Rrp4htieLux",
1407+
status: "completed",
1408+
rawOutput: {
1409+
content: [{ type: "text", text }],
1410+
details: {
1411+
xdev: {
1412+
tool: "mcp__t3_code_html_render",
1413+
mode: "execute",
1414+
args,
1415+
tier: "write",
1416+
inner: {
1417+
serverName: "t3-code",
1418+
mcpToolName: "html_render",
1419+
rawContent: [{ type: "text", text }],
1420+
provider: "acp",
1421+
providerName: "ACP Client",
1422+
structuredContent: result,
1423+
},
1424+
},
1425+
},
1426+
},
1427+
content: [{ type: "content", content: { type: "text", text } }],
1428+
}),
1429+
);
1430+
const docRead = toolCallFromUpdate({
1431+
sessionUpdate: "tool_call",
1432+
toolCallId: "toolu_read",
1433+
title: "Reading html_render schema",
1434+
kind: "read",
1435+
status: "pending",
1436+
rawInput: { path: "xd://mcp__t3_code_html_render" },
1437+
});
1438+
1439+
const expected = { server: "t3-code", tool: "html_render", input: args };
1440+
expect(extractMcpToolCallIdentity(created), "pending write").toEqual(expected);
1441+
expect(extractMcpToolCallIdentity(completed), "completed write").toEqual(expected);
1442+
expect(extractMcpToolCallIdentity(docRead), "doc read").toBeUndefined();
1443+
});
1444+
13831445
it("does not claim an agent's own tool that shares a T3 tool name", () => {
13841446
const toolCall = toolCallFromUpdate({
13851447
sessionUpdate: "tool_call",

‎packages/provider-acp/src/server/runtimeModel.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,16 @@ export function extractMcpToolCallIdentity(
11421142
const tool = prefix === undefined ? metaToolName : metaToolName.slice(prefix.length);
11431143
return tool ? { server: metaServerId, tool } : undefined;
11441144
}
1145+
// OMP mounts MCP tools as xd://mcp__<server>_<tool> devices and calls them by writing JSON
1146+
// args; a read of the same path only fetches the tool's docs.
1147+
const devicePath = typeof rawInput?.path === "string" ? rawInput.path : "";
1148+
if (devicePath.startsWith("xd://") && typeof rawInput?.content === "string") {
1149+
const deviceTool = T3_MCP_TITLE_CALL.exec(devicePath.slice("xd://".length))?.groups?.tool;
1150+
if (deviceTool !== undefined && T3_MCP_TOOL_NAMES.has(deviceTool)) {
1151+
const input = acpMcpFallbackInput(rawInput.content);
1152+
return { server: "t3-code", tool: deviceTool, ...(input === undefined ? {} : { input }) };
1153+
}
1154+
}
11451155
const candidates = [
11461156
meta?.toolName,
11471157
claudeCode?.toolName,

0 commit comments

Comments
 (0)