mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 20:21:23 +00:00
Memory/QMD: harden multi-collection search and embed scheduling
This commit is contained in:
@@ -73,4 +73,28 @@ describe("startGatewayMemoryBackend", () => {
|
||||
'qmd memory startup initialization armed for agent "ops"',
|
||||
);
|
||||
});
|
||||
|
||||
it("skips agents with memory search disabled", async () => {
|
||||
const cfg = {
|
||||
agents: {
|
||||
defaults: { memorySearch: { enabled: true } },
|
||||
list: [
|
||||
{ id: "main", default: true },
|
||||
{ id: "ops", memorySearch: { enabled: false } },
|
||||
],
|
||||
},
|
||||
memory: { backend: "qmd", qmd: {} },
|
||||
} as OpenClawConfig;
|
||||
const log = { info: vi.fn(), warn: vi.fn() };
|
||||
getMemorySearchManagerMock.mockResolvedValue({ manager: { search: vi.fn() } });
|
||||
|
||||
await startGatewayMemoryBackend({ cfg, log });
|
||||
|
||||
expect(getMemorySearchManagerMock).toHaveBeenCalledTimes(1);
|
||||
expect(getMemorySearchManagerMock).toHaveBeenCalledWith({ cfg, agentId: "main" });
|
||||
expect(log.info).toHaveBeenCalledWith(
|
||||
'qmd memory startup initialization armed for agent "main"',
|
||||
);
|
||||
expect(log.warn).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { listAgentIds } from "../agents/agent-scope.js";
|
||||
import { resolveMemorySearchConfig } from "../agents/memory-search.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveMemoryBackendConfig } from "../memory/backend-config.js";
|
||||
import { getMemorySearchManager } from "../memory/index.js";
|
||||
@@ -9,6 +10,9 @@ export async function startGatewayMemoryBackend(params: {
|
||||
}): Promise<void> {
|
||||
const agentIds = listAgentIds(params.cfg);
|
||||
for (const agentId of agentIds) {
|
||||
if (!resolveMemorySearchConfig(params.cfg, agentId)) {
|
||||
continue;
|
||||
}
|
||||
const resolved = resolveMemoryBackendConfig({ cfg: params.cfg, agentId });
|
||||
if (resolved.backend !== "qmd" || !resolved.qmd) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user