mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-06 18:12:13 +00:00
fix(memory): report skipped QMD embedding probe (#93473)
Merged via squash.
Prepared head SHA: eea1ba563b
Co-authored-by: TurboTheTurtle <35905412+TurboTheTurtle@users.noreply.github.com>
Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
Reviewed-by: @vincentkoc
This commit is contained in:
@@ -884,8 +884,14 @@ export async function runMemoryStatus(opts: MemoryCommandOptions) {
|
||||
`${label("Dreaming")} ${info(formatDreamingSummary(cfg))}`,
|
||||
].filter(Boolean) as string[];
|
||||
if (embeddingProbe) {
|
||||
const state = embeddingProbe.ok ? "ready" : "unavailable";
|
||||
const stateColor = embeddingProbe.ok ? theme.success : theme.warn;
|
||||
const state =
|
||||
embeddingProbe.ok && embeddingProbe.checked === false
|
||||
? "skipped"
|
||||
: embeddingProbe.ok
|
||||
? "ready"
|
||||
: "unavailable";
|
||||
const stateColor =
|
||||
state === "skipped" ? theme.muted : embeddingProbe.ok ? theme.success : theme.warn;
|
||||
lines.push(`${label("Embeddings")} ${colorize(rich, stateColor, state)}`);
|
||||
if (embeddingProbe.error) {
|
||||
lines.push(`${label("Embeddings error")} ${warn(embeddingProbe.error)}`);
|
||||
|
||||
@@ -677,6 +677,42 @@ describe("memory cli", () => {
|
||||
expect(close).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not report qmd lexical search mode as embedding unavailable", async () => {
|
||||
const close = vi.fn(async () => {});
|
||||
const probeVectorStoreAvailability = vi.fn(async () => true);
|
||||
const probeVectorAvailability = vi.fn(async () => false);
|
||||
const probeEmbeddingAvailability = vi.fn(async () => ({ ok: true, checked: false }));
|
||||
mockManager({
|
||||
probeVectorStoreAvailability,
|
||||
probeVectorAvailability,
|
||||
probeEmbeddingAvailability,
|
||||
status: () =>
|
||||
makeMemoryStatus({
|
||||
backend: "qmd",
|
||||
provider: "qmd",
|
||||
model: "qmd",
|
||||
requestedProvider: "qmd",
|
||||
vector: {
|
||||
enabled: false,
|
||||
semanticAvailable: false,
|
||||
available: false,
|
||||
},
|
||||
}),
|
||||
close,
|
||||
});
|
||||
|
||||
const log = spyRuntimeLogs(defaultRuntime);
|
||||
await runMemoryCli(["status", "--deep"]);
|
||||
|
||||
expect(probeVectorStoreAvailability).not.toHaveBeenCalled();
|
||||
expect(probeVectorAvailability).toHaveBeenCalled();
|
||||
expect(probeEmbeddingAvailability).toHaveBeenCalled();
|
||||
expectLogged(log, "Vector: disabled");
|
||||
expectLogged(log, "Embeddings: skipped");
|
||||
expectNotLogged(log, "Embeddings error:");
|
||||
expect(close).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("prints recall-store audit details during status", async () => {
|
||||
await withTempWorkspace(async (workspaceDir) => {
|
||||
await recordShortTermRecalls({
|
||||
|
||||
@@ -6062,8 +6062,8 @@ describe("QmdMemoryManager", () => {
|
||||
|
||||
await expect(manager.probeVectorAvailability()).resolves.toBe(false);
|
||||
await expect(manager.probeEmbeddingAvailability()).resolves.toEqual({
|
||||
ok: false,
|
||||
error: "QMD semantic vectors are unavailable",
|
||||
ok: true,
|
||||
checked: false,
|
||||
});
|
||||
expect(spawnMock.mock.calls.length).toBe(baselineCalls);
|
||||
expect(manager.status().vector).toEqual({
|
||||
|
||||
@@ -1566,6 +1566,9 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
}
|
||||
|
||||
async probeEmbeddingAvailability(): Promise<MemoryEmbeddingProbeResult> {
|
||||
if (!qmdUsesVectors(this.qmd.searchMode)) {
|
||||
return { ok: true, checked: false };
|
||||
}
|
||||
const ok = await this.probeVectorAvailability();
|
||||
return {
|
||||
ok,
|
||||
|
||||
Reference in New Issue
Block a user