mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: resolve native tool protocol race condition causing 400 errors (#9363)
This commit is contained in:
parent
67b6a8bb76
commit
1fa12f6aa6
1 changed files with 7 additions and 6 deletions
|
|
@ -280,10 +280,11 @@ export async function presentAssistantMessage(cline: Task) {
|
|||
// Track if we've already pushed a tool result for this tool call (native protocol only)
|
||||
let hasToolResult = false
|
||||
|
||||
// Check if we're using native tool protocol (do this once before defining pushToolResult)
|
||||
const toolProtocol = resolveToolProtocol(cline.apiConfiguration, cline.api.getModel().info)
|
||||
const isNative = isNativeProtocol(toolProtocol)
|
||||
// Determine protocol by checking if this tool call has an ID.
|
||||
// Native protocol tool calls ALWAYS have an ID (set when parsed from tool_call chunks).
|
||||
// XML protocol tool calls NEVER have an ID (parsed from XML text).
|
||||
const toolCallId = (block as any).id
|
||||
const isNative = !!toolCallId
|
||||
|
||||
const pushToolResult = (content: ToolResponse) => {
|
||||
if (isNative && toolCallId) {
|
||||
|
|
@ -511,9 +512,9 @@ export async function presentAssistantMessage(cline: Task) {
|
|||
case "apply_diff": {
|
||||
await checkpointSaveAndMark(cline)
|
||||
|
||||
// Check if native protocol is enabled - if so, always use single-file class-based tool
|
||||
const applyDiffToolProtocol = resolveToolProtocol(cline.apiConfiguration, cline.api.getModel().info)
|
||||
if (isNativeProtocol(applyDiffToolProtocol)) {
|
||||
// Check if this tool call came from native protocol by checking for ID
|
||||
// Native calls always have IDs, XML calls never do
|
||||
if (isNative) {
|
||||
await applyDiffToolClass.handle(cline, block as ToolUse<"apply_diff">, {
|
||||
askApproval,
|
||||
handleError,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue