Conversation
…argument collisions When Gemini 3+ streams parallel tool calls, it emits each tool call as a separate SSE event with its own explicit ID, but with part_index=0 in each single-part event. translate_stream_event previously keyed tool call slots only on (part_index, name, thought_signature). When multiple tool calls had the same function name (e.g. parallel skill_view or tool_call invocations), they collided on the same slot index, concatenating JSON argument payloads. Downstream JSON parse errors then triggered repeated retries that misdiagnosed the malformed JSON as output truncation. Key the slot on fc['id'] whenever present so each parallel tool call retains its own distinct index and argument stream.
Contributor
Contributor
|
The Gemini parallel tool-call slot collision is landing via #111686 (salvage of #75528 by @jmiguellucas, co-credited to the first submitter @cdbartholomew #24676; armed to auto-merge on green): Gemini 3 ids are the slot identity, no-id calls disambiguate by value with reachable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent/gemini_native_adapter.pywhere parallel streaming tool calls from Gemini 3+ models collide on the same tool slot index.part_index=0and a uniqueid(e.g.call_1,call_2). Previously,translate_stream_eventkeyed slot indices on(part_index, name, thought_signature)and ignoredfc["id"]. When multiple parallel calls shared the same tool name, they were assigned the same slot index and their JSON argument strings were concatenated, triggering unparseable JSON and repeated max-token retries.fc["id"], falling back to part index / signature when IDs are absent.Test Plan
test_translate_stream_event_multiple_calls_same_nameintests/agent/test_gemini_native_adapter.pyverifying multiple tool calls with the same function name across stream chunks maintain distinct slot indices and uncorrupted JSON payloads.