Describe the bug
Gemini function calling requires responses to parallel function calls to be returned together in one Content with role: "user". GeminiMessageConverter#convertMessages currently appends an independent user content block for every ToolResultBlock.
To Reproduce
- Construct one
Msg with MsgRole.TOOL and two ToolResultBlock instances.
- Convert it with
GeminiMessageConverter#convertMessages.
- Observe two user contents, each containing one
FunctionResponse part.
Expected behavior
The converter should emit one Content(role=user) containing both FunctionResponse parts in their original order.
Actual behavior
The converter emits one user content per tool result. This violates Gemini's parallel function-calling response grouping contract and can cause a replayed tool turn to be rejected or interpreted incorrectly.
Scope
This is intentionally separate from #2335, which addresses Gemini thinking and thought-signature persistence. The issue concerns grouping of parallel tool results only.
Proposed fix
Buffer function-response parts while converting one source Msg, then emit a single user content block before regular message parts. A regression test covers two tool results in one message.
Describe the bug
Gemini function calling requires responses to parallel function calls to be returned together in one
Contentwithrole: "user".GeminiMessageConverter#convertMessagescurrently appends an independent user content block for everyToolResultBlock.To Reproduce
MsgwithMsgRole.TOOLand twoToolResultBlockinstances.GeminiMessageConverter#convertMessages.FunctionResponsepart.Expected behavior
The converter should emit one
Content(role=user)containing bothFunctionResponseparts in their original order.Actual behavior
The converter emits one user content per tool result. This violates Gemini's parallel function-calling response grouping contract and can cause a replayed tool turn to be rejected or interpreted incorrectly.
Scope
This is intentionally separate from #2335, which addresses Gemini thinking and thought-signature persistence. The issue concerns grouping of parallel tool results only.
Proposed fix
Buffer function-response parts while converting one source
Msg, then emit a single user content block before regular message parts. A regression test covers two tool results in one message.