mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: remove duplicate tool_call emission from Responses API providers (#11008)
This commit is contained in:
parent
b9cf163b87
commit
17d3456e96
2 changed files with 12 additions and 34 deletions
|
|
@ -925,22 +925,12 @@ export class OpenAiCodexHandler extends BaseProvider implements SingleCompletion
|
|||
}
|
||||
}
|
||||
|
||||
// Only handle tool/function calls from done events (to ensure arguments are complete)
|
||||
if (
|
||||
(item.type === "function_call" || item.type === "tool_call") &&
|
||||
event.type === "response.output_item.done"
|
||||
) {
|
||||
const callId = item.call_id || item.tool_call_id || item.id
|
||||
if (callId) {
|
||||
const args = item.arguments || item.function?.arguments || item.function_arguments
|
||||
yield {
|
||||
type: "tool_call",
|
||||
id: callId,
|
||||
name: item.name || item.function?.name || item.function_name || "",
|
||||
arguments: typeof args === "string" ? args : "{}",
|
||||
}
|
||||
}
|
||||
}
|
||||
// Note: We intentionally do NOT emit tool_call from response.output_item.done
|
||||
// for function_call/tool_call items. The streaming path handles tool calls via:
|
||||
// 1. tool_call_partial events during argument deltas
|
||||
// 2. NativeToolCallParser.finalizeRawChunks() at stream end emitting tool_call_end
|
||||
// 3. NativeToolCallParser.finalizeStreamingToolCall() creating the final ToolUse
|
||||
// Emitting tool_call here would cause duplicate tool rendering.
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1241,24 +1241,12 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
|
|||
}
|
||||
}
|
||||
|
||||
// Only handle tool/function calls from done events (to ensure arguments are complete)
|
||||
if (
|
||||
(item.type === "function_call" || item.type === "tool_call") &&
|
||||
event.type === "response.output_item.done"
|
||||
) {
|
||||
// Handle complete tool/function call item
|
||||
// Emit as tool_call for backward compatibility with non-streaming tool handling
|
||||
const callId = item.call_id || item.tool_call_id || item.id
|
||||
if (callId) {
|
||||
const args = item.arguments || item.function?.arguments || item.function_arguments
|
||||
yield {
|
||||
type: "tool_call",
|
||||
id: callId,
|
||||
name: item.name || item.function?.name || item.function_name || "",
|
||||
arguments: typeof args === "string" ? args : "{}",
|
||||
}
|
||||
}
|
||||
}
|
||||
// Note: We intentionally do NOT emit tool_call from response.output_item.done
|
||||
// for function_call/tool_call items. The streaming path handles tool calls via:
|
||||
// 1. tool_call_partial events during argument deltas
|
||||
// 2. NativeToolCallParser.finalizeRawChunks() at stream end emitting tool_call_end
|
||||
// 3. NativeToolCallParser.finalizeStreamingToolCall() creating the final ToolUse
|
||||
// Emitting tool_call here would cause duplicate tool rendering.
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue