mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:20:43 +00:00
fix(cli): ignore stale memory cleanup after package update
This commit is contained in:
@@ -545,6 +545,17 @@ describe("runCli exit behavior", () => {
|
||||
expect(closeActiveMemorySearchManagersMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("does not fail the command when memory cleanup is unavailable", async () => {
|
||||
tryRouteCliMock.mockResolvedValueOnce(true);
|
||||
hasMemoryRuntimeMock.mockImplementationOnce(() => {
|
||||
throw new Error("stale memory-state chunk");
|
||||
});
|
||||
|
||||
await expect(runCli(["node", "openclaw", "status"])).resolves.toBeUndefined();
|
||||
|
||||
expect(closeActiveMemorySearchManagersMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns after a handled container-target invocation", async () => {
|
||||
maybeRunCliInContainerMock.mockReturnValueOnce({ handled: true, exitCode: 0 });
|
||||
|
||||
|
||||
@@ -191,15 +191,16 @@ async function tryRunGatewayRunFastPath(
|
||||
}
|
||||
|
||||
async function closeCliMemoryManagers(): Promise<void> {
|
||||
const { hasMemoryRuntime } = await import("../plugins/memory-state.js");
|
||||
if (!hasMemoryRuntime()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { hasMemoryRuntime } = await import("../plugins/memory-state.js");
|
||||
if (!hasMemoryRuntime()) {
|
||||
return;
|
||||
}
|
||||
const { closeActiveMemorySearchManagers } = await import("../plugins/memory-runtime.js");
|
||||
await closeActiveMemorySearchManagers();
|
||||
} catch {
|
||||
// Best-effort teardown for short-lived CLI processes.
|
||||
// Best-effort teardown for short-lived CLI processes. Package updates can
|
||||
// replace hashed chunks before this finalizer runs.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user