fix(openclaw-plugin): thread recall rerank into search; mark keywordSearch no-op#5368
Open
Bartok9 wants to merge 1 commit into
Open
fix(openclaw-plugin): thread recall rerank into search; mark keywordSearch no-op#5368Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
…earch no-op Closes mem0ai#5351 Problem: The @mem0/openclaw-mem0 plugin documents skills.recall.rerank and skills.recall.keywordSearch (defaulted true) but neither was ever threaded into a search call. Users enabling rerank got only the plugin's local rankMemories()/budgetMemories() ordering, never Mem0 Platform Advanced Retrieval reranking. The keys were inert. Root cause: recall.ts and index.ts buildSearchOptions built searchOpts with only user_id/top_k/threshold/source (comment: 'v3.0.0 reranking removed'). PlatformProvider.search never forwarded rerank to the SDK, even though mem0-ts SearchMemoryOptions still supports rerank and camelToSnakeKeys forwards it to POST /v3/memories/search/. Fix: - rerank: thread recallConfig.rerank through recall.ts searchOpts and index.ts buildSearchOptions; forward it in PlatformProvider.search and providerToBackend.search. Platform-only by design; OSSProvider.search picks fields explicitly and safely ignores it (the OSS SDK has no reranker). Both the auto-recall path and the memory_search tool path (which uses buildSearchOptions) now honour the key. - keywordSearch: Mem0 v3 removed keyword search from the search API, so there is nothing to thread. Marked @deprecated no-op in types.ts, with matching schema + README descriptions so users aren't misled. Tests: 2 new providers.test.ts cases assert rerank is forwarded only when truthy and omitted otherwise. Author: Bartok9 <danielrpike9@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@mem0/openclaw-mem0documentedskills.recall.rerankandskills.recall.keywordSearch(defaultedtrue) but neither was ever threaded into a search call.rerankactually reach the Mem0 search payload (platform-only) and markskeywordSearchas a documented no-op so the config no longer misleads.Motivation
Closes #5351.
Users who set
rerank: trueexpecting Mem0 Platform Advanced Retrieval reranking got only the plugin's localrankMemories()+budgetMemories()ordering — the key was inert.keywordSearchwas likewise inert because Mem0 v3 removed keyword search from the search API entirely.Root cause:
recall.tsandindex.tsbuildSearchOptionsbuiltsearchOptswith onlyuser_id/top_k/threshold/source(comment: "v3.0.0: reranking removed"), andPlatformProvider.searchnever forwardedrerankto the SDK — even thoughmem0-tsSearchMemoryOptionsstill declaresrerank?: booleanandcamelToSnakeKeysforwards it toPOST /v3/memories/search/.Fix
rerank(option 1 — thread it through):openclaw/recall.ts— threadrecallConfig.rerankintosearchOpts.openclaw/index.tsbuildSearchOptions— threadrecallCfg.rerank(this is the shared builder used by thememory_searchtool, so the tool path is fixed too).openclaw/providers.ts—PlatformProvider.searchforwardsrerankto the SDK;providerToBackend.searchpasses it through when requested.OSSProvider.searchselects fields explicitly and safely ignoresrerank(the OSS SDK has no reranker).keywordSearch(option 2 — mark no-op): v3 removed keyword search from the search API, so there is nothing to thread. Marked@deprecatedno-op intypes.ts,openclaw.plugin.jsonschema, andREADME.mdso users aren't misled.Verification
cd openclaw && pnpm test(vitest) — added 2 cases intests/providers.test.ts:forwards rerank to provider.search when opts.rerank is trueomits rerank when opts.rerank is falsyproviderToBackend — searchassertions updated for the new (optional) field.rerank?: booleanadded to bothSearchOptionsdefinitions (types.tsprovider-facing andbackend/base.tsalready had it).Did NOT change
OSSProvider.searchcontinues to ignorererank(intentional; no OSS reranker).keywordSearchbeyond marking it inert/deprecated.