Skip to content

Commit 0fbf463

Browse files
committed
fix(plugins): suppress mirrored provider env warnings
1 parent d68ca42 commit 0fbf463

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

‎extensions/brave/openclaw.plugin.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
"providerAuthEnvVars": {
77
"brave": ["BRAVE_API_KEY"]
88
},
9+
"setup": {
10+
"providers": [
11+
{
12+
"id": "brave",
13+
"authMethods": ["api-key"],
14+
"envVars": ["BRAVE_API_KEY"]
15+
}
16+
]
17+
},
918
"uiHints": {
1019
"webSearch.apiKey": {
1120
"label": "Brave Search API Key",

‎src/plugins/manifest-registry.test.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,35 @@ describe("loadPluginManifestRegistry", () => {
923923
);
924924
});
925925

926+
it("does not report deprecated providerAuthEnvVars when setup providers mirror env vars", () => {
927+
const dir = makeTempDir();
928+
writeManifest(dir, {
929+
id: "external-openai",
930+
providers: ["openai"],
931+
setup: {
932+
providers: [{ id: "openai", envVars: ["OPENAI_API_KEY"] }],
933+
},
934+
providerAuthEnvVars: {
935+
openai: ["OPENAI_API_KEY"],
936+
},
937+
configSchema: { type: "object" },
938+
});
939+
940+
const registry = loadSingleCandidateRegistry({
941+
idHint: "external-openai",
942+
rootDir: dir,
943+
origin: "global",
944+
});
945+
946+
expect(registry.diagnostics).not.toContainEqual(
947+
expect.objectContaining({
948+
message: expect.stringContaining(
949+
"providerAuthEnvVars is deprecated compatibility metadata",
950+
),
951+
}),
952+
);
953+
});
954+
926955
it("sanitizes manifest-controlled fields in provider auth compatibility diagnostics", () => {
927956
const dir = makeTempDir();
928957
const lineBreak = String.fromCharCode(10);

‎src/plugins/manifest-registry.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,19 @@ function pushProviderAuthEnvVarsCompatDiagnostic(params: {
425425
if (params.record.origin === "bundled" || !params.record.providerAuthEnvVars) {
426426
return;
427427
}
428+
const setupProviderEnvVars = new Map(
429+
(params.record.setup?.providers ?? []).map(
430+
(provider) => [provider.id, new Set(provider.envVars ?? [])] as const,
431+
),
432+
);
428433
const providerIds = Object.entries(params.record.providerAuthEnvVars)
429-
.filter(([providerId, envVars]) => providerId.trim() && envVars.length > 0)
434+
.filter(([providerId, envVars]) => {
435+
if (!providerId.trim() || envVars.length === 0) {
436+
return false;
437+
}
438+
const mirroredEnvVars = setupProviderEnvVars.get(providerId);
439+
return !mirroredEnvVars || envVars.some((envVar) => !mirroredEnvVars.has(envVar));
440+
})
430441
.map(([providerId]) => providerId)
431442
.toSorted((left, right) => left.localeCompare(right));
432443
if (providerIds.length === 0) {

0 commit comments

Comments
 (0)