diff --git a/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.test.ts b/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.test.ts index 3edffebf62e..5392c90d7d3 100644 --- a/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.test.ts +++ b/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.test.ts @@ -28,4 +28,13 @@ describe("shouldRepairMalformedToolCallArguments", () => { }), ).toBe(false); }); + + it("keeps kimi providers off on non-anthropic non-openai-completions transports", () => { + expect( + shouldRepairMalformedToolCallArguments({ + provider: "kimi-coding", + modelApi: "openai-responses", + }), + ).toBe(false); + }); }); diff --git a/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.ts b/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.ts index ba2bd59a4c5..8f9264e6557 100644 --- a/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.ts +++ b/src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.ts @@ -299,7 +299,8 @@ export function shouldRepairMalformedToolCallArguments(params: { modelApi?: string | null; }): boolean { return ( - normalizeProviderId(params.provider ?? "") === "kimi" || + (normalizeProviderId(params.provider ?? "") === "kimi" && + params.modelApi === "anthropic-messages") || params.modelApi === "openai-completions" ); }