Skip to content

Commit 4c3e348

Browse files
JWhitleyWorkclaude
andcommitted
test(provider-acp): pin Kimi's partial-JSON titles for bare T3 tool names
Kimi resends the tool title on every streamed args chunk with the raw, still-incomplete JSON, so the bare-title match can't require a closing brace without dropping T3 identity mid-stream. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9308a0d commit 4c3e348

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,10 @@ describe("extractMcpToolCallIdentity", () => {
15071507
"t3-code/delegate_task",
15081508
"delegate_task",
15091509
'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\'"}',
15101514
]) {
15111515
const toolCall = toolCallFromUpdate({
15121516
sessionUpdate: "tool_call",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,9 @@ const T3_MCP_TITLE_SUFFIX_CALL =
10651065
* names; Kimi additionally appends ": <raw args json>". The T3 inventory gate
10661066
* alone is not enough: an agent can have its own tool of the same name (Hermes
10671067
* 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.
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.
10691071
*/
10701072
const T3_MCP_BARE_TITLE_CALL = /^(?<tool>[A-Za-z0-9_]+)(?::\s*\{|$)/;
10711073

0 commit comments

Comments
 (0)