feat(reflection): Option B BM25 neighbor expansion for fresh sessions (Issue #513)#529
feat(reflection): Option B BM25 neighbor expansion for fresh sessions (Issue #513)#529jlin53882 wants to merge 1 commit intoCortexReach:masterfrom
Conversation
…#513) - Add expandDerivedWithBm25BeforeRank() for fresh session support - Add bm25NeighborExpansion config in parsePluginConfig - Add await to loadAgentReflectionSlicesFromEntries calls - Fix: candidateTimestamp propagation (neighbors inherit parent timestamp) - Fix: enabled guard before scopeFilter guard - Add bm25-neighbor-expansion.test.mjs (17 tests) - Fix: memory-reflection.test.mjs async tests (8 tests)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
AliceLJY
left a comment
There was a problem hiding this comment.
Option B BM25 neighbor expansion for Issue #513,supersedes #523。整体 LGTM。
架构合理点:
loadAgentReflectionSlicesFromEntriessync→async 是必要的(BM25 search 是 I/O),index.ts 调用方已正确await- 6 个防御机制(D1-D6)完整:空数组 early return、无 bm25Search bypass、scopeFilter guard、16 条 cap、120 char truncation、neighbors prepend
- BM25 error fail-safe:catch + warn 不阻塞 reflection pipeline
- 用
Promise.all并行搜索,性能好 - Config 通过
parsePluginConfig正确解析,defaults 合理(top-5 candidates, 3 neighbors each)
测试覆盖: 454 行单元测试,覆盖 D1-D6 每个防御点 + dedup + category filter + config override。Mock bm25Search 对此函数是合适的隔离策略。
Minor note: .gitattributes(line ending normalization)跟 BM25 feature 无关,理想情况下可以是独立 commit,但不 blocking。
LGTM ✅
|
Hi @rwmjhb - B-1 (PR #529) has been approved by AliceLJY. Before we proceed with B-2 implementation, we have posted a proposal on Issue #445 for your review: Key questions for B-2:
Please let us know if you have any feedback on the B-2 proposal. Thank you! |
Review SummaryThanks for working on the BM25 neighbor expansion for fresh sessions. After a multi-round automated review (7 rounds, Claude + Codex adversarial), we're closing this PR. Here's why: Blocking Issues
Additional Concerns
RecommendationThe problem (fresh sessions bypassing BM25 expansion) is real and worth solving, but this implementation needs a different approach — specifically, handling the Closing for now. Feel free to reopen with a revised approach. |
|
Following the contribution workflow guidance, I've opened a focused question issue specifically about the fresh-session BM25 query material problem: Issue #538: [Question] Fresh Session BM25 Expansion: What should be used as query material when derived empty? This issue:
Waiting for maintainer guidance before implementing any changes. |
- PR CortexReach#529 CLOSED by rwmjhb - Issue CortexReach#513/538 updated with B-2 focus and conflict analysis - Waiting for maintainer resolution before implementing
Summary
Implements Option B Phase 1: BM25 Neighbor Expansion for Reflection Slices (Issue #513).
Motivation
Following AliceLJY's guidance in Issue #513:
Architecture
Key design decisions:
quality = 0.2 + 0.6 * bm25Score(range [0.2, 0.8])Config
{ "plugins": { "memory-lancedb-pro": { "bm25NeighborExpansion": { "enabled": true, "maxCandidates": 5, "maxNeighborsPerCandidate": 3 } } } }Changes
src/reflection-store.tsexpandDerivedWithBm25BeforeRank(), typesindex.tsawaiton async callstest/bm25-neighbor-expansion.test.mjstest/memory-reflection.test.mjs.gitattributesTest Results
Related