fix(doctor): suppress false-positive embedding warning when probe skipped

When `openclaw doctor` runs without --deep, the gateway probe is skipped
and returns { checked: false, ready: false } (SKIPPED_MEMORY_EMBEDDING_PROBE).
Key-optional providers (ollama, lmstudio, local) were incorrectly shown
"could not confirm embeddings are ready" in this case, misleading users
into thinking their fully-functional embedding setup had an issue.

Guard the key-optional provider path: if probe.checked is false (probe
was skipped, not run), return early without warning. A skipped probe
carries no readiness signal — it is not a failure.

- Adds two focused regression tests for ollama and lmstudio with
  skipped probe (checked: false) → expect note() not called
- Updates the prior test that expected a warning on checked:false
  to reflect the corrected behaviour

Fixes #74608
This commit is contained in:
HCL
2026-04-30 06:52:08 +08:00
committed by Peter Steinberger
parent d7396d4ffa
commit 45082aaed3
2 changed files with 27 additions and 5 deletions

View File

@@ -459,7 +459,11 @@ describe("noteMemorySearchHealth", () => {
expect(message).toContain("embeddings are not ready");
});
it("warns when lmstudio gateway probe is unavailable", async () => {
it("does not warn when key-optional provider (lmstudio) probe was skipped (checked: false)", async () => {
// When `openclaw doctor` runs without --deep, the probe is skipped and returns
// { checked: false, ready: false }. This must NOT produce a false-positive warning —
// it means readiness was never checked, not that embeddings are unavailable.
// Regression test for: https://github.com/openclaw/openclaw/issues/74608
resolveMemorySearchConfig.mockReturnValue({
provider: "lmstudio",
local: {},
@@ -470,10 +474,22 @@ describe("noteMemorySearchHealth", () => {
gatewayMemoryProbe: { checked: false, ready: false },
});
const message = String(note.mock.calls[0]?.[0] ?? "");
expect(message).toContain('provider "lmstudio" is configured');
expect(message).toContain("could not confirm embeddings are ready");
expect(message).toContain("openclaw memory status --deep");
expect(note).not.toHaveBeenCalled();
});
it("does not warn when key-optional provider (ollama) probe was skipped (checked: false)", async () => {
// Same guard for ollama — the most commonly reported false-positive case.
resolveMemorySearchConfig.mockReturnValue({
provider: "ollama",
local: {},
remote: {},
});
await noteMemorySearchHealth(cfg, {
gatewayMemoryProbe: { checked: false, ready: false },
});
expect(note).not.toHaveBeenCalled();
});
it("notes when gateway probe reports embeddings ready and CLI API key is missing", async () => {

View File

@@ -410,6 +410,12 @@ export async function noteMemorySearchHealth(
if (opts?.gatewayMemoryProbe?.checked && opts.gatewayMemoryProbe.ready) {
return;
}
// When the probe was skipped (checked: false), we have no embedding status
// information — do not warn. A skipped probe means the user ran `openclaw doctor`
// without --deep; it does not mean embeddings are unavailable.
if (opts?.gatewayMemoryProbe && !opts.gatewayMemoryProbe.checked) {
return;
}
const gatewayProbeWarning = buildGatewayProbeWarning(opts?.gatewayMemoryProbe);
note(
[