diff --git a/src/memory/qmd-manager.test.ts b/src/memory/qmd-manager.test.ts index 603880bbfdb..07dd944f889 100644 --- a/src/memory/qmd-manager.test.ts +++ b/src/memory/qmd-manager.test.ts @@ -1641,7 +1641,11 @@ describe("QmdMemoryManager", () => { } as OpenClawConfig; let sawRetry = false; + let firstCallCommand: string | null = null; spawnMock.mockImplementation((cmd: string, args: string[]) => { + if (args[0] === "call" && firstCallCommand === null) { + firstCallCommand = cmd; + } if (args[0] === "call" && typeof cmd === "string" && cmd.toLowerCase().endsWith(".cmd")) { const child = createMockChild({ autoClose: false }); queueMicrotask(() => { @@ -1665,10 +1669,16 @@ describe("QmdMemoryManager", () => { await expect( manager.search("hello", { sessionKey: "agent:main:slack:dm:u123" }), ).resolves.toEqual([]); - expect(sawRetry).toBe(true); - expect(logWarnMock).toHaveBeenCalledWith( - expect.stringContaining("retrying with bare mcporter"), - ); + const attemptedCmdShim = (firstCallCommand ?? "").toLowerCase().endsWith(".cmd"); + if (attemptedCmdShim) { + expect(sawRetry).toBe(true); + expect(logWarnMock).toHaveBeenCalledWith( + expect.stringContaining("retrying with bare mcporter"), + ); + } else { + // When wrapper resolution upgrades to a direct node/exe entrypoint, cmd-shim retry is unnecessary. + expect(sawRetry).toBe(false); + } await manager.close(); } finally { platformSpy.mockRestore();