Skip to content

Fix GCP Vertex AI global endpoint support for Gemini 3 models#6187

Merged
katzdave merged 2 commits intoblock:mainfrom
clouatre:fix/gcp-vertex-ai-global-endpoint
Jan 23, 2026
Merged

Fix GCP Vertex AI global endpoint support for Gemini 3 models#6187
katzdave merged 2 commits intoblock:mainfrom
clouatre:fix/gcp-vertex-ai-global-endpoint

Conversation

@clouatre
Copy link
Contributor

Summary

Fixes the GCP Vertex AI provider to support the global endpoint required for Gemini 3 models. The previous implementation incorrectly constructed the URL as https://global-aiplatform.googleapis.com instead of https://aiplatform.googleapis.com.

Type of Change

  • Bug fix

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Unit Tests:

  • All 11 tests passing (4 new tests added, 7 existing tests still passing)
  • New tests: test_gcp_location_display, test_gcp_location_is_global, test_build_host_url_global, test_build_host_url_regional
  • Code formatted and linted: cargo fmt --check ✓, ./scripts/clippy-lint.sh

Manual Live Testing (100% Working):
Built release binary and tested with actual GCP Vertex AI API:

  • gemini-3-flash-preview with GCP_LOCATION=global - SUCCESS
    • Question: "What is the capital of France?"
    • Response: "Paris" (correct)
    • Confirms global endpoint URL works: https://aiplatform.googleapis.com
  • gemini-3-pro-preview with GCP_LOCATION=global - SUCCESS
    • Question: "What is 5 times 7?"
    • Response: "35" (correct)
    • Confirms global endpoint URL works for different Gemini 3 model
  • gemini-2.0-flash-001 with GCP_LOCATION=us-central1 - SUCCESS
    • Question: "What is 2+2?"
    • Response: "4" (correct)
    • Baseline verification that regional endpoints still work

Verification:

  • No 404 errors (which would indicate wrong URL construction)
  • Responses stored in session database confirm successful API calls
  • Both Gemini 3 models now work with global endpoint (previously failed)

Related Issues

Fixes #6186

Changes

  • Added GcpLocation::Global variant with is_global() helper method
  • Added build_host_url() method to handle global vs regional URL construction:
    • Global: https://aiplatform.googleapis.com
    • Regional: https://{location}-aiplatform.googleapis.com
  • Removed known_location() method and fallback retry logic (simplification)
  • Removed TryFrom<&str> impl for GcpLocation (no longer needed)

Impact

  • Net -34 lines (92 removed, 58 added)
  • Only 2 files modified: crates/goose/src/providers/formats/gcpvertexai.rs, crates/goose/src/providers/gcpvertexai.rs
  • No breaking changes

Copilot AI review requested due to automatic review settings December 19, 2025 03:17
Copy link
Contributor

Copilot AI left a comment

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 GCP Vertex AI global endpoint support for Gemini 3 models by correcting the URL construction from https://global-aiplatform.googleapis.com to https://aiplatform.googleapis.com.

  • Adds GcpLocation::Global variant and build_host_url() method to properly construct URLs for global vs regional endpoints
  • Removes the fallback retry logic and known_location() method as part of simplification
  • Includes comprehensive test coverage with 4 new tests for the URL construction and location handling

Reviewed changes

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

File Description
crates/goose/src/providers/gcpvertexai.rs Adds build_host_url() method to construct correct URLs for global/regional endpoints; removes fallback retry logic; adds tests for URL construction
crates/goose/src/providers/formats/gcpvertexai.rs Adds GcpLocation::Global variant with is_global() helper; removes unused TryFrom<&str> impl and known_location() method; adds tests for location display and global checking

Copy link
Collaborator

@katzdave katzdave left a comment

Choose a reason for hiding this comment

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

Nice work!

@clouatre
Copy link
Contributor Author

Thanks @katzdave for the review! All feedback addressed in the latest commit - simplified by removing the is_global() helper, the doc comment, and consolidating the test coverage. Appreciate the guidance on keeping the code lean.

Copy link
Collaborator

@katzdave katzdave left a comment

Choose a reason for hiding this comment

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

Looks good, nice job!

Copilot AI review requested due to automatic review settings January 15, 2026 04:40
@clouatre clouatre force-pushed the fix/gcp-vertex-ai-global-endpoint branch from 6800bfc to ef26556 Compare January 15, 2026 04:40
@clouatre
Copy link
Contributor Author

Rebased onto main to resolve conflicts with #6191 (streaming support). Ready for merge.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

@clouatre
Copy link
Contributor Author

CI failure is due to a pre-existing broken test in main (code_execution_extension.rs). This is unrelated to my changes (which only touch gcpvertexai.rs files) and is being fixed in #6510. Once #6510 merges, I'll rebase and CI will pass.

