From 34d62b065067d3b8bb23d8b5d062eca890c4f9fb Mon Sep 17 00:00:00 2001 From: HCL Date: Thu, 30 Apr 2026 07:07:01 +0800 Subject: [PATCH] fix(doctor): propagate gateway skipped-probe flag through adapter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clawsweeper P1: probeGatewayMemoryStatus always returned checked: true on successful RPC, silently discarding payload.embedding.checked === false from the SKIPPED_MEMORY_EMBEDDING_PROBE gateway response. The renderer guard in noteMemorySearchHealth (added in prior commit) never saw checked: false in real execution — only on timeout paths. Fix: propagate checked flag from payload.embedding.checked so a skipped gateway probe surfaces as checked: false to the renderer, allowing the key-optional provider guard to suppress the false-positive warning. Add adapter-level regression test that verifies the skipped payload shape from doctor.memory.status reaches GatewayMemoryProbe as checked: false. --- src/commands/doctor-gateway-health.test.ts | 19 +++++++++++++++++++ src/commands/doctor-gateway-health.ts | 8 +++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/commands/doctor-gateway-health.test.ts b/src/commands/doctor-gateway-health.test.ts index 3a84d6170eb..4cd21a5dd94 100644 --- a/src/commands/doctor-gateway-health.test.ts +++ b/src/commands/doctor-gateway-health.test.ts @@ -96,6 +96,25 @@ describe("probeGatewayMemoryStatus", () => { }); }); + it("propagates checked: false when gateway skipped the embedding probe", async () => { + // Gateway returns checked: false when called with probe: false and no cached + // availability data (SKIPPED_MEMORY_EMBEDDING_PROBE shape). + callGateway.mockResolvedValue({ + embedding: { + ok: false, + checked: false, + error: + "memory embedding readiness not checked; run `openclaw memory status --deep` to probe", + }, + }); + + await expect(probeGatewayMemoryStatus({ cfg })).resolves.toEqual({ + checked: false, + ready: false, + error: expect.stringContaining("not checked"), + }); + }); + it("keeps gateway request timeouts as explicit failures", async () => { callGateway.mockRejectedValue(new Error("gateway request timeout for doctor.memory.status")); diff --git a/src/commands/doctor-gateway-health.ts b/src/commands/doctor-gateway-health.ts index 12469d383c2..86a78131978 100644 --- a/src/commands/doctor-gateway-health.ts +++ b/src/commands/doctor-gateway-health.ts @@ -86,8 +86,14 @@ export async function probeGatewayMemoryStatus(params: { timeoutMs, config: params.cfg, }); + // Propagate the gateway's checked flag. When the gateway skips the embedding + // probe (probe: false path), it returns checked: false to signal that no + // readiness determination was made. Mapping that to checked: true here would + // cause the renderer to treat a skipped probe as a checked-but-not-ready + // failure and emit a false-positive warning for key-optional providers. + const gatewayChecked = payload.embedding.checked !== false; return { - checked: true, + checked: gatewayChecked, ready: payload.embedding.ok, error: payload.embedding.error, };