Commit 2aa0be1
fix(searcher): address Dialectician review on MemPalace#1005
- _count_in_scope: use col.count() for unfiltered scopes (O(1) vs 28
paginated round trips on 137K drawers when wing/room filter is absent)
- allow_fallback gate: fire BM25 fallback when max_distance is permissive
(<=0.0) OR when a vector error occurred (warnings non-empty). Fixes the
MCP path: tool_search passes max_distance=1.5, which the old gate read
as "strict" and silently skipped fallback — so agents on a drifted palace
saw 0 hits instead of BM25 coverage + a warning
- Add explanatory comment on vector_hit_count pre-mutation capture
- Update test mocks with explicit count.return_value (required now that
_count_in_scope calls col.count() for unfiltered scopes)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 217ea56 commit 2aa0be1
2 files changed
Lines changed: 26 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
| 309 | + | |
311 | 310 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
317 | 315 | | |
318 | 316 | | |
319 | 317 | | |
320 | 318 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 326 | + | |
330 | 327 | | |
331 | 328 | | |
332 | 329 | | |
| |||
652 | 649 | | |
653 | 650 | | |
654 | 651 | | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
659 | 663 | | |
660 | 664 | | |
661 | 665 | | |
662 | 666 | | |
663 | 667 | | |
664 | 668 | | |
665 | 669 | | |
666 | | - | |
| 670 | + | |
667 | 671 | | |
668 | 672 | | |
669 | 673 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| 231 | + | |
229 | 232 | | |
230 | 233 | | |
231 | 234 | | |
| |||
0 commit comments