Skip to content

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 from ef26556 to 625aa3d Compare January 15, 2026 04:54
- 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 <[email protected]>
- 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 <[email protected]>
@clouatre clouatre force-pushed the fix/gcp-vertex-ai-global-endpoint branch 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.

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

2 participants