Skip to content

fix(memory-core): skip qmd zero-hit search sync#90030

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
sahibzada-allahyar:tui-90023-qmd-zero-hit
Jul 1, 2026
Merged

fix(memory-core): skip qmd zero-hit search sync#90030
vincentkoc merged 1 commit into
openclaw:mainfrom
sahibzada-allahyar:tui-90023-qmd-zero-hit

Conversation

@sahibzada-allahyar

@sahibzada-allahyar sahibzada-allahyar commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #90023.

Long-lived QMD-backed memory_search calls can turn a normal zero-hit result into synchronous index maintenance by awaiting manager.sync({ reason: "search", force: true }). QMD maps that call to update/embed work, which can stall an interactive turn for tens of seconds.

Why This Change Was Made

The generic zero-hit repair remains useful for builtin/fallback managers, but QMD already owns its search and update lifecycle. The repair is therefore backend- and lifecycle-specific:

  • long-lived QMD managers return the zero-hit result without forcing synchronous update work;
  • one-shot CLI QMD managers keep the bootstrap sync/retry because they do not have a background lifecycle;
  • non-QMD managers keep the existing sync/retry behavior.

This is narrower than removing zero-hit repair for every backend and does not add configuration or timeout policy.

User Impact

Interactive QMD memory misses return without entering QMD update/embed maintenance. Existing builtin/fallback freshness repair and one-shot CLI bootstrap behavior remain unchanged.

Evidence

  • Canonical issue QMD memory_search zero-hit queries trigger synchronous force sync and stall interactive turns #90023 includes repeated live QMD reports showing 69-75 second zero-hit stalls and sub-second results after bypassing the synchronous QMD update path.
  • node scripts/run-vitest.mjs extensions/memory-core/src/tools.test.ts - 22 passed
  • Blacksmith Testbox tbx_01kweq20wqs24wspdyf03kg2zh - corepack pnpm check:changed passed
  • Fresh autoreview on the final local diff - no accepted/actionable findings
  • git diff --check origin/main...HEAD - clean

Focused coverage proves:

  • long-lived QMD zero-hit search performs one search and zero forced syncs while preserving runtime debug;
  • one-shot QMD zero-hit search still syncs and retries;
  • non-QMD zero-hit search still syncs and retries.

Hosted CI is required on the pushed exact head before merge.

@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 3, 2026
@clawsweeper

clawsweeper Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 21, 2026, 2:22 PM ET / 18:22 UTC.

Summary
The PR changes memory_search so QMD zero-hit results skip the generic forced sync retry path while non-QMD backends keep that retry behavior, and it adds a regression test for the QMD guard.

PR surface: Source +4, Tests +23. Total +27 across 2 files.

Reproducibility: yes. source-reproducible: current main and v2026.6.9 still await a forced sync after zero memory_search results, and QMD sync awaits update maintenance. I did not run a live large-corpus QMD timing repro in this read-only pass, but the linked issue and PR body include live QMD behavior evidence.

Review metrics: 1 noteworthy metric.

  • QMD zero-hit fallback: 1 backend-specific retry condition changed. QMD no longer uses the generic forced sync/retry after empty results, so maintainers should review the freshness tradeoff before merge.

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

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #90023
Summary: This PR is a candidate fix for the canonical QMD zero-hit forced-sync stall issue; overlapping open PRs exist, but none is a merged or clearly safer replacement for closing this branch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

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

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

Rank-up moves:

  • Refresh the dirty branch against current main.
  • Have maintainers choose between the QMD-only skip and a bounded/background refresh variant.

Risk before merge

  • [P1] The PR is currently dirty/unmergeable on GitHub and needs a refresh before merge.
  • [P2] Skipping QMD zero-hit forced sync changes fallback behavior for stale QMD indexes: users can now receive prompt empty results instead of immediate search-time freshness repair.
  • [P1] Several open sibling PRs overlap this memory_search path, but none is a merged or clearly safer canonical replacement for this branch; maintainers need to choose the landing shape.

Maintainer options:

  1. Refresh and review the QMD guard
    Resolve the dirty branch while preserving the QMD-only skip, then have maintainers explicitly accept the latency-versus-freshness behavior.
  2. Accept prompt empty QMD results
    Maintainers can intentionally accept that QMD zero-hit searches return empty results instead of forcing immediate search-time freshness repair.
  3. Replace with nonblocking refresh
    If immediate QMD freshness repair must remain, replace the skip with a bounded, async, or debounced refresh outside the interactive tool wait.

Next step before merge

  • [P2] The remaining action is maintainer review of the dirty branch, overlapping implementation PRs, and QMD freshness policy rather than an automated replacement fix.

Security
Cleared: No concrete security or supply-chain concern found; the diff is limited to memory-core runtime branching and a colocated regression test.

Review details

Best possible solution:

Land one refreshed canonical memory-core fix that keeps QMD update work out of the interactive zero-hit memory_search deadline while preserving non-QMD retry behavior or replacing QMD repair with bounded/background refresh if immediate freshness must stay.

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

Yes, source-reproducible: current main and v2026.6.9 still await a forced sync after zero memory_search results, and QMD sync awaits update maintenance. I did not run a live large-corpus QMD timing repro in this read-only pass, but the linked issue and PR body include live QMD behavior evidence.

Is this the best way to solve the issue?

Yes as a narrow mitigation, pending maintainer acceptance of the QMD freshness tradeoff. A bounded or background QMD refresh is the safer alternative if maintainers want to preserve immediate repair without blocking the interactive tool path.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR targets a focused memory-core availability bug with a linked source-repro issue and limited blast radius.
  • merge-risk: 🚨 compatibility: Skipping QMD's zero-hit forced sync changes fallback behavior for users whose QMD index is stale during search.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix QMD CLI and MCP live output from isolated state showing zero-hit results returning through the QMD backend without the forced update path.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix QMD CLI and MCP live output from isolated state showing zero-hit results returning through the QMD backend without the forced update path.
Evidence reviewed

PR surface:

Source +4, Tests +23. Total +27 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 23 0 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 28 1 +27

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs extensions/memory-core/src/tools.test.ts.
  • [P1] node scripts/run-vitest.mjs extensions/memory-core/src/tools.citations.test.ts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • TurboTheTurtle: Recent merged work kept memory_search in transient QMD mode and touched both the tool and QMD manager surfaces adjacent to this behavior. (role: recent memory_search and QMD lifecycle contributor; confidence: high; commits: ddacb7ba39d4, 6aff1e8f9ea4; files: extensions/memory-core/src/tools.ts, extensions/memory-core/src/memory/qmd-manager.ts)
  • dreamhunter2333: Authored the recent memory_search AbortSignal/deadline work around the same interactive timeout wrapper that this stall path runs under. (role: recent memory_search timeout contributor; confidence: medium; commits: 8d72cb9401e5; files: extensions/memory-core/src/tools.ts, extensions/memory-core/src/tools.test.ts, packages/memory-host-sdk/src/host/types.ts)
  • osolmaz: Recent work changed memory index identity, paused-index retry behavior, and QMD rerank/search configuration near zero-hit and stale-index behavior. (role: adjacent memory index and QMD config contributor; confidence: medium; commits: a4b4fed41287, 0dbf17471b41; files: extensions/memory-core/src/tools.ts, extensions/memory-core/src/memory/qmd-manager.ts, packages/memory-host-sdk/src/host/backend-config.ts)
  • steipete: Recent commits touched QMD search process timeouts, QMD numeric config, and memory recall stall handling near this failure mode. (role: recent memory-core hardening and SDK boundary contributor; confidence: medium; commits: 1ac037d94894, c36ba9ea7a2d, 9e2bd8b2f7eb; files: extensions/memory-core/src/tools.ts, extensions/memory-core/src/memory/qmd-manager.ts, packages/memory-host-sdk/src/host/backend-config.ts)
  • vincentkoc: Recent QMD watcher/probe work and review history are adjacent to QMD readiness, status, and search behavior touched by this PR. (role: recent QMD area contributor; confidence: medium; commits: dbcae5b78d9f, 6aff1e8f9ea4; files: extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/tools.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 the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label Jun 3, 2026
@sahibzada-allahyar

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 4, 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 rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 4, 2026
@sahibzada-allahyar

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@sahibzada-allahyar

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@sahibzada-allahyar

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 4, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 4, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Land-ready at 5b3b116e4944e908de406eb522fe92c2237f1ed5.

  • Fix is limited to long-lived QMD zero-hit searches; one-shot CLI bootstrap retry and non-QMD retry behavior remain intact.
  • Focused proof: node scripts/run-vitest.mjs extensions/memory-core/src/tools.test.ts (22 passed).
  • Exact-head changed gate: Blacksmith Testbox tbx_01kwen8xbmyvahz8tj3zdc2bte passed check:changed.
  • Fresh autoreview completed with no accepted/actionable findings after the lifecycle and type-narrowing fixes.
  • Hosted CI run 28512792755 is green. Its initial tooling shard was killed by SIGKILL after the preceding suites passed; rerun job 84520045826 passed unchanged.

This is the canonical fix for #90023. PRs #90117 and #98572 are broader/weaker duplicates and can close after merge.

@vincentkoc
vincentkoc force-pushed the tui-90023-qmd-zero-hit branch from 6bc28ac to 4ea0549 Compare July 1, 2026 11:46
@vincentkoc
vincentkoc merged commit 90e31be into openclaw:main Jul 1, 2026
87 checks passed
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

QMD memory_search zero-hit queries trigger synchronous force sync and stall interactive turns

2 participants