mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:20:43 +00:00
fix: collapse qmd startup memory log
This commit is contained in:
@@ -61,13 +61,9 @@ describe("startGatewayMemoryBackend", () => {
|
||||
expect(getMemorySearchManagerMock).toHaveBeenCalledTimes(2);
|
||||
expect(getMemorySearchManagerMock).toHaveBeenNthCalledWith(1, { cfg, agentId: "ops" });
|
||||
expect(getMemorySearchManagerMock).toHaveBeenNthCalledWith(2, { cfg, agentId: "main" });
|
||||
expect(log.info).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'qmd memory startup initialization armed for agent "ops"',
|
||||
);
|
||||
expect(log.info).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
'qmd memory startup initialization armed for agent "main"',
|
||||
expect(log.info).toHaveBeenCalledTimes(1);
|
||||
expect(log.info).toHaveBeenCalledWith(
|
||||
'qmd memory startup initialization armed for 2 agents: "ops", "main"',
|
||||
);
|
||||
expect(log.warn).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -85,7 +81,7 @@ describe("startGatewayMemoryBackend", () => {
|
||||
'qmd memory startup initialization failed for agent "main": qmd missing',
|
||||
);
|
||||
expect(log.info).toHaveBeenCalledWith(
|
||||
'qmd memory startup initialization armed for agent "ops"',
|
||||
'qmd memory startup initialization armed for 1 agent: "ops"',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -105,7 +101,7 @@ describe("startGatewayMemoryBackend", () => {
|
||||
expect(getMemorySearchManagerMock).toHaveBeenCalledTimes(1);
|
||||
expect(getMemorySearchManagerMock).toHaveBeenCalledWith({ cfg, agentId: "main" });
|
||||
expect(log.info).toHaveBeenCalledWith(
|
||||
'qmd memory startup initialization armed for agent "main"',
|
||||
'qmd memory startup initialization armed for 1 agent: "main"',
|
||||
);
|
||||
expect(log.warn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ export async function startGatewayMemoryBackend(params: {
|
||||
log: { info?: (msg: string) => void; warn: (msg: string) => void };
|
||||
}): Promise<void> {
|
||||
const agentIds = listAgentIds(params.cfg);
|
||||
const armedAgentIds: string[] = [];
|
||||
for (const agentId of agentIds) {
|
||||
if (!resolveMemorySearchConfig(params.cfg, agentId)) {
|
||||
continue;
|
||||
@@ -30,6 +31,17 @@ export async function startGatewayMemoryBackend(params: {
|
||||
);
|
||||
continue;
|
||||
}
|
||||
params.log.info?.(`qmd memory startup initialization armed for agent "${agentId}"`);
|
||||
armedAgentIds.push(agentId);
|
||||
}
|
||||
if (armedAgentIds.length > 0) {
|
||||
params.log.info?.(
|
||||
`qmd memory startup initialization armed for ${formatAgentCount(armedAgentIds.length)}: ${armedAgentIds
|
||||
.map((agentId) => `"${agentId}"`)
|
||||
.join(", ")}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function formatAgentCount(count: number): string {
|
||||
return count === 1 ? "1 agent" : `${count} agents`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user