fix(core): scope L1 memory search in stores#29
Conversation
Pass sessionKey and sessionId filters through L1 search APIs so shared backends apply scope before topK truncation. Keep a caller-side guard as a final defense and cover both vector and FTS recall paths with regression tests. Signed-off-by: Dimon <lovedaih@gmail.com>
|
Hi @Dimon94, thanks for this fix! This is an important correctness improvement for scoped memory search. We'll review the implementation details and get back to you. |
|
Thanks for the quick response. Agreed. The key correctness point here is that scope filtering should happen before topK truncation, otherwise valid in-scope memories can be hidden by out-of-scope results that happen to rank higher globally. I tried to keep the fix store-local and defensive: each backend applies the scope as early as its query path allows, and the caller-side check remains as a final guard. I also added regression tests for both vector and FTS paths to cover the truncation-before-filtering failure mode. I will wait for the implementation review and adjust anything that does not fit the backend conventions. |
Description | 描述
Make L1 memory search scope filters apply before result truncation:
sessionKey/sessionIdinsearchMemories()and Gateway/search/memoriesThis is a general shared-backend correctness fix. It is not tied to any specific downstream host.
Related Issue | 关联 Issue
None.
Change Type | 修改类型
Self-test Checklist | 自测清单
Additional Notes | 其他说明
Local verification:
npm test -- src/core/tools/memory-search.test.tsnpm testnpm run build:plugingit diff --cached --checkbefore commit