From 067f27f6a209344a5c01d0cad8170433fb02af86 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 12 Apr 2026 19:08:44 +0100 Subject: [PATCH] fix: normalize stale qmd binary paths --- src/memory-host-sdk/host/backend-config.test.ts | 14 ++++++++++++++ src/memory-host-sdk/host/backend-config.ts | 10 +++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/memory-host-sdk/host/backend-config.test.ts b/src/memory-host-sdk/host/backend-config.test.ts index 2322671aeeb..3cf22622512 100644 --- a/src/memory-host-sdk/host/backend-config.test.ts +++ b/src/memory-host-sdk/host/backend-config.test.ts @@ -89,6 +89,20 @@ describe("resolveMemoryBackendConfig", () => { expect(resolved.qmd?.command).toBe("/Applications/QMD Tools/qmd"); }); + it("normalizes stale homebrew qmd paths to the portable command", () => { + const cfg = { + agents: { defaults: { workspace: "/tmp/memory-test" } }, + memory: { + backend: "qmd", + qmd: { + command: "/opt/homebrew/bin/qmd", + }, + }, + } as OpenClawConfig; + const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" }); + expect(resolved.qmd?.command).toBe("qmd"); + }); + it("resolves custom paths relative to workspace", () => { const cfg = { agents: { diff --git a/src/memory-host-sdk/host/backend-config.ts b/src/memory-host-sdk/host/backend-config.ts index ae6a2da55d3..1ab57c346a8 100644 --- a/src/memory-host-sdk/host/backend-config.ts +++ b/src/memory-host-sdk/host/backend-config.ts @@ -244,6 +244,14 @@ function resolveSearchTool(raw?: MemoryQmdConfig["searchTool"]): string | undefi return value ? value : undefined; } +function normalizeQmdCommand(command: string): string { + const normalized = path.normalize(command); + if (normalized === "/opt/homebrew/bin/qmd" || normalized === "/usr/local/bin/qmd") { + return "qmd"; + } + return command; +} + function resolveSessionConfig( cfg: MemoryQmdConfig["sessions"], workspaceDir: string, @@ -397,7 +405,7 @@ export function resolveMemoryBackendConfig(params: { const rawCommand = normalizeOptionalString(qmdCfg?.command) || "qmd"; const parsedCommand = splitShellArgs(rawCommand); - const command = parsedCommand?.[0] || rawCommand.split(/\s+/)[0] || "qmd"; + const command = normalizeQmdCommand(parsedCommand?.[0] || rawCommand.split(/\s+/)[0] || "qmd"); const resolved: ResolvedQmdConfig = { command, mcporter: resolveMcporterConfig(qmdCfg?.mcporter),