Files
openclaw/extensions
Yuval Dinodia 891dd037b5 fix(google): keep parallel Gemini tool responses in the turn after the model (#93780)
* fix(google): keep parallel Gemini tool responses in the turn after the model

On Gemini < 3 vision models, a parallel tool-call turn whose non-last result
returns an image split function responses across user turns. The merge heuristic
only inspected contents[last], so the separate "Tool result image:" turn landed
between two parallel responses and stranded the second one in a fresh turn. The
turn right after the model then carried fewer functionResponse parts than the
model issued functionCall parts, so Gemini returned 400 INVALID_ARGUMENT. Because
the malformed turn is persisted, every later turn re-400s and the session sticks.

Replace the contents[last] heuristic with a run-scoped accumulator: all responses
for one model turn merge into the single user turn after it, and Gemini < 3 image
turns defer to the end of the tool-result run so they trail that response turn.
Covers both google.ts and google-vertex.ts, which share this convertMessages.

* fix(google): align provider transport tool result turns

---------

Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com>
2026-06-17 09:04:35 +08:00
..
2026-06-17 07:25:30 +08:00
2026-06-17 07:25:30 +08:00
2026-06-17 07:25:30 +08:00
2026-06-17 07:25:30 +08:00
2026-06-17 07:25:30 +08:00
2026-06-17 07:25:30 +08:00
2026-06-17 07:25:30 +08:00