fix(ci): repair plugin registry test lanes

This commit is contained in:
Peter Steinberger
2026-04-26 01:29:47 +01:00
parent e7c131d6de
commit b565e6e963
4 changed files with 27 additions and 9 deletions

View File

@@ -712,7 +712,7 @@ describe("subagent registry persistence", () => {
resetSubagentRegistryForTests({ persist: false });
const resolved = withEnv({ VITEST: undefined, NODE_ENV: "development" }, () =>
const resolved = withEnv({ OPENCLAW_TEST_READ_SUBAGENT_RUNS_FROM_DISK: "1" }, () =>
getSubagentRunByChildSessionKey(childSessionKey),
);
@@ -758,7 +758,7 @@ describe("subagent registry persistence", () => {
resetSubagentRegistryForTests({ persist: false });
const resolved = withEnv({ VITEST: undefined, NODE_ENV: "development" }, () =>
const resolved = withEnv({ OPENCLAW_TEST_READ_SUBAGENT_RUNS_FROM_DISK: "1" }, () =>
getLatestSubagentRunByChildSessionKey(childSessionKey),
);

View File

@@ -33,6 +33,7 @@ describe("plugins cli policy mutations", () => {
expect(writeConfigFile).toHaveBeenCalledWith(enabledConfig);
expect(refreshPluginRegistry).toHaveBeenCalledWith({
config: enabledConfig,
installRecords: {},
reason: "policy-changed",
});
});
@@ -52,6 +53,7 @@ describe("plugins cli policy mutations", () => {
expect(nextConfig.plugins?.entries?.alpha?.enabled).toBe(false);
expect(refreshPluginRegistry).toHaveBeenCalledWith({
config: nextConfig,
installRecords: {},
reason: "policy-changed",
});
});

View File

@@ -91,6 +91,7 @@ vi.mock("../../plugins/loader.js", () => ({
const clearPluginDiscoveryCache = vi.fn();
vi.mock("../../plugins/discovery.js", () => ({
clearPluginDiscoveryCache: () => clearPluginDiscoveryCache(),
discoverOpenClawPlugins: () => ({ candidates: [], diagnostics: [] }),
}));
import fs from "node:fs";

View File

@@ -1217,7 +1217,10 @@ function resolvePluginLoadCacheContext(options: PluginLoadOptions = {}) {
const shouldInstallBundledRuntimeDeps = options.installBundledRuntimeDeps !== false;
const runtimeSubagentMode = resolveRuntimeSubagentMode(options.runtimeOptions);
const coreGatewayMethodNames = Object.keys(options.coreGatewayHandlers ?? {}).toSorted();
const installRecords = loadInstalledPluginIndexInstallRecordsSync({ env });
const installRecords = {
...loadInstalledPluginIndexInstallRecordsSync({ env }),
...cfg.plugins?.installs,
};
const cacheKey = buildCacheKey({
workspaceDir: options.workspaceDir,
plugins: trustNormalized,
@@ -1255,6 +1258,7 @@ function resolvePluginLoadCacheContext(options: PluginLoadOptions = {}) {
shouldLoadModules: options.loadModules !== false,
shouldInstallBundledRuntimeDeps,
runtimeSubagentMode,
installRecords,
cacheKey,
};
}
@@ -2157,6 +2161,7 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
shouldInstallBundledRuntimeDeps,
cacheKey,
runtimeSubagentMode,
installRecords,
} = resolvePluginLoadCacheContext(options);
const logger = options.logger ?? defaultLogger();
const validateOnly = options.mode === "validate";
@@ -2316,6 +2321,7 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
env,
candidates: discovery.candidates,
diagnostics: discovery.diagnostics,
installRecords: Object.keys(installRecords).length > 0 ? installRecords : undefined,
});
pushDiagnostics(registry.diagnostics, manifestRegistry.diagnostics);
warnWhenAllowlistIsOpen({
@@ -3180,12 +3186,20 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
export async function loadOpenClawPluginCliRegistry(
options: PluginLoadOptions = {},
): Promise<PluginRegistry> {
const { env, cfg, normalized, activationSource, autoEnabledReasons, onlyPluginIds, cacheKey } =
resolvePluginLoadCacheContext({
...options,
activate: false,
cache: false,
});
const {
env,
cfg,
normalized,
activationSource,
autoEnabledReasons,
onlyPluginIds,
cacheKey,
installRecords,
} = resolvePluginLoadCacheContext({
...options,
activate: false,
cache: false,
});
const logger = options.logger ?? defaultLogger();
const onlyPluginIdSet = createPluginIdScopeSet(onlyPluginIds);
const getJiti = createPluginJitiLoader(options);
@@ -3209,6 +3223,7 @@ export async function loadOpenClawPluginCliRegistry(
env,
candidates: discovery.candidates,
diagnostics: discovery.diagnostics,
installRecords: Object.keys(installRecords).length > 0 ? installRecords : undefined,
});
pushDiagnostics(registry.diagnostics, manifestRegistry.diagnostics);
warnWhenAllowlistIsOpen({