fix(regression): align plugin status with runtime compat

This commit is contained in:
Tak Hoffman
2026-03-27 18:53:10 -05:00
parent 55b9ce1c9d
commit ee2220ca08
2 changed files with 32 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ const loadConfigMock = vi.fn();
const loadOpenClawPluginsMock = vi.fn();
const resolveBundledProviderCompatPluginIdsMock = vi.fn();
const withBundledPluginAllowlistCompatMock = vi.fn();
const withBundledPluginEnablementCompatMock = vi.fn();
let buildPluginStatusReport: typeof import("./status.js").buildPluginStatusReport;
let buildPluginInspectReport: typeof import("./status.js").buildPluginInspectReport;
let buildAllPluginInspectReports: typeof import("./status.js").buildAllPluginInspectReports;
@@ -37,6 +38,8 @@ vi.mock("./providers.js", () => ({
vi.mock("./bundled-compat.js", () => ({
withBundledPluginAllowlistCompat: (...args: unknown[]) =>
withBundledPluginAllowlistCompatMock(...args),
withBundledPluginEnablementCompat: (...args: unknown[]) =>
withBundledPluginEnablementCompatMock(...args),
}));
vi.mock("../agents/agent-scope.js", () => ({
@@ -64,11 +67,15 @@ describe("buildPluginStatusReport", () => {
loadOpenClawPluginsMock.mockReset();
resolveBundledProviderCompatPluginIdsMock.mockReset();
withBundledPluginAllowlistCompatMock.mockReset();
withBundledPluginEnablementCompatMock.mockReset();
loadConfigMock.mockReturnValue({});
resolveBundledProviderCompatPluginIdsMock.mockReturnValue([]);
withBundledPluginAllowlistCompatMock.mockImplementation(
(params: { config: unknown }) => params.config,
);
withBundledPluginEnablementCompatMock.mockImplementation(
(params: { config: unknown }) => params.config,
);
setPluginLoadResult({ plugins: [] });
({
buildAllPluginInspectReports,
@@ -99,12 +106,22 @@ describe("buildPluginStatusReport", () => {
);
});
it("applies bundled provider allowlist compat before loading plugins", () => {
it("applies the full bundled provider compat chain before loading plugins", () => {
const config = { plugins: { allow: ["telegram"] } };
loadConfigMock.mockReturnValue(config);
resolveBundledProviderCompatPluginIdsMock.mockReturnValue(["anthropic", "openai"]);
const compatConfig = { plugins: { allow: ["telegram", "anthropic", "openai"] } };
const enabledConfig = {
plugins: {
allow: ["telegram", "anthropic", "openai"],
entries: {
anthropic: { enabled: true },
openai: { enabled: true },
},
},
};
withBundledPluginAllowlistCompatMock.mockReturnValue(compatConfig);
withBundledPluginEnablementCompatMock.mockReturnValue(enabledConfig);
buildPluginStatusReport({ config });
@@ -112,8 +129,12 @@ describe("buildPluginStatusReport", () => {
config,
pluginIds: ["anthropic", "openai"],
});
expect(withBundledPluginEnablementCompatMock).toHaveBeenCalledWith({
config: compatConfig,
pluginIds: ["anthropic", "openai"],
});
expect(loadOpenClawPluginsMock).toHaveBeenCalledWith(
expect.objectContaining({ config: compatConfig }),
expect.objectContaining({ config: enabledConfig }),
);
});

View File

@@ -6,7 +6,10 @@ import { createSubsystemLogger } from "../logging/subsystem.js";
import { resolveCompatibilityHostVersion } from "../version.js";
import { inspectBundleLspRuntimeSupport } from "./bundle-lsp.js";
import { inspectBundleMcpRuntimeSupport } from "./bundle-mcp.js";
import { withBundledPluginAllowlistCompat } from "./bundled-compat.js";
import {
withBundledPluginAllowlistCompat,
withBundledPluginEnablementCompat,
} from "./bundled-compat.js";
import { normalizePluginsConfig } from "./config-state.js";
import { loadOpenClawPlugins } from "./loader.js";
import { createPluginLoaderLogger } from "./logger.js";
@@ -160,9 +163,13 @@ export function buildPluginStatusReport(params?: {
config,
pluginIds: bundledProviderIds,
});
const runtimeCompatConfig = withBundledPluginEnablementCompat({
config: effectiveConfig,
pluginIds: bundledProviderIds,
});
const registry = loadOpenClawPlugins({
config: effectiveConfig,
config: runtimeCompatConfig,
workspaceDir,
env: params?.env,
logger: createPluginLoaderLogger(log),