Skip to content

Commit 9308a0d

Browse files
JWhitleyWorkclaude
andcommitted
fix(provider-acp): stop claiming agents' own tools named like T3 tools
The bare-title match for glm-acp-agent and Kimi CLI accepted any "<tool>: ..." title whose name is in the T3 tool inventory. Hermes titles every call "<tool>: <description>" and has a built-in delegate_task, so its own delegations were shown as T3's MCP tool, with T3's logo and no title. Accept only the two shapes those agents send: the bare name, or the name followed by a JSON object of arguments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3b99fb2 commit 9308a0d

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,7 @@ describe("extractMcpToolCallIdentity", () => {
15051505
't3-code__delegate_task: {"mode":"async"}',
15061506
"delegate_task_t3-code",
15071507
"t3-code/delegate_task",
1508+
"delegate_task",
15081509
'delegate_task: {"mode":"async"}',
15091510
]) {
15101511
const toolCall = toolCallFromUpdate({
@@ -1521,6 +1522,18 @@ describe("extractMcpToolCallIdentity", () => {
15211522
}
15221523
});
15231524

1525+
it("does not claim an agent's own tool that shares a T3 tool name", () => {
1526+
// Hermes' built-in delegate_task, titled "<tool>: <description>" like all its calls.
1527+
const toolCall = toolCallFromUpdate({
1528+
sessionUpdate: "tool_call",
1529+
toolCallId: "own-delegate-1",
1530+
kind: "execute",
1531+
title: "delegate_task: 1 tasks: Run the terminal command 'echo child-result-42'",
1532+
status: "pending",
1533+
});
1534+
expect(extractMcpToolCallIdentity(toolCall)).toBeUndefined();
1535+
});
1536+
15241537
it("recovers T3 identity from goose _meta despite LLM-rewritten titles", () => {
15251538
// goose enriches titles asynchronously, so only _meta.goose.toolCall is
15261539
// stable; shape from crates/goose/src/acp/server/tool_calls/conversion.rs.

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,12 @@ const T3_MCP_TITLE_SUFFIX_CALL =
10621062

10631063
/**
10641064
* 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.
10671069
*/
1068-
const T3_MCP_BARE_TITLE_CALL = /^(?<tool>[A-Za-z0-9_]+)(?::\s|$)/;
1070+
const T3_MCP_BARE_TITLE_CALL = /^(?<tool>[A-Za-z0-9_]+)(?::\s*\{|$)/;
10691071

10701072
/**
10711073
* ACP has no typed MCP tool-call item, so agents surface MCP calls in agent-specific shapes:

0 commit comments

Comments
 (0)