fix(anthropic-vertex): resolve model discovery and auth for GCP ADC#65716
Conversation
Greptile SummaryThis PR fixes three real bugs that prevented anthropic-vertex from working with GCP Application Default Credentials: a
Confidence Score: 5/5Safe to merge; the three core fixes are correct and well-tested, with only minor style and scope concerns remaining. All remaining findings are P2: one is a function-placement style issue in an import block, the other is an untested (but likely benign) behavior change for Ollama/custom-local markers. Neither blocks the primary ADC fix or poses a security risk. The GCP Vertex path is fully covered by new tests. src/agents/model-auth-markers.ts — verify that expanding SYNTHETIC_CREDENTIAL_MARKERS to include ollama-local and custom-local is intentional and add tests if so.
|
0640ccb to
cf2acdc
Compare
|
@steipete Could you take a look when you have a moment? This fixes model discovery and ADC auth for the anthropic-vertex provider. |
cf2acdc to
84ba5db
Compare
84ba5db to
ec9987b
Compare
Three issues prevented anthropic-vertex models from being discovered and authenticated when using GCP Application Default Credentials: 1. The provider discovery entry referenced provider-discovery.ts but dist builds only emit .js files. Add .ts->.js fallback in manifest-registry so the source loader finds the compiled file. 2. The ADC credential path resolver skipped the default ADC file check when env was not the exact process.env reference. Config runtime creates a spread copy, so the identity check always failed. Remove the guard so ADC detection works with any env object that has the right variables. 3. The discovery entry and plugin registration lacked resolveSyntheticAuth, so credential discovery never recognized gcp-vertex-credentials as valid auth. Add the hook to both the discovery entry and the plugin index.
ec9987b to
d02c9ea
Compare
|
Merged in be4920f after representative verification with targeted Anthropic Vertex auth/discovery coverage: |
…penclaw#65716) Verified: - pnpm test extensions/anthropic-vertex/index.test.ts extensions/anthropic-vertex/region.adc.test.ts src/plugins/manifest-registry.test.ts src/plugins/provider-runtime.synthetic-auth-discovery.test.ts Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…penclaw#65716) Verified: - pnpm test extensions/anthropic-vertex/index.test.ts extensions/anthropic-vertex/region.adc.test.ts src/plugins/manifest-registry.test.ts src/plugins/provider-runtime.synthetic-auth-discovery.test.ts Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…penclaw#65716) Verified: - pnpm test extensions/anthropic-vertex/index.test.ts extensions/anthropic-vertex/region.adc.test.ts src/plugins/manifest-registry.test.ts src/plugins/provider-runtime.synthetic-auth-discovery.test.ts Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…penclaw#65716) Verified: - pnpm test extensions/anthropic-vertex/index.test.ts extensions/anthropic-vertex/region.adc.test.ts src/plugins/manifest-registry.test.ts src/plugins/provider-runtime.synthetic-auth-discovery.test.ts Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…penclaw#65716) Verified: - pnpm test extensions/anthropic-vertex/index.test.ts extensions/anthropic-vertex/region.adc.test.ts src/plugins/manifest-registry.test.ts src/plugins/provider-runtime.synthetic-auth-discovery.test.ts Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…penclaw#65716) Verified: - pnpm test extensions/anthropic-vertex/index.test.ts extensions/anthropic-vertex/region.adc.test.ts src/plugins/manifest-registry.test.ts src/plugins/provider-runtime.synthetic-auth-discovery.test.ts Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Fixes #65715
Regression introduced in f0ea5bf ("plugins: add lightweight anthropic vertex discovery"), which added a provider discovery fast-path for anthropic-vertex. Three issues in that change prevented models from being discovered and authenticated when using GCP Application Default Credentials:
.ts→.jsfallback in manifest-registry: The plugin manifest referencesproviderDiscoveryEntry: "./provider-discovery.ts", but dist builds only emit.js. The jiti source loader fails to find the.tsfile, and thecatch { return []; }swallows the error silently — so the entire provider discovery returns empty. Add a fallback inresolvePluginSourcePathso the source loader finds the compiled file.Remove
env !== process.envidentity guard:resolveAnthropicVertexAdcCredentialsPathCandidateskips the default ADC file check when the env object is not the exactprocess.envreference. The config runtime creates a spread copy ({ ...process.env, ...configEnvVars }), so this identity check always fails, causingcatalog.run()to return null even when ADC credentials exist on disk. Remove the guard.Add
resolveSyntheticAuthhook: The discovery entry and plugin registration lackresolveSyntheticAuth, so credential discovery (resolvePiCredentialsForDiscovery) never recognizesgcp-vertex-credentialsas valid auth. Add the hook to both the discovery entry and the plugin index.Also adds
augmentModelCatalogto the plugin registration andisSyntheticCredentialMarkertomodel-auth-markerssoresolveUsableCustomProviderApiKeytreats synthetic credential markers as usable.Testing
resolveSyntheticAuth(ADC present / absent)openclaw models listshowstext+image,1Mctx,Auth: yesfor anthropic-vertex models after the fix