Skip to content

fix(gemini): apply model execution config#2356

Open
Zbhbb wants to merge 5 commits into
agentscope-ai:mainfrom
Zbhbb:codex/gemini-timeout-retry
Open

fix(gemini): apply model execution config#2356
Zbhbb wants to merge 5 commits into
agentscope-ai:mainfrom
Zbhbb:codex/gemini-timeout-retry

Conversation

@Zbhbb

@Zbhbb Zbhbb commented Jul 22, 2026

Copy link
Copy Markdown

AgentScope-Java Version

Current main branch.

Description

Background

GeminiChatModel returned its SDK stream directly, so configured request timeout and retry settings were ignored even though other providers apply the shared execution wrapper.

Changes

  • Apply ModelUtils.applyTimeoutAndRetry to Gemini response streams.
  • Add timeout and retry coverage through the public stream() entry point.

Validation

  • mvn -q -pl agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-gemini -am -Dtest=GeminiChatModelTest test
  • mvn -q -T1 -pl agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-gemini -am verify

The full repository verify ran through its Java test phase, but the unrelated agentscope-builder step could not download npm 10.9.2 because the npm registry TLS handshake was terminated.

Checklist

  • Code has been formatted with mvn spotless:apply rules
  • Relevant tests are passing
  • Javadoc follows existing conventions
  • Documentation update is not needed
  • Code is ready for review

Copilot AI review requested due to automatic review settings July 22, 2026 10:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 GeminiChatModel streaming responses with ModelUtils.applyTimeoutAndRetry so 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

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Looks good.


Automated review by "github-manager-bot"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants