The best way to control Claude Code, Codex and more from any computer or phone
fix(provider-acp): stop claiming agents' own tools named like T3 tools (#20376)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Joshua Whitley committed
Oct 18, 2026 at 13:26 UTC
73ed54901fb91994d6d23472db3e414c32162fdc
2 files changed
+24
-3
packages/provider-acp/src/server/runtimeModel.test.ts
+17
@@ -1505,7 +1505,12 @@ describe("extractMcpToolCallIdentity", () => {
1505
't3-code__delegate_task: {"mode":"async"}',
1506
"delegate_task_t3-code",
1507
"t3-code/delegate_task",
1508
+ "delegate_task",
1509
'delegate_task: {"mode":"async"}',
1510
+ // Kimi retitles on every streamed args chunk with the raw partial JSON,
1511
+ // and middle-truncates args longer than 50 characters.
1512
+ 'delegate_task: {"mode":"async","task":"Ru',
1513
+ 'delegate_task: {"mode":"async","task":"Ru...cho child-result-42\'"}',
1514
]) {
1515
const toolCall = toolCallFromUpdate({
1516
sessionUpdate: "tool_call",
@@ -1521,6 +1526,18 @@ describe("extractMcpToolCallIdentity", () => {
1526
}
1527
});
1528
1529
+ it("does not claim an agent's own tool that shares a T3 tool name", () => {
1530
+ // Hermes' built-in delegate_task, titled "<tool>: <description>" like all its calls.
1531
+ const toolCall = toolCallFromUpdate({
1532
+ sessionUpdate: "tool_call",
1533
+ toolCallId: "own-delegate-1",
1534
+ kind: "execute",
1535
+ title: "delegate_task: 1 tasks: Run the terminal command 'echo child-result-42'",
1536
+ status: "pending",
1537
+ });
1538
+ expect(extractMcpToolCallIdentity(toolCall)).toBeUndefined();
1539
+ });
1540
+
1541
it("recovers T3 identity from goose _meta despite LLM-rewritten titles", () => {
1542
// goose enriches titles asynchronously, so only _meta.goose.toolCall is
1543
// stable; shape from crates/goose/src/acp/server/tool_calls/conversion.rs.
packages/provider-acp/src/server/runtimeModel.ts
+7
-3
@@ -1062,10 +1062,14 @@ const T3_MCP_TITLE_SUFFIX_CALL =
1062
1063
/**
1064
* glm-acp-agent and Kimi CLI register injected MCP tools under their bare
1065
- * names; Kimi additionally appends ": <raw args json>". Safe only because the
1066
- * match is gated on the known T3 tool inventory.
1065
+ * names; Kimi additionally appends ": <raw args json>". The T3 inventory gate
1066
+ * alone is not enough: an agent can have its own tool of the same name (Hermes
1067
+ * has a built-in `delegate_task`) and title it "<tool>: <description>", so only
1068
+ * a bare name or a JSON object after the colon counts. The match stops at the
1069
+ * opening brace because Kimi retitles on every streamed args chunk, so the
1070
+ * JSON is often still incomplete.
1071
*/
1068
-const T3_MCP_BARE_TITLE_CALL = /^(?<tool>[A-Za-z0-9_]+)(?::\s|$)/;
1072
+const T3_MCP_BARE_TITLE_CALL = /^(?<tool>[A-Za-z0-9_]+)(?::\s*\{|$)/;
1073
1074
/**
1075
* ACP has no typed MCP tool-call item, so agents surface MCP calls in agent-specific shapes: