mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 11:21:07 +00:00
fix(regression): align plugin status with runtime compat
This commit is contained in:
@@ -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 }),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user