@clouatre clouatre force-pushed the fix/gcp-vertex-ai-global-endpoint branch 2 times, most recently from 625aa3d to ab76ef5 Compare January 16, 2026 22:38
Copilot AI review requested due to automatic review settings January 16, 2026 22:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@clouatre
Copy link
Contributor Author

Rebased onto latest main following fixes in #6512. CI now passing.

@katzdave
Copy link
Collaborator

@clouatre Following back up here, seems like 1 more merge conflict, but otherwise would be great to merge!

- Add GcpLocation::Global variant with is_global() helper
- Add build_host_url() to construct correct URLs:
  - Global: https://aiplatform.googleapis.com
  - Regional: https://{location}-aiplatform.googleapis.com
- Remove known_location() method and fallback retry logic
- Remove TryFrom<&str> impl for GcpLocation (no longer needed)
- Add 4 new tests for global endpoint URL construction

Fixes block#6186

Signed-off-by: Hugues Clouâtre <hugues@linux.com>
- Remove is_global() method and empty impl block from GcpLocation
- Remove comment block above build_host_url (self-documenting)
- Remove 4 tests that directly mirror code without adding value:
  - test_gcp_location_display
  - test_gcp_location_is_global
  - test_build_host_url_regional
  - test_build_host_url_global

Signed-off-by: Hugues Clouâtre <hugues@linux.com>
@clouatre clouatre force-pushed the fix/gcp-vertex-ai-global-endpoint branch from ab76ef5 to 4936cd5 Compare January 23, 2026 03:52
@clouatre
Copy link
Contributor Author

@katzdave Rebased and resolved the conflict. Also fixed KNOWN_MODELS to use the correct model names (gemini-3-pro-preview and gemini-3-flash-preview). CI is green - ready to merge!

@katzdave katzdave merged commit 346ff7a into block:main Jan 23, 2026
17 checks passed
tlongwell-block added a commit that referenced this pull request Jan 23, 2026
* origin/main:
  Fix GCP Vertex AI global endpoint support for Gemini 3 models (#6187)
  fix: macOS keychain infinite prompt loop    (#6620)
  chore: reduce duplicate or unused cargo deps (#6630)
  feat: codex subscription support (#6600)
  smoke test allow pass for flaky providers (#6638)
  feat: Add built-in skill for goose documentation reference (#6534)
  Native images (#6619)
  docs: ml-based prompt injection detection (#6627)
  Strip the audience for compacting (#6646)
  chore(release): release version 1.21.0 (minor) (#6634)
  add collapsable chat nav (#6649)
  fix: capitalize Rust in CONTRIBUTING.md (#6640)
  chore(deps): bump lodash from 4.17.21 to 4.17.23 in /ui/desktop (#6623)
  Vibe mcp apps (#6569)
  Add session forking capability (#5882)
  chore(deps): bump lodash from 4.17.21 to 4.17.23 in /documentation (#6624)
  fix(docs): use named import for globby v13 (#6639)
  PR Code Review (#6043)
  fix(docs): use dynamic import for globby ESM module (#6636)

# Conflicts:
#	Cargo.lock
#	crates/goose-server/src/routes/session.rs
@cjfit
Copy link

cjfit commented Jan 25, 2026

For anyone wondering why this isn't working: the latest release of Goose (1.2.1) does not have this fix baked in. I built from source (main branch) and confirmed this was resolved. Hopefully it's included in 1.2.2

katzdave added a commit that referenced this pull request Jan 26, 2026
…o dkatz/canonical-context

* 'dkatz/canonical-provider' of github.com:block/goose: (27 commits)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  Test against fastmcp (#6666)
  docs: mid-session changes (#6672)
  Fix MCP elicitation deadlock and improve UX (#6650)
  chore: upgrade to rmcp 0.14.0 (#6674)
  [docs] add MCP-UI to MCP Apps blog (#6664)
  ACP get working dir from args.cwd (#6653)
  Optimise load config in UI (#6662)
  Fix GCP Vertex AI global endpoint support for Gemini 3 models (#6187)
  fix: macOS keychain infinite prompt loop    (#6620)
  chore: reduce duplicate or unused cargo deps (#6630)
  feat: codex subscription support (#6600)
  smoke test allow pass for flaky providers (#6638)
  feat: Add built-in skill for goose documentation reference (#6534)
  Native images (#6619)
  docs: ml-based prompt injection detection (#6627)
  Strip the audience for compacting (#6646)
  chore(release): release version 1.21.0 (minor) (#6634)
  add collapsable chat nav (#6649)
  ...
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.

GCP Vertex AI provider doesn't support global endpoint for Gemini 3 models

3 participants