fix: stabilize full release validation

This commit is contained in:
Peter Steinberger
2026-04-30 04:55:17 +01:00
parent 1f1f70a23f
commit 94cb213544
5 changed files with 73 additions and 5 deletions

View File

@@ -176,6 +176,27 @@ function createRuntimeCore(cfg: OpenClawConfig) {
};
},
);
const run = vi.fn(
async (params: {
raw: unknown;
adapter: {
ingest: (raw: unknown) => unknown;
resolveTurn: (
input: unknown,
eventClass: { kind: "message"; canStartAgentTurn: true },
preflight: Record<string, never>,
) => Parameters<typeof runPrepared>[0];
};
}) => {
const input = params.adapter.ingest(params.raw);
const turn = params.adapter.resolveTurn(
input,
{ kind: "message", canStartAgentTurn: true },
{},
);
return await runPrepared(turn);
},
);
return {
config: {
current: () => cfg,
@@ -260,6 +281,7 @@ function createRuntimeCore(cfg: OpenClawConfig) {
updateLastRoute: vi.fn(async () => {}),
},
turn: {
run,
runPrepared,
},
text: {

View File

@@ -77,7 +77,10 @@ function hasInstalledRuntimeDepEntryFiles(packageDir: string, packageJson: JsonO
if (mainPath !== packageDir && !mainPath.startsWith(`${packageDir}${path.sep}`)) {
return false;
}
return fs.existsSync(mainPath);
if (fs.existsSync(mainPath)) {
return true;
}
return [".js", ".json", ".node"].some((extension) => fs.existsSync(`${mainPath}${extension}`));
}
export function isRuntimeDepSatisfied(

View File

@@ -886,6 +886,33 @@ describe("installBundledRuntimeDeps", () => {
);
});
it("accepts extensionless package main entries resolved by Node", () => {
const installRoot = makeTempDir();
spawnSyncMock.mockImplementation((_command, _args, options) => {
const packageDir = path.join(String(options?.cwd ?? ""), "node_modules", "jszip");
fs.mkdirSync(path.join(packageDir, "lib"), { recursive: true });
fs.writeFileSync(
path.join(packageDir, "package.json"),
JSON.stringify({ name: "jszip", version: "3.10.1", main: "./lib/index" }),
);
fs.writeFileSync(path.join(packageDir, "lib", "index.js"), "export default {};\n");
return {
pid: 123,
output: [],
stdout: "",
stderr: "",
signal: null,
status: 0,
};
});
installBundledRuntimeDeps({
installRoot,
missingSpecs: ["jszip@^3.10.1"],
env: {},
});
});
it("cleans an owned isolated execution root after copying node_modules back", () => {
const installRoot = makeTempDir();
const installExecutionRoot = path.join(installRoot, ".openclaw-install-stage");

View File

@@ -103,6 +103,7 @@ function expectBundledCompatLoadPath(params: {
config: params.enablementCompat,
onlyPluginIds: ["openai"],
activate: false,
installBundledRuntimeDeps: false,
});
}
@@ -408,6 +409,7 @@ describe("resolvePluginCapabilityProviders", () => {
}),
onlyPluginIds: ["microsoft"],
activate: false,
installBundledRuntimeDeps: false,
});
});
@@ -582,6 +584,7 @@ describe("resolvePluginCapabilityProviders", () => {
config: expect.anything(),
onlyPluginIds: [],
activate: false,
installBundledRuntimeDeps: false,
});
});
@@ -626,6 +629,7 @@ describe("resolvePluginCapabilityProviders", () => {
config: compatConfig,
onlyPluginIds: ["google"],
activate: false,
installBundledRuntimeDeps: false,
});
});
@@ -649,6 +653,7 @@ describe("resolvePluginCapabilityProviders", () => {
config: expect.anything(),
onlyPluginIds: [],
activate: false,
installBundledRuntimeDeps: false,
});
});
@@ -786,6 +791,7 @@ describe("resolvePluginCapabilityProviders", () => {
config: enablementCompat,
onlyPluginIds: ["google"],
activate: false,
installBundledRuntimeDeps: false,
});
});
});

View File

@@ -226,8 +226,13 @@ export function resolvePluginCapabilityProvider<K extends CapabilityProviderRegi
});
const loadOptions =
compatConfig === undefined
? { onlyPluginIds: pluginIds, activate: false }
: { config: compatConfig, onlyPluginIds: pluginIds, activate: false };
? { onlyPluginIds: pluginIds, activate: false, installBundledRuntimeDeps: false }
: {
config: compatConfig,
onlyPluginIds: pluginIds,
activate: false,
installBundledRuntimeDeps: false,
};
const registry = resolveRuntimePluginRegistry(loadOptions);
return findProviderById(registry?.[params.key] ?? [], params.providerId);
}
@@ -269,8 +274,13 @@ export function resolvePluginCapabilityProviders<K extends CapabilityProviderReg
});
const loadOptions =
compatConfig === undefined
? { onlyPluginIds: pluginIds, activate: false }
: { config: compatConfig, onlyPluginIds: pluginIds, activate: false };
? { onlyPluginIds: pluginIds, activate: false, installBundledRuntimeDeps: false }
: {
config: compatConfig,
onlyPluginIds: pluginIds,
activate: false,
installBundledRuntimeDeps: false,
};
const registry = resolveRuntimePluginRegistry(loadOptions);
const loadedProviders = registry?.[params.key] ?? [];
if (params.key !== "memoryEmbeddingProviders") {