fix: honor timeout_seconds on the Anthropic declarative provider - #10440
Merged
lifeizhou-ap merged 1 commit intoJul 31, 2026
Merged
Conversation
The declarative provider spec exposes a `timeout_seconds` field, and the OpenAI engine reads it (`openai.rs`), but the Anthropic engine's `from_declarative_config` built its client via `ApiClient::new_with_tls`, which hardcodes the 600s `ApiClient` default and ignores the configured value. An integrator setting `timeout_seconds` on an Anthropic-engine custom provider silently got 600s regardless. Read `config.timeout_seconds` and pass it through `ApiClient::with_timeout_and_tls`, mirroring the OpenAI engine. Falls back to 600s when unset, so behavior is unchanged for providers that don't set the field. Adds an `ApiClient::timeout()` accessor and two tests: an explicit `timeout_seconds` is honored, and the default is applied when unset.
lifeizhou-ap
approved these changes
Jul 31, 2026
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.
Problem
The declarative custom-provider spec exposes a
timeout_secondsfield, and the OpenAI engine reads it:The Anthropic engine's
from_declarative_configdid not — it built its client withApiClient::new_with_tls, which hardcodes the 600sApiClientdefault and never readsconfig.timeout_seconds:So an integrator setting
timeout_secondson an Anthropic-engine custom provider silently got 600s regardless of the configured value. This matters when the provider sits behind a proxy where the desired request-timeout differs from 600s (e.g. to fail-and-retry a stalled upstream read faster than the 10-minute default).Fix
Read
config.timeout_secondsand pass it throughApiClient::with_timeout_and_tls, mirroring the OpenAI engine. Falls back to 600s when unset, so behavior is unchanged for providers that don't set the field.Testing
ApiClient::timeout()accessor (mirrors the existinghost()getter) so the built client's timeout is inspectable.anthropic_def: an explicittimeout_secondsis honored (120s), and the default (600s) is applied when the field is unset.cargo test -p goose --lib providers::anthropic_def— 4 passed.cargo fmt --checkandcargo clippy -p goose-providersclean.