Skip to content

fix(model): preserve executionConfig in OllamaOptions fromOptions/toBuilder#2011

Merged
chickenlj merged 1 commit into
agentscope-ai:mainfrom
gaoxiaolei-s59:fix/ollama-options-execution-config
Jul 6, 2026
Merged

fix(model): preserve executionConfig in OllamaOptions fromOptions/toBuilder#2011
chickenlj merged 1 commit into
agentscope-ai:mainfrom
gaoxiaolei-s59:fix/ollama-options-execution-config

Conversation

@gaoxiaolei-s59

Copy link
Copy Markdown
Contributor

Summary

OllamaOptions.fromOptions(OllamaOptions) and toBuilder() do not copy the
executionConfig field, so any instance produced via copy(), fromOptions()
or toBuilder() silently loses the timeout/retry configuration carried by
executionConfig.

merge(OllamaOptions) and toGenerateOptions() already propagate
executionConfig, so the two copy paths were simply missing it. This aligns
them with the rest of the class.

Test

Added OllamaOptionsTest#testExecutionConfigPreservedOnCopy, which verifies that
executionConfig survives copy(), fromOptions() and toBuilder(). Note that
equals()/hashCode() intentionally ignore executionConfig, so the test
asserts getExecutionConfig() directly.

Closes #1957

…uilder

OllamaOptions.fromOptions(OllamaOptions) and toBuilder() did not copy the
executionConfig field, so instances produced via copy(), fromOptions() or
toBuilder() silently lost the timeout/retry configuration carried by
executionConfig. merge() and toGenerateOptions() already propagate it; align
the two copy paths with them and add a regression test covering all three
paths (the existing equals()/hashCode() intentionally ignore executionConfig,
so the test asserts getExecutionConfig() directly).

Closes agentscope-ai#1957
@gaoxiaolei-s59 gaoxiaolei-s59 requested a review from a team July 4, 2026 15:38
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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 fixes a configuration-loss bug in the Ollama model options layer: executionConfig (timeouts/retries) is now preserved when copying OllamaOptions via fromOptions(...), toBuilder(), and therefore copy().

Changes:

  • Copy executionConfig in OllamaOptions.fromOptions(OllamaOptions).
  • Copy executionConfig in OllamaOptions.toBuilder().
  • Add a regression test to ensure executionConfig survives copy(), fromOptions(...), and toBuilder().build().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-ollama/src/main/java/io/agentscope/extensions/model/ollama/options/OllamaOptions.java Preserves executionConfig across the previously-missing copy paths (fromOptions, toBuilder).
agentscope-extensions/agentscope-extensions-model/agentscope-extensions-model-ollama/src/test/java/io/agentscope/extensions/model/ollama/options/OllamaOptionsTest.java Adds a regression test verifying executionConfig is retained through copy(), fromOptions, and toBuilder() round-trips.

Comment on lines +294 to +296
// copy() delegates to fromOptions(OllamaOptions)
OllamaOptions copy = original.copy();
assertEquals(executionConfig, copy.getExecutionConfig());
Comment on lines +298 to +300
// fromOptions(OllamaOptions) directly
OllamaOptions fromOptions = OllamaOptions.fromOptions(original);
assertEquals(executionConfig, fromOptions.getExecutionConfig());
Comment on lines +302 to +304
// toBuilder().build() round-trip
OllamaOptions rebuilt = original.toBuilder().build();
assertEquals(executionConfig, rebuilt.getExecutionConfig());
@chickenlj chickenlj merged commit dcf3024 into agentscope-ai:main Jul 6, 2026
6 checks passed
zouyx pushed a commit to zouyx/agentscope-java that referenced this pull request Jul 6, 2026
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.

[Bug]:OllamaOptions fromOptions/toBuilder 漏传 executionConfig

3 participants