Merge pull request #6344 from Kilo-Org/session/agent_c5400014-aac1-472a-9ef3-0ae6308637fe

fix: restore Claude tool call ID normalization from upstream
This commit is contained in:
Christiaan Arnoldus
2026-02-26 16:45:07 +01:00
committed by GitHub
@@ -72,6 +72,23 @@ export namespace ProviderTransform {
.filter((msg): msg is ModelMessage => msg !== undefined && msg.content !== "")
}
if (model.api.id.includes("claude")) {
return msgs.map((msg) => {
if ((msg.role === "assistant" || msg.role === "tool") && Array.isArray(msg.content)) {
msg.content = msg.content.map((part) => {
if ((part.type === "tool-call" || part.type === "tool-result") && "toolCallId" in part) {
return {
...part,
toolCallId: part.toolCallId.replace(/[^a-zA-Z0-9_-]/g, "_"),
}
}
return part
})
}
return msg
})
}
if (
model.providerID === "mistral" ||
model.api.id.toLowerCase().includes("mistral") ||