fix(memory): fall back to keyword search without sqlite#93260
fix(memory): fall back to keyword search without sqlite#93260mushuiyu886 wants to merge 3 commits into
Conversation
|
Thanks for the contribution. ClawSweeper proposes closing this for now: the implementation may be reasonable, but passing review and proof does not establish that OpenClaw should add this product surface. Close: the patch is technically coherent and has useful CLI proof, but it adds new degraded keyword-fallback semantics for the missing-node:sqlite path without maintainer-confirmed product direction. The canonical issue should remain the place for maintainers to choose degraded recall, scan bounds, or remediation-only behavior. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. This is a proposal only until the separate default-off apply policy is enabled and all live maintainer-signal checks pass. A maintainer can sponsor the direction, request a narrower version, or apply Review detailsBest possible solution: Keep the canonical issue open for maintainer product direction; sponsor a new or reopened PR only after maintainers choose degraded fallback semantics and any required scan bounds. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main routes builtin manager construction failure to unavailable metadata, and the PR adds a classifier plus fallback manager for the same missing-node:sqlite error path. The PR body also supplies after-fix CLI output with node:sqlite blocked and markdown search results returned. Is this the best way to solve the issue? No as a maintainer-ready product solution without sponsorship. The implementation targets the right manager-resolution seam, but the best behavior depends on a maintainer choice between degraded recall, explicit scan bounds, or unavailable-remediation only. Security review: Security review cleared: No security or supply-chain concern identified; the diff adds memory-core runtime and test code only and does not change dependencies, workflows, scripts, permissions, lockfiles, or secret handling. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 816038e97a5d. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
From the adjacent #93150 / #69199 triage, the remaining question here looks like a maintainer product decision rather than a concrete contributor-side code defect. The implementation changes the explicit missing- The decision I think maintainers need to make is:
I do not see a separate automated repair to queue from the current ClawSweeper review; it is waiting on that behavior/availability tradeoff. |
Summary
node:sqlitemodule is unavailable,memory_searchpreviously lost the builtin indexed manager even though durable markdown memory files were still readable.node:sqlitefailure seam return a degraded keyword fallback manager overMEMORY.md,memory/*.md, and configured memoryextraPaths.keyword-fallback/node-sqlite-unavailable.node:sqliteget a basic local memory recall path instead of an unavailable manager response for a runtime capability gap outside their control.Real behavior proof
memory_searchreturns degraded markdown keyword results when the current OpenClaw CLI process cannot loadnode:sqlite, instead of returning unavailable manager metadata. This exercises the production CLI path throughnode scripts/run-node.mjs memory ...,loadMemoryCommandConfig,withMemoryManagerForAgent,getMemorySearchManager, and the PR'sKeywordFallbackMemoryManager.96d9ef309aead772a74e68e9aaece8021f94f7e2; git status clean; isolatedOPENCLAW_HOME,OPENCLAW_STATE_DIR,OPENCLAW_CONFIG_PATH, and workspace under/media/vdb/code/ai/aispace/openclaw-pr-93260-evidence; local markdown corpus containingMEMORY.mdandmemory/preferences.md; scoped preload that makesnode:sqliteunavailable only for the memory index storage loader.The verification was recorded with daily-fix against the same head and evidence files:
memory status --agent main --jsonreturned fallback status for the actual CLI manager:[ { "agentId": "main", "status": { "backend": "builtin", "provider": "keyword-fallback", "requestedProvider": "keyword-fallback", "workspaceDir": "/media/vdb/code/ai/aispace/openclaw-pr-93260-evidence/verify-workspace", "sources": ["memory"], "fallback": { "from": "builtin-sqlite", "reason": "SQLite support is unavailable in this Node runtime (missing node:sqlite). No such built-in module: node:sqlite | No such built-in module: node:sqlite | ERR_UNKNOWN_BUILTIN_MODULE" }, "custom": { "fallback": { "mode": "keyword", "reason": "SQLite support is unavailable in this Node runtime (missing node:sqlite). No such built-in module: node:sqlite | No such built-in module: node:sqlite | ERR_UNKNOWN_BUILTIN_MODULE" } } }, "scan": { "sources": [ { "source": "memory", "totalFiles": 2, "issues": [] } ], "totalFiles": 2, "issues": [] } } ]memory search "orbit ramen" --agent main --max-results 1 --jsonreturned a markdown memory result:{ "results": [ { "path": "memory/preferences.md", "startLine": 1, "endLine": 4, "score": 1, "textScore": 1, "snippet": "# Preferences\nFavorite ramen is shoyu.\nThe orbit codename is ORBIT-22.\n", "source": "memory" } ] }A no-match probe stayed empty instead of producing unrelated fallback hits:
{ "results": [] }The daily-fix verification marker binds those files to the current PR head:
{ "head": "96d9ef309aead772a74e68e9aaece8021f94f7e2", "pending_diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "evidence_files": [ "/media/vdb/code/ai/aispace/openclaw-pr-93260-evidence/verify-status.json", "/media/vdb/code/ai/aispace/openclaw-pr-93260-evidence/verify-search.json", "/media/vdb/code/ai/aispace/openclaw-pr-93260-evidence/verify-search-empty.json" ] }node:sqliteload failure asnode-sqlite-unavailable, returned a builtinkeyword-fallbackmanager, scanned the isolated markdown memory corpus, returnedmemory/preferences.mdwith theORBIT-22snippet fororbit ramen, and returned no rows fornotpresent.node:sqlitewere not tested. The proof instead uses a scoped preload to makenode:sqliteunavailable at the memory index loader seam while preserving the rest of OpenClaw state startup, so the real CLI command can exercise this PR's production fallback path.Review findings addressed
node:sqlitepath returns a degraded keyword fallback manager and markdown search results. A fresh ClawSweeper review or maintainer policy decision is still appropriate before merge because the prior bot review did not complete.Regression Test Plan
extensions/memory-core/src/memory/search-manager.test.tsMemoryIndexManager.get()to throw the wrapped missing-node:sqliteerror, then verifiesgetMemorySearchManager()returns a keyword fallback manager, searches a realMEMORY.md/memory/*.mdfixture, emits fallback debug metadata, preserves path/line/snippet metadata, and avoids a directfs.readFilefallback corpus path.96d9ef309aead772a74e68e9aaece8021f94f7e2; CI, CodeQL Critical Quality, Dependency Guard, Real behavior proof, Workflow Sanity, OpenGrep PR Diff, iOS Periphery Dead Code, Labeler, Auto response, and ClawSweeper Dispatch are reported successful in the collected current-head checkout context.node:sqliteCLI proof above was recorded against HEAD96d9ef309aead772a74e68e9aaece8021f94f7e2with clean git status and no pending source diff.Patch quality notes
node:sqlite; other builtin manager setup failures still surface unavailable metadata instead of being hidden.node:sqliteclassifier.readMemoryFile, preserving the existing memory host boundary for workspace paths, configuredextraPaths, regular-file checks, line limits, and character limits.extensions/memory-core/src/memory/search-manager.tsand its focused regression test. It does not alter provider routing, embedding calls, QMD, gateway transport, public tool schemas, public config schema, storage format, migrations, or runtime service APIs.Merge risk
merge-risk: compatibility,merge-risk: availability, and the local memory-file/source boundary.node:sqlitepath: callers now seeprovider: "keyword-fallback"and markdown result rows instead of unavailable-manager metadata. The availability risk is that fallback searches scan configured markdown memory files on each search. The boundary risk is local memory-file access and memory result sourcing.node:sqliteruntime capability gap; runtimes with SQLite keep the existing indexed path. Fallback reads usereadMemoryFile, results are source-scoped to memory files, bounded bymaxResults, snippet-truncated, and marked with fallback debug/status metadata so callers can distinguish degraded keyword results from vector-backed search.Root Cause
node:sqliteruntime capability as a generic terminal setup failure, even though the invariant for durable memory is that readable markdown memory should remain available through the memory host file boundary when the indexed backend is unavailable for a known runtime capability gap.node:sqlitefailure at its source and returns a degraded keyword fallback manager for that runtime capability gap, while leaving unrelated manager setup failures as unavailable errors. The fallback corpus is read through existing memory-file helpers and reports degraded mode in runtime debug/status metadata, so the fix changes the source manager selection behavior rather than masking one downstream call site.node:sqliteCLI proof. The remaining decision is policy acceptance of degraded keyword fallback semantics and its compatibility/availability tradeoff.node:sqliteis available. The fallback is not a new canonical ranking engine; it is a bounded compatibility path for markdown memory recall when the builtin SQLite dependency cannot load.node:sqliteis available keep the existing SQLite/vector search behavior. Only the explicit missing-node:sqlitepath changes response shape from unavailable metadata tokeyword-fallbackstatus and markdown result rows.