Skip to content

Commit 2a603ba

Browse files
committed
fix(plugins): honor enabledByDefault in config validation warnings
Doctor/status treated config-only default-on bundled plugins as disabled because validation omitted the manifest default that plugins list already passes. Pass enabledByDefault through the shared activation resolver. Closes #122746
1 parent b4ffa31 commit 2a603ba

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,53 @@ describe("config plugin validation", () => {
18791879
});
18801880
});
18811881

1882+
it.each([
1883+
{
1884+
pluginId: "canvas",
1885+
config: { host: { enabled: true } },
1886+
expectDisabledConfigWarning: false,
1887+
},
1888+
{
1889+
pluginId: "workboard",
1890+
config: {},
1891+
expectDisabledConfigWarning: true,
1892+
},
1893+
] as const)(
1894+
"honors bundled default enablement for config-only $pluginId entries",
1895+
({ pluginId, config, expectDisabledConfigWarning }) => {
1896+
const res = validateConfigObjectWithPlugins(
1897+
{
1898+
agents: { list: [{ id: "openclaw" }] },
1899+
plugins: {
1900+
entries: {
1901+
[pluginId]: { config },
1902+
},
1903+
},
1904+
},
1905+
{
1906+
env: {
1907+
...suiteEnv(),
1908+
OPENCLAW_BUNDLED_PLUGINS_DIR: path.join(process.cwd(), "extensions"),
1909+
},
1910+
},
1911+
);
1912+
1913+
expect(res.ok).toBe(true);
1914+
if (!res.ok) {
1915+
return;
1916+
}
1917+
const disabledConfigWarning = {
1918+
path: `plugins.entries.${pluginId}`,
1919+
message: "plugin disabled (bundled (disabled by default)) but config is present",
1920+
};
1921+
if (expectDisabledConfigWarning) {
1922+
expect(res.warnings).toContainEqual(disabledConfigWarning);
1923+
return;
1924+
}
1925+
expect(res.warnings).not.toContainEqual(disabledConfigWarning);
1926+
},
1927+
);
1928+
18821929
it("ignores standalone helper scripts in auto-discovered global extensions", async () => {
18831930
const helperPath = path.join(suiteHome, ".openclaw", "extensions", "my-helper.mjs");
18841931
await mkdirSafe(path.dirname(helperPath));

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
resolveEffectivePluginActivationState,
77
resolveMemorySlotDecision,
88
} from "../plugins/config-state.js";
9+
import { isPluginEnabledByDefaultForPlatform } from "../plugins/default-enablement.js";
910
import { resolveManifestCommandAliasOwnerInRegistry } from "../plugins/manifest-command-aliases.js";
1011
import type { PluginManifestRegistry } from "../plugins/manifest-registry.js";
1112
import {
@@ -360,11 +361,14 @@ export function validateExplicitPluginConfig(params: {
360361
seenPlugins.add(pluginId);
361362
const entry = normalizedPlugins.entries[pluginId];
362363
const entryHasConfig = Boolean(entry?.config);
364+
// Honor manifest default enablement so config-only entries for default-on
365+
// bundled plugins do not warn as disabled. List/runtime already pass this.
363366
const activationState = resolveEffectivePluginActivationState({
364367
id: pluginId,
365368
origin: record.origin,
366369
config: normalizedPlugins,
367370
rootConfig: effectiveConfig,
371+
enabledByDefault: isPluginEnabledByDefaultForPlatform(record),
368372
});
369373
let enabled = activationState.activated;
370374
let reason = activationState.reason;

0 commit comments

Comments
 (0)