Skip to content

Commit 1fc4276

Browse files
committed
fix(memory): suggest reindex, not --fix, for a missing qmd index
`memory status` always appended "Fix: openclaw memory status --fix" when any audit issue was present, even when none of the issues were actually repaired by --fix. A missing qmd index file (qmd-index-missing) is marked fixable: false, so running the suggested --fix left the issue unresolved. Gate the --fix hint on at least one fixable issue, and suggest `openclaw memory index --agent <id>` (which builds a fresh index) when the qmd index file is missing.
1 parent 4a8ce9c commit 1fc4276

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

‎extensions/memory-core/src/cli-status.runtime.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,15 @@ export async function runMemoryStatus(
552552
lines.push(` ${issue.severity === "error" ? warn(issue.message) : muted(issue.message)}`);
553553
}
554554
if (!opts.fix) {
555-
lines.push(` ${muted(`Fix: openclaw memory status --fix --agent ${agentId}`)}`);
555+
// Only a subset of audit issues are repaired by `--fix`; a missing qmd
556+
// index needs a reindex instead, so each hint is gated on the matching
557+
// issue actually being present.
558+
if (audit.issues.some((issue) => issue.fixable)) {
559+
lines.push(` ${muted(`Fix: openclaw memory status --fix --agent ${agentId}`)}`);
560+
}
561+
if (audit.issues.some((issue) => issue.code === "qmd-index-missing")) {
562+
lines.push(` ${muted(`Fix: openclaw memory index --agent ${agentId}`)}`);
563+
}
556564
}
557565
}
558566
if (dreamingAudit?.issues.length) {
@@ -562,7 +570,7 @@ export async function runMemoryStatus(
562570
for (const issue of dreamingAudit.issues) {
563571
lines.push(` ${issue.severity === "error" ? warn(issue.message) : muted(issue.message)}`);
564572
}
565-
if (!opts.fix) {
573+
if (!opts.fix && dreamingAudit.issues.some((issue) => issue.fixable)) {
566574
lines.push(` ${muted(`Fix: openclaw memory status --fix --agent ${agentId}`)}`);
567575
}
568576
}

‎extensions/memory-core/src/cli.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,34 @@ describe("memory cli", () => {
14501450
});
14511451
});
14521452

1453+
it("suggests reindexing instead of --fix when the qmd index is missing", async () => {
1454+
await withTempWorkspace(async (workspaceDir) => {
1455+
const close = vi.fn(async () => {});
1456+
const missingDbPath = path.join(qmdFixtureRoot, `missing-${qmdCaseId++}.sqlite`);
1457+
mockManager({
1458+
probeVectorAvailability: vi.fn(async () => true),
1459+
status: () =>
1460+
makeMemoryStatus({
1461+
backend: "qmd",
1462+
provider: "qmd",
1463+
model: "qmd",
1464+
requestedProvider: "qmd",
1465+
workspaceDir,
1466+
dbPath: missingDbPath,
1467+
}),
1468+
close,
1469+
});
1470+
1471+
const log = spyRuntimeLogs(defaultRuntime);
1472+
await runMemoryCli(["status"]);
1473+
1474+
expectLogged(log, "QMD index file is missing.");
1475+
expectLogged(log, "Fix: openclaw memory index --agent main");
1476+
expectNotLogged(log, "Fix: openclaw memory status --fix --agent main");
1477+
expect(close).toHaveBeenCalled();
1478+
});
1479+
});
1480+
14531481
it("fails index when qmd db file is empty", async () => {
14541482
const close = vi.fn(async () => {});
14551483
const sync = vi.fn(async () => {});

0 commit comments

Comments
 (0)