Skip to content

fix(memory-core): don't run the LLM reranker in vsearch/search modes - #88887

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
potterdigital:fix/qmd-vsearch-disable-rerank
Jun 29, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
potterdigital:fix/qmd-vsearch-disable-rerank

Conversation

@potterdigital

@potterdigital potterdigital commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

What

searchMode: "vsearch" / "search" are documented as vector/lexical-only modes that must not do LLM work — buildV2Searches' own doc comment says they exist "so lexical-only or vector-only modes don't trigger unnecessary LLM/embedding work." But runQmdSearchViaMcporter builds callArgs without rerank, and QMD's unified query tool defaults rerank: true. So every vsearch/search memory search silently runs the LLM reranker anyway. QMD's own tool docs flag it: "rerank … (default: true). Set to false for faster results on CPU-only machines."

Fix

Pass rerank: false for search/vsearch in runQmdSearchViaMcporter (full query mode keeps reranking). The cold/CLI path (buildSearchArgs) is unaffected — it already maps each mode to qmd's dedicated vsearch/search subcommands, which don't rerank.

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: In searchMode: "vsearch"/"search", every memory search silently invoked QMD's LLM reranker. runQmdSearchViaMcporter omitted rerank from the query callArgs and QMD's query tool defaults rerank: true, contradicting those modes' vector/lexical-only contract.
  • Real environment tested: Live OpenClaw gateway (memory-core extension, mcporter warm path) → QMD qmd mcp running on an Intel UHD 630 iGPU (Gen9.5), host Linux 7.0.6-2-pve. Each case below is a fresh qmd mcp process fed exactly the callArgs openclaw builds; host kernel watched via dmesg.
  • Exact steps or command run after this patch: ran a qmd mcp client that calls the query tool with the patched vsearch args {"searches":[{"type":"vec","query":"how do I handle errors gracefully"}],"limit":3,"rerank":false}, and compared it against the unpatched args (no rerank). Command: node demo.mjs false → spawns qmd mcp, sends tools/call query.
  • Evidence after fix (terminal capture / copied live output):
    AFTER this patch — openclaw sends rerank:false:
      → {"searches":[{"type":"vec","query":"how do I handle errors gracefully"}],"limit":3,"rerank":false}
      ← 3650ms  OK — 3 hits          new host-kernel GPU HANGs during this call: 0
    
    BEFORE (current behavior — openclaw omits rerank):
      → {"searches":[{"type":"vec","query":"how do I handle errors gracefully"}],"limit":3}
      Reranking error: [Error: vk::Queue::submit: ErrorDeviceLost]
      ← 12303ms  ERROR: vk::Queue::submit: ErrorDeviceLost   new host-kernel GPU HANGs during this call: 3
    
    host dmesg during the BEFORE call:
      i915 0000:00:02.0: [drm] GPU HANG: ecode 9:1:8ed1fff2, in libuv-worker [275718]
      i915 0000:00:02.0: [drm] Resetting rcs0 for preemption time out
      i915 0000:00:02.0: [drm] libuv-worker[277683] context reset due to GPU hang
    
  • Observed result after fix: vsearch now sends rerank:false, returns 3 hits with zero host-kernel GPU hangs and no reranker invoked; the unpatched path errors with ErrorDeviceLost and produces 3 kernel GPU hangs. In my deployment, warm memory recall went from a CPU-fallback spin to ~126 ms on the GPU.
  • What was not tested: the QMD v1 tool-name fallback path (vector_search/search) on real hardware — only the v2 unified query tool was exercised live (the new unit test covers the v2 mcporter callArgs); and non-iGPU reranker hardware.
  • Proof limitations or environment constraints: the GPU-hang symptom is specific to a constrained iGPU; on capable hardware the same bug manifests as wasted reranker compute rather than a hang. The 3650 ms above is a fresh-process cold model load — warm recall in my deployment is ~126 ms.
  • Before evidence (optional but encouraged): shown inline in the Evidence block above (BEFORE case → ErrorDeviceLost + 3 kernel GPU hangs; dmesg excerpt included).

Tests and validation

  • Added a unit test: vsearch mode sends rerank: false via mcporter (and the existing query-mode test still asserts it does not). pnpm test:extension memory-core passes; type-check (pnpm tsgo:test) clean.
  • The only failing memory-core test, dreaming-phases.test.ts > suppresses cleanup warnings during request-scoped narrative fallback, is already red on clean main (verified by stashing this change) and is unrelated to this PR.

🤖 AI-assisted — implemented with an AI coding agent; the real-behavior proof above is from my own live OpenClaw setup, not AI-generated. Allow edits by maintainers enabled. No CHANGELOG.md change (per CONTRIBUTING).

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 1, 2026
@clawsweeper

clawsweeper Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 9:05 PM ET / 01:05 UTC.

Summary
The PR adds rerank:false to memory-core's QMD mcporter unified query payload for search and vsearch modes, plus a focused regression test for the vsearch call arguments.

PR surface: Source +7, Tests +40. Total +47 across 2 files.

Reproducibility: yes. source-reproducible with high confidence: current main omits rerank:false for search and vsearch unified QMD calls, while upstream QMD defaults rerank to true. The contributor also supplied before/after terminal proof from a live OpenClaw/QMD mcporter setup.

