From dec5de8a2cdaa64a4ff7d5412cfeb3fd8e7448ae Mon Sep 17 00:00:00 2001 From: Shakker Date: Wed, 29 Apr 2026 18:55:02 +0100 Subject: [PATCH] fix: declare google vertex local auth evidence --- extensions/google/openclaw.plugin.json | 13 ++++++++++++- src/agents/model-auth.profiles.test.ts | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/extensions/google/openclaw.plugin.json b/extensions/google/openclaw.plugin.json index 03874e0208d..11a5b53dbc7 100644 --- a/extensions/google/openclaw.plugin.json +++ b/extensions/google/openclaw.plugin.json @@ -76,7 +76,18 @@ { "id": "google-vertex", "authMethods": ["api-key"], - "envVars": ["GOOGLE_CLOUD_API_KEY"] + "envVars": ["GOOGLE_CLOUD_API_KEY"], + "authEvidence": [ + { + "type": "local-file-with-env", + "fileEnvVar": "GOOGLE_APPLICATION_CREDENTIALS", + "fallbackPaths": ["${HOME}/.config/gcloud/application_default_credentials.json"], + "requiresAnyEnv": ["GOOGLE_CLOUD_PROJECT", "GCLOUD_PROJECT"], + "requiresAllEnv": ["GOOGLE_CLOUD_LOCATION"], + "credentialMarker": "gcp-vertex-credentials", + "source": "gcloud adc" + } + ] } ] }, diff --git a/src/agents/model-auth.profiles.test.ts b/src/agents/model-auth.profiles.test.ts index 99baf9c435e..ba24be08f3e 100644 --- a/src/agents/model-auth.profiles.test.ts +++ b/src/agents/model-auth.profiles.test.ts @@ -93,6 +93,7 @@ vi.mock("./model-auth-env-vars.js", () => { const candidates = { anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"], google: ["GEMINI_API_KEY", "GOOGLE_API_KEY"], + "google-vertex": ["GOOGLE_CLOUD_API_KEY"], "demo-local": ["DEMO_LOCAL_API_KEY"], huggingface: ["HUGGINGFACE_HUB_TOKEN", "HF_TOKEN"], "minimax-portal": ["MINIMAX_OAUTH_TOKEN", "MINIMAX_API_KEY"], @@ -109,6 +110,19 @@ vi.mock("./model-auth-env-vars.js", () => { PROVIDER_ENV_API_KEY_CANDIDATES: candidates, listKnownProviderEnvApiKeyNames: () => [...new Set(Object.values(candidates).flat())], resolveProviderEnvApiKeyCandidates: () => candidates, + resolveProviderEnvAuthEvidence: () => ({ + "google-vertex": [ + { + type: "local-file-with-env", + fileEnvVar: "GOOGLE_APPLICATION_CREDENTIALS", + fallbackPaths: ["${HOME}/.config/gcloud/application_default_credentials.json"], + requiresAnyEnv: ["GOOGLE_CLOUD_PROJECT", "GCLOUD_PROJECT"], + requiresAllEnv: ["GOOGLE_CLOUD_LOCATION"], + credentialMarker: "gcp-vertex-credentials", + source: "gcloud adc", + }, + ], + }), }; }); @@ -812,7 +826,7 @@ describe("getApiKeyForModel", () => { } as NodeJS.ProcessEnv); expect(resolved?.apiKey).toBe("google-cloud-api-key"); - expect(resolved?.source).toBe("gcloud adc"); + expect(resolved?.source).toBe("env: GOOGLE_CLOUD_API_KEY"); }); it("resolveEnvApiKey('google-vertex') accepts ADC credentials from the provided env snapshot", async () => {