Skip to content

Commit 2e69db0

Browse files
committed
fix(config): dedupe missing official plugin warnings
1 parent 78d226b commit 2e69db0

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

‎src/config/config.plugin-validation.test.ts‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ describe("config plugin validation", () => {
315315
}
316316
});
317317

318-
it("reports catalog install hints for missing configured official external plugins", () => {
318+
it("deduplicates catalog install hints for missing configured official external plugins", () => {
319319
const res = validateConfigObjectWithPlugins(
320320
{
321321
agents: { list: [{ id: "pi" }] },
@@ -339,7 +339,7 @@ describe("config plugin validation", () => {
339339
const message =
340340
"plugin not installed: brave — install the official external plugin with: openclaw plugins install @openclaw/brave-plugin";
341341
expectPathMessage(res.warnings, "plugins.entries.brave", message);
342-
expectPathMessage(res.warnings, "plugins.allow", message);
342+
expect((res.warnings ?? []).filter((warning) => warning.message === message)).toHaveLength(1);
343343
expect(
344344
(res.warnings ?? []).some(
345345
(warning) =>
@@ -403,14 +403,41 @@ describe("config plugin validation", () => {
403403
const message =
404404
"plugin not installed: memory-lancedb — install the official external plugin with: openclaw plugins install @openclaw/memory-lancedb";
405405
expectPathMessage(res.warnings, "plugins.entries.memory-lancedb", message);
406-
expectPathMessage(res.warnings, "plugins.allow", message);
406+
expect((res.warnings ?? []).filter((warning) => warning.message === message)).toHaveLength(1);
407407
expect(
408408
(res.warnings ?? []).some((warning) =>
409409
warning.message.includes("gateway will run without persistent memory"),
410410
),
411411
).toBe(false);
412412
});
413413

414+
it("deduplicates yuanbao missing-plugin warnings across entries and allow", () => {
415+
const res = validateConfigObjectWithPlugins(
416+
{
417+
agents: { list: [{ id: "pi" }] },
418+
plugins: {
419+
entries: { yuanbao: { enabled: true } },
420+
allow: ["yuanbao"],
421+
},
422+
},
423+
{
424+
env: suiteEnv(),
425+
pluginMetadataSnapshot: {
426+
manifestRegistry: {
427+
plugins: [],
428+
diagnostics: [],
429+
},
430+
},
431+
},
432+
);
433+
434+
expect(res.ok).toBe(true);
435+
const message =
436+
"plugin not installed: yuanbao — install the official external plugin with: openclaw plugins install [email protected]";
437+
expectPathMessage(res.warnings, "plugins.entries.yuanbao", message);
438+
expect((res.warnings ?? []).filter((warning) => warning.message === message)).toHaveLength(1);
439+
});
440+
414441
it("keeps official external non-memory plugins fatal in the memory slot", () => {
415442
const res = validateConfigObjectWithPlugins(
416443
{

‎src/config/validation.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ import { materializeRuntimeConfig } from "./materialize.js";
4343
import { collectConfiguredModelRefs } from "./model-refs.js";
4444
import type { OpenClawConfig, ConfigValidationIssue } from "./types.js";
4545
import { coerceSecretRef } from "./types.secrets.js";
46-
import { OpenClawSchema } from "./zod-schema.js";
4746
import { isBuiltInModelProviderOverlayId } from "./zod-schema.core.js";
47+
import { OpenClawSchema } from "./zod-schema.js";
4848

4949
const LEGACY_REMOVED_PLUGIN_IDS = new Set(["google-antigravity-auth", "google-gemini-cli-auth"]);
5050
const BLOCKED_PLUGIN_CANDIDATE_PREFIX = "blocked plugin candidate:";
@@ -1605,6 +1605,7 @@ function validateConfigObjectWithPluginsBase(
16051605
blockedDiagnosticSourceMatchesPluginId(diagnostic, pluginId),
16061606
);
16071607
};
1608+
const missingOfficialPluginWarningIds = new Set<string>();
16081609
const pushMissingPluginIssue = (
16091610
path: string,
16101611
pluginId: string,
@@ -1632,6 +1633,13 @@ function validateConfigObjectWithPluginsBase(
16321633
const externalInstallWarning =
16331634
opts.missingMessage ?? formatMissingOfficialExternalPluginWarning(pluginId);
16341635
if (externalInstallWarning) {
1636+
const normalizedPluginId = normalizePluginId(pluginId);
1637+
if (!opts.missingMessage && normalizedPluginId) {
1638+
if (missingOfficialPluginWarningIds.has(normalizedPluginId)) {
1639+
return;
1640+
}
1641+
missingOfficialPluginWarningIds.add(normalizedPluginId);
1642+
}
16351643
warnings.push({
16361644
path,
16371645
message: externalInstallWarning,

0 commit comments

Comments
 (0)