Repository navigation
fix(model): generate unique ids for tool calls the provider sends without one - #3675
Closed
pcbeingused33 wants to merge 1 commit into
Closed
pcbeingused33 wants to merge 1 commit into
pcbeingused33 wants to merge 1 commit into
Conversation
…hout one Gemini function calls carry no id and the OpenAI-compatible parser falls back to a generated id when a streamed or non-streamed tool call has none. Both fallbacks were "tool_call_" + System.currentTimeMillis(), so parallel calls parsed in the same millisecond got the same id and were merged by ToolCallsAccumulator (or had their results collide). Use a random UUID suffix instead.
This was referenced Nov 17, 2026
iluv7
added a commit
to iluv7/agentscope-java
that referenced
this pull request
Nov 17, 2026
…on invalid combos (agentscope-ai#4220) Gemini 4 models (gemini-4-argon, gemini-4-carbon) use thinkingLevel instead of thinkingBudget and reject thinking_budget outright. The adapter sent the budget-era shape unconditionally whenever a budget was set, so requests against Gemini 4 failed, zero budgets broke budget-era models, and thinking could not be enabled on Gemini 4 at all. - GenerateOptions: add tri-state includeThoughts and thinkingLevel options - GeminiChatModel: model-aware thinking wiring (gate on argon/carbon), mirrored from agentscope-python PR agentscope-ai#3523/agentscope-ai#3675 - Fail fast with a clear error for budget on Gemini 4 / level on budget-era models / unsupported levels, instead of an opaque remote error - Wire-level tests covering the mapping table, defaults merge, and stream-path fail-fast Co-Authored-By: Claude Code <[email protected]>
jujn
pushed a commit
to iluv7/agentscope-java
that referenced
this pull request
Nov 17, 2026
…on invalid combos (agentscope-ai#4220) Gemini 4 models (gemini-4-argon, gemini-4-carbon) use thinkingLevel instead of thinkingBudget and reject thinking_budget outright. The adapter sent the budget-era shape unconditionally whenever a budget was set, so requests against Gemini 4 failed, zero budgets broke budget-era models, and thinking could not be enabled on Gemini 4 at all. - GenerateOptions: add tri-state includeThoughts and thinkingLevel options - GeminiChatModel: model-aware thinking wiring (gate on argon/carbon), mirrored from agentscope-python PR agentscope-ai#3523/agentscope-ai#3675 - Fail fast with a clear error for budget on Gemini 4 / level on budget-era models / unsupported levels, instead of an opaque remote error - Wire-level tests covering the mapping table, defaults merge, and stream-path fail-fast Co-Authored-By: Claude Code <[email protected]>
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.
AgentScope-Java Version
main (73cb2da)
Description
When a provider sends a tool call without an id, the parsers generated one as
"tool_call_" + System.currentTimeMillis()("streaming_" + ...for streamed OpenAI-compatible chunks). Two calls parsed in the same millisecond get the same id. Gemini function calls never carry an id, so parallel function calls hit this routinely, andToolCallsAccumulatorkeys builders by id, so the calls are merged into one (their arguments concatenate into invalid JSON and fall back to{}) or their results collide.This replaces the millisecond suffix with
UUID.randomUUID()inGeminiResponseParser(function calls and server-side tool calls) andOpenAIResponseParser(streaming and non-streaming fallbacks). Ids supplied by the provider are unchanged.Tests:
GeminiResponseParserTest.testParseParallelToolCallsWithoutIdsGetDistinctIdsandOpenAIStreamingToolCallTest.testParallelStreamingToolCallsWithoutIds(two id-less calls in one chunk, also run throughToolCallsAccumulator). The collision needs both ids in one millisecond, so each test repeats 50 times; both fail onmainand pass here. The openai and gemini module suites pass (579 and 169 tests, 0 failures) andmvn spotless:applyleaves no diff.Checklist
mvn spotless:applymvn testfor the openai and gemini modules)Drafted with Claude Code.