mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:30:43 +00:00
fix(gateway): scope memory runtime plugin loading
This commit is contained in:
@@ -60,6 +60,7 @@ function expectMemoryRuntimeLoaded(rawConfig: unknown, autoEnabledConfig: unknow
|
||||
expect.objectContaining({
|
||||
config: autoEnabledConfig,
|
||||
activationSourceConfig: rawConfig,
|
||||
onlyPluginIds: ["memory-core"],
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -159,6 +160,63 @@ describe("memory runtime auto-enable loading", () => {
|
||||
await expectAutoEnabledMemoryRuntimeCase({ run, expectedResult });
|
||||
});
|
||||
|
||||
it("loads only the configured memory slot plugin", async () => {
|
||||
const rawConfig = {
|
||||
plugins: {
|
||||
slots: {
|
||||
memory: "memory-lancedb",
|
||||
},
|
||||
},
|
||||
};
|
||||
const runtime = createMemoryRuntimeFixture();
|
||||
applyPluginAutoEnableMock.mockReturnValue({
|
||||
config: rawConfig,
|
||||
changes: [],
|
||||
autoEnabledReasons: {},
|
||||
});
|
||||
getMemoryRuntimeMock.mockReturnValueOnce(undefined).mockReturnValue(runtime);
|
||||
|
||||
await getActiveMemorySearchManager({
|
||||
cfg: rawConfig as never,
|
||||
agentId: "main",
|
||||
});
|
||||
|
||||
expect(resolveRuntimePluginRegistryMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
onlyPluginIds: ["memory-lancedb"],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("does not fall back to broad plugin loading when the memory slot is disabled", async () => {
|
||||
const rawConfig = {
|
||||
plugins: {
|
||||
slots: {
|
||||
memory: "none",
|
||||
},
|
||||
},
|
||||
};
|
||||
applyPluginAutoEnableMock.mockReturnValue({
|
||||
config: rawConfig,
|
||||
changes: [],
|
||||
autoEnabledReasons: {},
|
||||
});
|
||||
getMemoryRuntimeMock.mockReturnValue(undefined);
|
||||
|
||||
await expect(
|
||||
getActiveMemorySearchManager({
|
||||
cfg: rawConfig as never,
|
||||
agentId: "main",
|
||||
}),
|
||||
).resolves.toEqual({ manager: null, error: "memory plugin unavailable" });
|
||||
|
||||
expect(applyPluginAutoEnableMock).toHaveBeenCalledWith({
|
||||
config: rawConfig,
|
||||
env: process.env,
|
||||
});
|
||||
expect(resolveRuntimePluginRegistryMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: "does not bootstrap the memory runtime just to close managers",
|
||||
|
||||
Reference in New Issue
Block a user