fix(gemini): apply model execution config#2356
Open
Zbhbb wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures Gemini streaming calls honor the shared execution configuration (timeout + retry) by wrapping Gemini’s response Flux with the same ModelUtils.applyTimeoutAndRetry logic used by other providers, and adds unit tests to validate the behavior through the public stream() entry point.
Changes:
- Wrap
GeminiChatModelstreaming responses withModelUtils.applyTimeoutAndRetryso timeout/retry configs are applied. - Add tests verifying timeout enforcement and retry behavior when using
stream().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-gemini/src/main/java/io/agentscope/extensions/model/gemini/GeminiChatModel.java | Applies the shared execution wrapper (timeout/retry) to Gemini streaming responses. |
| agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-gemini/src/test/java/io/agentscope/extensions/model/gemini/GeminiChatModelTest.java | Adds unit coverage for timeout and retry behavior via stream(). |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
oss-maintainer
approved these changes
Jul 24, 2026
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Looks good.
Automated review by "github-manager-bot"
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
Current main branch.
Description
Background
GeminiChatModelreturned its SDK stream directly, so configured request timeout and retry settings were ignored even though other providers apply the shared execution wrapper.Changes
ModelUtils.applyTimeoutAndRetryto Gemini response streams.stream()entry point.Validation
mvn -q -pl agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-gemini -am -Dtest=GeminiChatModelTest testmvn -q -T1 -pl agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-gemini -am verifyThe full repository
verifyran through its Java test phase, but the unrelatedagentscope-builderstep could not download npm 10.9.2 because the npm registry TLS handshake was terminated.Checklist
mvn spotless:applyrules