fix(doctor): skip embedding provider check when QMD backend is active#17295
Conversation
|
|
||
| // QMD backend handles embeddings internally (e.g. embeddinggemma) — no | ||
| // separate embedding provider is needed. Skip the provider check entirely. | ||
| const backendConfig = resolveMemoryBackendConfig({ cfg, agentId }); |
There was a problem hiding this comment.
add a mock for resolveMemoryBackendConfig in the test file to avoid calling the real implementation during tests
the test file (src/commands/doctor-memory-search.test.ts) doesn't mock this new import, which means tests will call the real function - this works for now but is fragile and slower than using a mock
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/doctor-memory-search.ts
Line: 28:28
Comment:
add a mock for `resolveMemoryBackendConfig` in the test file to avoid calling the real implementation during tests
the test file (`src/commands/doctor-memory-search.test.ts`) doesn't mock this new import, which means tests will call the real function - this works for now but is fragile and slower than using a mock
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| // QMD backend handles embeddings internally (e.g. embeddinggemma) — no | ||
| // separate embedding provider is needed. Skip the provider check entirely. | ||
| const backendConfig = resolveMemoryBackendConfig({ cfg, agentId }); | ||
| if (backendConfig.backend === "qmd") { | ||
| return; |
There was a problem hiding this comment.
add a test case for QMD backend to verify this early return works correctly
the test file has no coverage for the new QMD backend path - consider adding a test like:
it("does not warn when QMD backend is active", async () => {
const cfgWithQmd = { memory: { backend: "qmd" } } as OpenClawConfig;
resolveMemorySearchConfig.mockReturnValue({
provider: "auto",
local: {},
remote: {},
});
await noteMemorySearchHealth(cfgWithQmd);
expect(note).not.toHaveBeenCalled();
});Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/doctor-memory-search.ts
Line: 26:30
Comment:
add a test case for QMD backend to verify this early return works correctly
the test file has no coverage for the new QMD backend path - consider adding a test like:
```javascript
it("does not warn when QMD backend is active", async () => {
const cfgWithQmd = { memory: { backend: "qmd" } } as OpenClawConfig;
resolveMemorySearchConfig.mockReturnValue({
provider: "auto",
local: {},
remote: {},
});
await noteMemorySearchHealth(cfgWithQmd);
expect(note).not.toHaveBeenCalled();
});
```
How can I resolve this? If you propose a fix, please make it concise.- Add anthropic-beta structured-outputs-2025-11-13 header - Handle 403 rate limits with x-ratelimit-remaining detection - Reduce concurrency to 5 to avoid rate limit exhaustion - Clean up response parsing to handle text/json/thinking blocks - Fix sparse-checkout in workflow to match actual files - Verified against real PRs openclaw#17296 and openclaw#17295 with Opus 4.6 Co-Authored-By: Claude Opus 4.6 <[email protected]>
bfc1ccb to
f92900f
Compare
…ted beta header - Add cache_control with 1h TTL to both system blocks (dynamic context was entirely uncached) - Verified: 91% cost reduction on cached calls ($0.07 → $0.007 with Haiku) - Remove deprecated structured-outputs beta header (GA since late 2025) - Update PRICING table to reflect 1h cache write costs (2x base input) - Fix effort parameter to Opus-only (Sonnet/Haiku reject it) - Fix oxlint curly brace warning in jaccardSets - Update PR-TRIAGE.md with verified cost data and 1h TTL documentation Tested against real openclaw PRs: Call 1 (Haiku, openclaw#17320): 34,649 cache-write, $0.0728 Call 2 (Haiku, openclaw#17295): 34,649 cache-read, $0.0065 (91% savings) Call 3 (Sonnet, openclaw#17320): structured output works without beta header Co-Authored-By: Claude Opus 4.6 <[email protected]>
When memory.backend is set to "qmd", QMD handles embeddings internally (e.g. via embeddinggemma) and does not require a separate embedding provider configured through OpenClaw's memorySearch settings. The doctor check now calls resolveMemoryBackendConfig() and returns early when the backend is "qmd", preventing the false positive warning "no embedding provider is configured". Fixes openclaw#17263 Co-Authored-By: Miloud Belarebia <[email protected]>
Address Greptile review comments: mock resolveMemoryBackendConfig to isolate unit tests and add dedicated test verifying QMD backend skips embedding provider checks. Co-Authored-By: Claude Opus 4.6 <[email protected]>
d970271 to
4dfb2b1
Compare
|
PR #17295 - fix(doctor): skip embedding provider check when QMD backend is active (#17295) Merged via squash.
Thanks @miloudbelarebia! |
|
Thanks @Takhoffman for the review and merge! Happy to see this landed. Looking forward to contributing more to OpenClaw. |
…#17295) thanks @miloudbelarebia Verified: - pnpm build - pnpm check (fails on baseline formatting drift in files identical to origin/main) - pnpm test:macmini Co-authored-by: miloudbelarebia <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…openclaw#17295) thanks @miloudbelarebia Verified: - pnpm build - pnpm check (fails on baseline formatting drift in files identical to origin/main) - pnpm test:macmini Co-authored-by: miloudbelarebia <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…openclaw#17295) thanks @miloudbelarebia Verified: - pnpm build - pnpm check (fails on baseline formatting drift in files identical to origin/main) - pnpm test:macmini Co-authored-by: miloudbelarebia <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…openclaw#17295) thanks @miloudbelarebia Verified: - pnpm build - pnpm check (fails on baseline formatting drift in files identical to origin/main) - pnpm test:macmini Co-authored-by: miloudbelarebia <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…openclaw#17295) thanks @miloudbelarebia Verified: - pnpm build - pnpm check (fails on baseline formatting drift in files identical to origin/main) - pnpm test:macmini Co-authored-by: miloudbelarebia <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
Summary
openclaw doctorwhen using QMD memory backend with local embeddings (e.g.embeddinggemma)noteMemorySearchHealth()whenmemory.backend === "qmd"Fixes #17263
Problem
When QMD is configured as the memory backend, it handles embeddings internally — no separate embedding provider needs to be configured in OpenClaw's
memorySearchsettings. However,openclaw doctordoesn't know this and falsely warns:Root cause
noteMemorySearchHealth()checkshasLocalEmbeddings(resolved.local)which looks forlocal.modelPath. QMD doesn't use this field — it bundles its own embedding model. The function then checks for remote API keys (OpenAI/Gemini/Voyage) and finds none, triggering the false positive.Fix
Call
resolveMemoryBackendConfig()at the top of the check. Ifbackend === "qmd", return early — QMD handles its own embeddings, so no warning is needed.1 file changed:
src/commands/doctor-memory-search.tsTest plan
openclaw doctor— verify no false warning about missing embedding providerLocal Validation
pnpm check(tsgo): ✅ passespnpm test: ✅ passes (existing doctor tests still green)oxfmt --checkScope
Single-file fix:
src/commands/doctor-memory-search.ts— adds early return when QMD backend is detected.AI Assistance
AI-assisted (Claude Code) for codebase exploration and root cause analysis. The diagnostic (QMD bundles its own embeddings, so the provider check is unnecessary) and the fix approach are my own work.
Testing level: Fully tested — confirmed
pnpm checkandpnpm testpass locally.Author
Miloud Belarebia — @miloudbelarebia
Greptile Summary
Fixes a false positive warning in
openclaw doctorwhen using the QMD memory backend. QMD bundles its own embedding model (e.g.embeddinggemma), so the existing embedding provider check innoteMemorySearchHealth()incorrectly flagged a missing provider. The fix adds an early return whenresolveMemoryBackendConfig()reportsbackend === "qmd", skipping the irrelevant provider check entirely.resolveMemoryBackendConfigcall innoteMemorySearchHealth()with early return for QMD backend{ backend: "builtin" }mock inbeforeEachConfidence Score: 5/5
MemoryBackendis a union of"builtin" | "qmd", and QMD handles its own embeddings as confirmed by thebackend-config.tssource and usage in other callers likesearch-manager.ts. The test file properly mocks the new dependency and adds a specific test case. No regressions to existing tests since the default mock returns{ backend: "builtin" }. No security concerns.Last reviewed commit: d970271