Review metrics: 1 noteworthy metric.

  • QMD MCP query argument: 1 optional argument added for 2 search modes. The fix depends on QMD's unified query-tool argument contract for both lexical-only and vector-only mcporter searches.

Stored data model
Persistent data-model change detected: serialized state: extensions/memory-core/src/memory/qmd-manager.test.ts, vector/embedding metadata: extensions/memory-core/src/memory/qmd-manager.test.ts, vector/embedding metadata: extensions/memory-core/src/memory/qmd-manager.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Required broad CI was still in progress on the latest head at review time, so merge should wait for the normal required checks to finish.

Maintainer options:

  1. Decide the mitigation before merge
    Land this narrow runtime/test fix, or an equivalent maintainer-owned patch, so QMD mcporter search and vsearch preserve their lexical/vector-only contract while full query mode keeps reranking behavior.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No repair lane is needed; the branch already contains the focused runtime and test fix, with only maintainer review and merge gating remaining.

Security
Cleared: The diff only changes QMD call arguments and a focused unit test; it adds no dependency, script, credential, permission, workflow, or supply-chain surface.

Review details

Best possible solution:

Land this narrow runtime/test fix, or an equivalent maintainer-owned patch, so QMD mcporter search and vsearch preserve their lexical/vector-only contract while full query mode keeps reranking behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible with high confidence: current main omits rerank:false for search and vsearch unified QMD calls, while upstream QMD defaults rerank to true. The contributor also supplied before/after terminal proof from a live OpenClaw/QMD mcporter setup.

Is this the best way to solve the issue?

Yes. Setting rerank:false at the unified mcporter call site for search and vsearch is the narrowest maintainable fix; direct CLI modes already use dedicated commands and full query mode keeps its existing rerank controls.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 081f8fd1fa68.

Label changes

Label justifications:

  • P2: This fixes a real optional memory-core QMD mcporter behavior bug with limited blast radius and no broad core or security impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes before/after copied terminal output from a live OpenClaw/QMD mcporter setup showing patched rerank:false calls returning hits while the unpatched call invoked reranking and failed on the reported iGPU system.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes before/after copied terminal output from a live OpenClaw/QMD mcporter setup showing patched rerank:false calls returning hits while the unpatched call invoked reranking and failed on the reported iGPU system.
Evidence reviewed

PR surface:

Source +7, Tests +40. Total +47 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 0 +7
Tests 1 40 0 +40
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 47 0 +47

What I checked:

Likely related people:

  • armanddp: Authored the merged QMD 1.1+ mcporter compatibility PR that added the unified query tool path and search-mode-aware buildV2Searches behavior involved here. (role: introduced affected behavior; confidence: high; commits: b888741462c8; files: extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/memory/qmd-manager.test.ts)
  • vincentkoc: Merged the QMD 1.1+ compatibility PR and authored adjacent QMD mcporter search-tool override work in the same manager/test surface. (role: recent adjacent contributor and merger; confidence: high; commits: b888741462c8, da35718cb2bf; files: extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/memory/qmd-manager.test.ts)
  • osolmaz: Authored the QMD query rerank toggle that sits directly next to this PR's search/vsearch mcporter behavior. (role: adjacent recent contributor; confidence: high; commits: 0dbf17471b41, b7a5bcba7886; files: extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/memory/qmd-manager.test.ts, src/config/types.memory.ts)
  • bek91: Recently changed QMD search diagnostics and runtime cache paths in the same memory-core manager surface, making them a useful routing candidate for current QMD search behavior. (role: recent area contributor; confidence: medium; commits: 9636bea901d0; files: extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/memory/qmd-manager.test.ts, extensions/memory-core/src/memory/qmd-runtime-cache.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jun 1, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label Jun 1, 2026
@potterdigital
potterdigital force-pushed the fix/qmd-vsearch-disable-rerank branch from 43191f6 to 05d3ac2 Compare June 1, 2026 03:31
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 1, 2026
@potterdigital

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 1, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 15, 2026
@clawsweeper clawsweeper Bot mentioned this pull request Jun 16, 2026
vsearch/search are documented as vector/lexical-only modes, but
runQmdSearchViaMcporter omitted `rerank` from the query tool callArgs,
so QMD's query tool (which defaults rerank:true) ran the LLM reranker
anyway. Pass rerank:false for those modes; full "query" mode keeps it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@vincentkoc
vincentkoc force-pushed the fix/qmd-vsearch-disable-rerank branch from 05d3ac2 to a1b31ef Compare June 29, 2026 01:01
@vincentkoc
vincentkoc merged commit cd31cbc into openclaw:main Jun 29, 2026
86 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 29, 2026
…penclaw#88887)

vsearch/search are documented as vector/lexical-only modes, but
runQmdSearchViaMcporter omitted `rerank` from the query tool callArgs,
so QMD's query tool (which defaults rerank:true) ran the LLM reranker
anyway. Pass rerank:false for those modes; full "query" mode keeps it.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
…penclaw#88887)

vsearch/search are documented as vector/lexical-only modes, but
runQmdSearchViaMcporter omitted `rerank` from the query tool callArgs,
so QMD's query tool (which defaults rerank:true) ran the LLM reranker
anyway. Pass rerank:false for those modes; full "query" mode keeps it.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants