Skip to content

fix(anthropic-vertex): resolve model discovery and auth for GCP ADC#65716

Merged
Takhoffman merged 3 commits into
openclaw:mainfrom
feiskyer:fix/anthropic-vertex-model-catalog
Apr 23, 2026
Merged

fix(anthropic-vertex): resolve model discovery and auth for GCP ADC#65716
Takhoffman merged 3 commits into
openclaw:mainfrom
feiskyer:fix/anthropic-vertex-model-catalog

Conversation

@feiskyer

@feiskyer feiskyer commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

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:

  1. .ts.js fallback in manifest-registry: The plugin manifest references providerDiscoveryEntry: "./provider-discovery.ts", but dist builds only emit .js. The jiti source loader fails to find the .ts file, and the catch { return []; } swallows the error silently — so the entire provider discovery returns empty. Add a fallback in resolvePluginSourcePath so the source loader finds the compiled file.

  2. Remove env !== process.env identity guard: resolveAnthropicVertexAdcCredentialsPathCandidate skips the default ADC file check when the env object is not the exact process.env reference. The config runtime creates a spread copy ({ ...process.env, ...configEnvVars }), so this identity check always fails, causing catalog.run() to return null even when ADC credentials exist on disk. Remove the guard.

  3. Add resolveSyntheticAuth hook: The discovery entry and plugin registration lack resolveSyntheticAuth, so credential discovery (resolvePiCredentialsForDiscovery) never recognizes gcp-vertex-credentials as valid auth. Add the hook to both the discovery entry and the plugin index.

Also adds augmentModelCatalog to the plugin registration and isSyntheticCredentialMarker to model-auth-markers so resolveUsableCustomProviderApiKey treats synthetic credential markers as usable.

Testing

  • All existing anthropic-vertex tests pass (12 tests across 4 files)
  • Added 2 new tests for resolveSyntheticAuth (ADC present / absent)
  • Verified locally: openclaw models list shows text+image, 1M ctx, Auth: yes for anthropic-vertex models after the fix

@feiskyer feiskyer requested a review from a team as a code owner April 13, 2026 04:53
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Apr 13, 2026
@greptile-apps

greptile-apps Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes three real bugs that prevented anthropic-vertex from working with GCP Application Default Credentials: a .ts.js source-path fallback in manifest-registry, removal of a broken env !== process.env identity guard in both region and discovery files, and addition of resolveSyntheticAuth to both the discovery entry and plugin registration so the credential marker is recognized as valid auth.

  • SYNTHETIC_CREDENTIAL_MARKERS in model-auth-markers.ts also pulls in OLLAMA_LOCAL_AUTH_MARKER and CUSTOM_LOCAL_AUTH_MARKER, silently flipping hasUsableCustomProviderApiKey from null to a synthetic-key result for those providers — a broader change than described that should be explicitly tested or scoped to GCP_VERTEX_CREDENTIALS_MARKER only.
  • resolvePluginSourcePath is inserted between two import groups in manifest-registry.ts (a formatting/style violation).

Confidence Score: 5/5

Safe 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.

Comments Outside Diff (1)

  1. src/agents/model-auth-markers.ts, line 47-55 (link)

    P2 Silent behavior change for Ollama and custom-local providers

    Including OLLAMA_LOCAL_AUTH_MARKER and CUSTOM_LOCAL_AUTH_MARKER here changes resolveUsableCustomProviderApiKey for any user who has ollama-local or custom-local in their models.json apiKey field. Previously the function returned null (treated as "no usable key"); now it returns a non-null synthetic result. This flips hasUsableCustomProviderApiKey from false to true, which affects hasAuthForProvider in model-picker.ts and the auth-check loop in provider-usage.auth.ts.

    The PR description and new tests only cover the GCP Vertex fix. If expanding to Ollama/custom-local is intentional, it deserves a test and a sentence in the description. If it is unintentional, scope SYNTHETIC_CREDENTIAL_MARKERS to just GCP_VERTEX_CREDENTIALS_MARKER for now.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/agents/model-auth-markers.ts
    Line: 47-55
    
    Comment:
    **Silent behavior change for Ollama and custom-local providers**
    
    Including `OLLAMA_LOCAL_AUTH_MARKER` and `CUSTOM_LOCAL_AUTH_MARKER` here changes `resolveUsableCustomProviderApiKey` for any user who has `ollama-local` or `custom-local` in their `models.json` `apiKey` field. Previously the function returned `null` (treated as "no usable key"); now it returns a non-null synthetic result. This flips `hasUsableCustomProviderApiKey` from `false` to `true`, which affects `hasAuthForProvider` in `model-picker.ts` and the auth-check loop in `provider-usage.auth.ts`.
    
    The PR description and new tests only cover the GCP Vertex fix. If expanding to Ollama/custom-local is intentional, it deserves a test and a sentence in the description. If it is unintentional, scope `SYNTHETIC_CREDENTIAL_MARKERS` to just `GCP_VERTEX_CREDENTIALS_MARKER` for now.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/plugins/manifest-registry.ts
