mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 18:05:16 +00:00
Summary: - The branch adds a close lifecycle for local memory embedding providers, scoped memory search/index teardown for one agent, Active Memory timeout cleanup, focused tests, and a changelog entry. - Reproducibility: yes. The linked issue gives a concrete OpenClaw 2026.5.18 Telegram Active Memory timeout pa ... current-main source inspection confirms there is no timeout cleanup for that local embedding provider path. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(memory): close local embedding providers on timeout Validation: - ClawSweeper review passed for head8e2e369b5c. - Required merge gates passed before the squash merge. Prepared head SHA:8e2e369b5cReview: https://github.com/openclaw/openclaw/pull/84048#issuecomment-4485705481 Co-authored-by: brokemac79 <martin_cleary@yahoo.co.uk> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: hxy91819 Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import {
|
|
closeActiveMemorySearchManager,
|
|
closeActiveMemorySearchManagers,
|
|
getActiveMemorySearchManager,
|
|
} from "./memory-host-search.js";
|
|
|
|
const {
|
|
closeActiveMemorySearchManagerMock,
|
|
closeActiveMemorySearchManagersMock,
|
|
getActiveMemorySearchManagerMock,
|
|
} = vi.hoisted(() => ({
|
|
closeActiveMemorySearchManagerMock: vi.fn(),
|
|
closeActiveMemorySearchManagersMock: vi.fn(),
|
|
getActiveMemorySearchManagerMock: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("./memory-host-search.runtime.js", () => ({
|
|
closeActiveMemorySearchManager: closeActiveMemorySearchManagerMock,
|
|
closeActiveMemorySearchManagers: closeActiveMemorySearchManagersMock,
|
|
getActiveMemorySearchManager: getActiveMemorySearchManagerMock,
|
|
}));
|
|
|
|
describe("memory-host-search facade", () => {
|
|
beforeEach(() => {
|
|
closeActiveMemorySearchManagerMock.mockReset();
|
|
closeActiveMemorySearchManagersMock.mockReset();
|
|
getActiveMemorySearchManagerMock.mockReset();
|
|
});
|
|
|
|
it("delegates active manager lookup to the lazy runtime module", async () => {
|
|
const cfg = { agents: { list: [{ id: "main", default: true }] } } as OpenClawConfig;
|
|
const expected = { manager: null, error: "unavailable" };
|
|
getActiveMemorySearchManagerMock.mockResolvedValue(expected);
|
|
|
|
await expect(getActiveMemorySearchManager({ cfg, agentId: "main" })).resolves.toEqual(expected);
|
|
expect(getActiveMemorySearchManagerMock).toHaveBeenCalledWith({ cfg, agentId: "main" });
|
|
});
|
|
|
|
it("delegates runtime cleanup to the lazy runtime module", async () => {
|
|
const cfg = { agents: { list: [{ id: "main", default: true }] } } as OpenClawConfig;
|
|
|
|
await closeActiveMemorySearchManagers(cfg);
|
|
|
|
expect(closeActiveMemorySearchManagersMock).toHaveBeenCalledWith(cfg);
|
|
});
|
|
|
|
it("delegates scoped runtime cleanup to the lazy runtime module", async () => {
|
|
const cfg = { agents: { list: [{ id: "main", default: true }] } } as OpenClawConfig;
|
|
|
|
await closeActiveMemorySearchManager({ cfg, agentId: "main" });
|
|
|
|
expect(closeActiveMemorySearchManagerMock).toHaveBeenCalledWith({ cfg, agentId: "main" });
|
|
});
|
|
});
|