Emit tool-result for post-handoff tool calls
When the LLM returns tool calls after a handoff in the same assistant message, they were silently dropped. This left orphaned tool_call entries without matching tool-result messages, causing protocol errors on the next LLM turn. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -645,6 +645,19 @@ func executeWithHandoff(
|
||||
},
|
||||
)
|
||||
|
||||
for i := handoffIdx + 1; i < len(toolCalls); i++ {
|
||||
msgs = append(
|
||||
msgs,
|
||||
llm.Message{
|
||||
Role: llm.RoleTool,
|
||||
ToolCallID: toolCalls[i].ID,
|
||||
Parts: []llm.Part{
|
||||
llm.TextPart{Text: "Tool call was not executed because a handoff occurred."},
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
return ht.handoff, results, msgs, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user