Line: 17-29

Comment:
**Function inserted mid-import-block**

`resolvePluginSourcePath` is defined between two groups of `import` declarations (lines 1–11 are one group, lines 29+ are another). Conventions and most formatters/linters expect all `import` statements to appear at the top of the file before any code. The function should be moved below the last `import` line to avoid potential CI formatting failures.

```suggestion
import { loadBundleManifest } from "./bundle-manifest.js";
import {
  normalizePluginsConfigWithResolver,
  type NormalizedPluginsConfig,
} from "./config-policy.js";

/**
 * Resolve a plugin source path, falling back from .ts to .js when the
 * .ts file doesn't exist on disk (e.g. in dist builds where only .js
 * is emitted but the manifest still references the .ts entry).
 */
function resolvePluginSourcePath(sourcePath: string): string {
```

(Move the function definition to after all imports are complete.)

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/agents/model-auth-markers.ts
Line: 47-55

Comment:
**Silent behavior change for Ollama and custom-local providers**

Including `OLLAMA_LOCAL_AUTH_MARKER` and `CUSTOM_LOCAL_AUTH_MARKER` here changes `resolveUsableCustomProviderApiKey` for any user who has `ollama-local` or `custom-local` in their `models.json` `apiKey` field. Previously the function returned `null` (treated as "no usable key"); now it returns a non-null synthetic result. This flips `hasUsableCustomProviderApiKey` from `false` to `true`, which affects `hasAuthForProvider` in `model-picker.ts` and the auth-check loop in `provider-usage.auth.ts`.

The PR description and new tests only cover the GCP Vertex fix. If expanding to Ollama/custom-local is intentional, it deserves a test and a sentence in the description. If it is unintentional, scope `SYNTHETIC_CREDENTIAL_MARKERS` to just `GCP_VERTEX_CREDENTIALS_MARKER` for now.

```suggestion
const SYNTHETIC_CREDENTIAL_MARKERS = new Set([
  GCP_VERTEX_CREDENTIALS_MARKER,
]);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(anthropic-vertex): resolve model dis..." | Re-trigger Greptile

@feiskyer feiskyer force-pushed the fix/anthropic-vertex-model-catalog branch from 0640ccb to cf2acdc Compare April 13, 2026 05:04
Comment thread src/plugins/manifest-registry.ts Outdated
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Apr 13, 2026
@feiskyer

Copy link
Copy Markdown
Contributor Author

@steipete Could you take a look when you have a moment? This fixes model discovery and ADC auth for the anthropic-vertex provider.

@feiskyer feiskyer force-pushed the fix/anthropic-vertex-model-catalog branch from cf2acdc to 84ba5db Compare April 15, 2026 08:56
@feiskyer feiskyer force-pushed the fix/anthropic-vertex-model-catalog branch from 84ba5db to ec9987b Compare April 23, 2026 12:38
feiskyer and others added 3 commits April 23, 2026 08:59
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.
@Takhoffman Takhoffman force-pushed the fix/anthropic-vertex-model-catalog branch from ec9987b to d02c9ea Compare April 23, 2026 14:02
@Takhoffman Takhoffman merged commit be4920f into openclaw:main Apr 23, 2026
56 of 65 checks passed
@Takhoffman

Copy link
Copy Markdown
Contributor

Merged in be4920f after representative verification with targeted Anthropic Vertex auth/discovery coverage: 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.
I made follow-up updates on the PR branch before merge to restore cold-start synthetic auth discovery for Anthropic Vertex, make copied env snapshots honor their own ADC home path, and add regression coverage for the manifest/discovery/runtime seams. The changelog entry is in CHANGELOG.md under 2026.4.22 Fixes.

ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…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>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…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>
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
…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>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…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>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…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>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

anthropic-vertex models missing after upgrade to 2026.4.11

2 participants