mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge pull request #7994 from Kilo-Org/fix/tool-call-without-tool-input-start
fix(cli): handle tool-call without prior tool-input-start event
This commit is contained in:
@@ -135,6 +135,30 @@ export namespace SessionProcessor {
|
||||
break
|
||||
|
||||
case "tool-call": {
|
||||
// kilocode_change start
|
||||
// If tool-input-start was never emitted, this can happen if arguments are unparseable,
|
||||
// create the tool part now to prevent missing tool results down the line.
|
||||
if (!toolcalls[value.toolCallId] && !value.providerExecuted) {
|
||||
log.warn("tool-call without prior tool-input-start", {
|
||||
toolCallId: value.toolCallId,
|
||||
toolName: value.toolName,
|
||||
})
|
||||
const created = await Session.updatePart({
|
||||
id: Identifier.ascending("part"),
|
||||
messageID: input.assistantMessage.id,
|
||||
sessionID: input.assistantMessage.sessionID,
|
||||
type: "tool",
|
||||
tool: value.toolName,
|
||||
callID: value.toolCallId,
|
||||
state: {
|
||||
status: "pending",
|
||||
input: {},
|
||||
raw: "",
|
||||
},
|
||||
})
|
||||
toolcalls[value.toolCallId] = created as MessageV2.ToolPart
|
||||
}
|
||||
// kilocode_change end
|
||||
const match = toolcalls[value.toolCallId]
|
||||
if (match) {
|
||||
const part = await Session.updatePart({
|
||||
|
||||
Reference in New Issue
Block a user