Skip to content

fix: use correct hostname for Vertex AI global region endpoint - #88

Open
jflowers wants to merge 1 commit into
unbound-force:mainfrom
jflowers:opsx/vertex-global-region-url
Open

fix: use correct hostname for Vertex AI global region endpoint#88
jflowers wants to merge 1 commit into
unbound-force:mainfrom
jflowers:opsx/vertex-global-region-url

Conversation

@jflowers

@jflowers jflowers commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

When region: global is configured in config.yaml, both Vertex AI providers (VertexSynthesizer and VertexEmbedder) produced malformed URLs with hostname global-aiplatform.googleapis.com, causing silent DNS resolution failures. The correct global endpoint uses aiplatform.googleapis.com without a region prefix, while retaining locations/global in the URL path.

This fix adds conditional hostname construction in both rawPredictURL() and predictURL() methods. Regional endpoints (e.g., us-east5, us-central1) continue to work identically.

How to Test

Run the regression tests directly:

go test -race -count=1 -run TestVertexSynthesizer_RawPredictURL ./llm/
go test -race -count=1 -run TestVertexEmbedder_PredictURL ./embed/

Both tests are table-driven with two subtests each:

  1. Global region (regression): Verifies region: "global" produces https://aiplatform.googleapis.com/v1/... (not https://global-aiplatform.googleapis.com/v1/...)
  2. Regional endpoint (unchanged): Verifies region: "us-east5" / "us-central1" continues producing https://{region}-aiplatform.googleapis.com/v1/...

Full test suite:

go build ./...
go vet ./...
go test -race -count=1 ./...

How to Demo

Configure region: global in .uf/dewey/config.yaml:

embedding:
  provider: vertex
  model: text-embedding-005
  project: my-project
  region: global

synthesis:
  provider: vertex
  model: claude-sonnet-4-6
  project: my-project
  region: global

Before this fix, Dewey would fail with DNS resolution errors when making Vertex AI requests. After this fix, requests route correctly through Google's global endpoint (aiplatform.googleapis.com), which forwards to the nearest available region.

Key Files Changed

File Change
llm/vertex.go Fix rawPredictURL() — conditional hostname for global region
embed/vertex.go Fix predictURL() — conditional hostname for global region
llm/vertex_test.go Add TestVertexSynthesizer_RawPredictURL table-driven regression tests
embed/vertex_test.go Add TestVertexEmbedder_PredictURL table-driven regression tests
README.md Document global as a valid region value
AGENTS.md Document global as a valid region value
openspec/changes/vertex-global-region-url/ OpenSpec artifacts (proposal, design, specs, tasks)

This PR was generated by /uf.finale (AI-assisted).

@jflowers jflowers self-assigned this Aug 14, 2026
@jflowers jflowers added the next-release Targeted for inclusion in next release but can be deferred if needed label Aug 14, 2026
@jflowers jflowers moved this to Ready for Review 👀 in Unbound Force Planning Aug 14, 2026
@jflowers
jflowers force-pushed the opsx/vertex-global-region-url branch from 6a40f6b to e936539 Compare August 14, 2026 20:21
When region is set to 'global', both VertexSynthesizer.rawPredictURL()
and VertexEmbedder.predictURL() were producing malformed URLs with
hostname 'global-aiplatform.googleapis.com'. The correct global endpoint
uses 'aiplatform.googleapis.com' without a region prefix.

- Add conditional hostname construction in both methods
- Add table-driven regression tests covering global and regional endpoints
- Update README and AGENTS.md to document 'global' as a valid region value

OpenSpec: vertex-global-region-url

Assisted-by: claude-opus
Generated with AI assistance (claude-opus)
@jflowers
jflowers force-pushed the opsx/vertex-global-region-url branch from e936539 to 5dc6c28 Compare August 14, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next-release Targeted for inclusion in next release but can be deferred if needed

Projects

Status: Ready for Review 👀

Development

Successfully merging this pull request may close these issues.

2 participants