fix: land plugin discovery missing-entry handling (#52491) (thanks @hclsys)

This commit is contained in:
Peter Steinberger
2026-03-22 23:12:48 +00:00
parent d0f5e7cb2d
commit d73852ff21
4 changed files with 23 additions and 0 deletions

View File

@@ -35,6 +35,10 @@ function createEmptyPluginRegistry(): PluginRegistry {
};
}
function createPluginRegistryStub(): PluginRegistry {
return createEmptyPluginRegistry();
}
const sessionBindingState = vi.hoisted(() => {
const records = new Map<string, SessionBindingRecord>();
let nextId = 1;

View File

@@ -396,6 +396,23 @@ describe("discoverOpenClawPlugins", () => {
expectEscapesPackageDiagnostic(result.diagnostics);
});
it("skips missing package extension entries without escape diagnostics", async () => {
const stateDir = makeTempDir();
const globalExt = path.join(stateDir, "extensions", "missing-entry-pack");
mkdirSafe(globalExt);
writePluginPackageManifest({
packageDir: globalExt,
packageName: "@openclaw/missing-entry-pack",
extensions: ["./missing.ts"],
});
const result = await discoverWithStateDir(stateDir, {});
expect(result.candidates).toHaveLength(0);
expect(result.diagnostics).toEqual([]);
});
it("rejects package extension entries that escape via symlink", async () => {
const stateDir = makeTempDir();
const globalExt = path.join(stateDir, "extensions", "pack");