From 06a33d140ae9f8ca86f88cf649e255ac21bf0128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugues=20Clou=C3=A2tre?= Date: Mon, 11 May 2026 11:56:35 -0400 Subject: [PATCH 1/2] fix(providers): add Gemini 3.x known_location Global routing and KNOWN_MODELS entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gemini 3.x models require the global Vertex AI endpoint; without the guard arm they fell through to the Iowa catch-all and failed at runtime. - Add guard arm in known_location(): Gemini(name) starting with 'gemini-3' routes to GcpLocation::Global before the catch-all arm - Add gemini-3.1-flash-lite-preview, gemini-3.1-pro-preview, and gemini-3.1-flash-image to KNOWN_MODELS - Add regression tests for parse correctness and location dispatch Fixes: aaif-goose/goose#9141 Signed-off-by: Hugues Clouâtre --- .../src/providers/formats/gcpvertexai.rs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/crates/goose/src/providers/formats/gcpvertexai.rs b/crates/goose/src/providers/formats/gcpvertexai.rs index c4ae9979e4e8..ca664d51008d 100644 --- a/crates/goose/src/providers/formats/gcpvertexai.rs +++ b/crates/goose/src/providers/formats/gcpvertexai.rs @@ -75,6 +75,8 @@ pub const KNOWN_MODELS: &[&str] = &[ "claude-sonnet-4@20250514", "claude-3-5-haiku@20241022", "claude-3-haiku@20240307", + "gemini-3.1-flash-lite", + "gemini-3.1-pro-preview", "gemini-3-pro-preview", "gemini-3-flash-preview", "gemini-2.5-pro", @@ -112,13 +114,15 @@ impl fmt::Display for GcpVertexAIModel { impl GcpVertexAIModel { /// Returns the default GCP location for the model. /// - /// Each model family has a well-known location based on availability: - /// - Claude models default to Ohio (us-east5) - /// - Gemini models default to Iowa (us-central1) - /// - MaaS models default to Iowa (us-central1) + /// Location routing by model family: + /// - Claude models: Ohio (us-east5) + /// - Gemini 3 and later models (name starts with "gemini-3"): Global + /// - Gemini 2.x and earlier models: Iowa (us-central1) + /// - MaaS models: Iowa (us-central1) pub fn known_location(&self) -> GcpLocation { match self { Self::Claude(_) => GcpLocation::Ohio, + Self::Gemini(name) if name.starts_with("gemini-3") => GcpLocation::Global, Self::Gemini(_) => GcpLocation::Iowa, Self::MaaS(_, _) => GcpLocation::Iowa, } @@ -354,6 +358,14 @@ mod tests { assert!(matches!(gemini, GcpVertexAIModel::Gemini(_))); assert_eq!(gemini.to_string(), "gemini-2.5-flash"); + let gemini_3_lite = GcpVertexAIModel::try_from("gemini-3.1-flash-lite")?; + assert!(matches!(gemini_3_lite, GcpVertexAIModel::Gemini(_))); + assert_eq!(gemini_3_lite.to_string(), "gemini-3.1-flash-lite"); + + let gemini_3_pro = GcpVertexAIModel::try_from("gemini-3.1-pro-preview")?; + assert!(matches!(gemini_3_pro, GcpVertexAIModel::Gemini(_))); + assert_eq!(gemini_3_pro.to_string(), "gemini-3.1-pro-preview"); + let maas = GcpVertexAIModel::try_from("qwen-maas")?; assert!(matches!(maas, GcpVertexAIModel::MaaS(_, _))); @@ -369,6 +381,9 @@ mod tests { let gemini_model = GcpVertexAIModel::try_from("gemini-2.5-flash")?; assert_eq!(gemini_model.known_location(), GcpLocation::Iowa); + let gemini_3_model = GcpVertexAIModel::try_from("gemini-3.1-flash-lite")?; + assert_eq!(gemini_3_model.known_location(), GcpLocation::Global); + Ok(()) } From e1a74b5866c44146a88d107e343383753d0b9953 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Tue, 12 May 2026 18:42:08 -0400 Subject: [PATCH 2/2] cleanup: remove trivial parse tests, fix doc comment accuracy - Remove gemini-3.1-flash-lite and gemini-3.1-pro-preview parse assertions since test_unknown_model_parsing already covers that any gemini-* string parses as Gemini(_) - Fix doc comment to say "Gemini 3.x" instead of "Gemini 3 and later" since the guard only matches names starting with "gemini-3" Signed-off-by: Douwe Osinga --- crates/goose/src/providers/formats/gcpvertexai.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/crates/goose/src/providers/formats/gcpvertexai.rs b/crates/goose/src/providers/formats/gcpvertexai.rs index ca664d51008d..31d70bf334b7 100644 --- a/crates/goose/src/providers/formats/gcpvertexai.rs +++ b/crates/goose/src/providers/formats/gcpvertexai.rs @@ -116,8 +116,8 @@ impl GcpVertexAIModel { /// /// Location routing by model family: /// - Claude models: Ohio (us-east5) - /// - Gemini 3 and later models (name starts with "gemini-3"): Global - /// - Gemini 2.x and earlier models: Iowa (us-central1) + /// - Gemini 3.x models: Global + /// - Other Gemini models: Iowa (us-central1) /// - MaaS models: Iowa (us-central1) pub fn known_location(&self) -> GcpLocation { match self { @@ -358,14 +358,6 @@ mod tests { assert!(matches!(gemini, GcpVertexAIModel::Gemini(_))); assert_eq!(gemini.to_string(), "gemini-2.5-flash"); - let gemini_3_lite = GcpVertexAIModel::try_from("gemini-3.1-flash-lite")?; - assert!(matches!(gemini_3_lite, GcpVertexAIModel::Gemini(_))); - assert_eq!(gemini_3_lite.to_string(), "gemini-3.1-flash-lite"); - - let gemini_3_pro = GcpVertexAIModel::try_from("gemini-3.1-pro-preview")?; - assert!(matches!(gemini_3_pro, GcpVertexAIModel::Gemini(_))); - assert_eq!(gemini_3_pro.to_string(), "gemini-3.1-pro-preview"); - let maas = GcpVertexAIModel::try_from("qwen-maas")?; assert!(matches!(maas, GcpVertexAIModel::MaaS(_, _)));