Skip to content

fix(core): count a recall once, and only the memories it returns (#1407) - #1412

Merged
ajianaz merged 1 commit into
developfrom
fix/recall-touch-once-1407
Oct 9, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/recall-touch-once-1407

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • The strategy arms (vector, fts5, hybrid, fusion) no longer touch counters. The touch happens once per user-level call, on the final returned results: recall(), recall_hybrid() (cache hit or miss) and search() (unchanged).
  • recall_inner, recall_fts5_only and recall_rrf lose their own touch_recall_batch; compute_recall and the hybrid/FTS fallbacks call recall_inner directly instead of the touching recall().
  • recall_explained (built on compute_recall) and the point-in-time candidate search are now read-only. explain used to bump counters like a real recall.
  • New shared test helper test_support (embedder-equipped Uteke without ONNX), reused by the room recall tests.

Why

Closes #1407. One default (fusion) recall bumped recall_count by 3 per memory (hybrid 2, vector/fts5/search 1), and the arms work on a boost_window of up to 4 * limit + 16 candidates, so memories that were never returned were counted too. That made the feedback loop that #1337 weakens roughly three times stronger than intended. A repeated query served from the recall cache did not count at all; it now counts once per call like any other recall.

Testing

  • fmt, clippy -D warnings, cargo test --workspace (668 in uteke-core) and the vecq-only core lib tests green
  • 4 new tests on a store with a real (keyword) embedder: for every strategy one recall with limit = 1 counts exactly one memory exactly once and touches nothing else; three identical queries (cache hits) give 1, 2, 3; the public vector recall() counts returned results once; recall_explained leaves every counter at 0. Three of the four fail against the old operations.rs
  • Benchmark gate passed: LongMemEval fast50 on Modal, develop 3af904e vs this branch 7b4a678 (default strategy, 10 shards). Aggregates identical: mean R@5 0.9800 vs 0.9800 (+0.0000), 0 questions improved, 0 regressed (compare_fast50.py); on the 43 scored questions recall_all@5 0.9767 and recall_all@10 1.0000 in both runs. 36 of 50 rows are byte-identical and 14 differ in ranking detail only (rankings are not deterministic, so only the aggregates count). The script's "GATE (+3pp)" line is a leftover of the rerank experiment and does not apply. fast50 uses one recall per question, so it shows no regression, not the effect of the counter fix.
  • Behaviour notes: time-travel (--at) candidate searches no longer count as recall hits (they used to touch every candidate); no schema or API change

🤖 Generated with Claude Code

The strategy arms (vector, fts5, hybrid, fusion) no longer touch counters:
they are built from each other and work on a boost_window of candidates, so
one default recall counted +3 per memory and bumped candidates that were never
returned. The touch now happens once per user-level call on the final results:
recall(), recall_hybrid() (cache hit or miss) and search(). recall_explained
and the point-in-time candidate search are read-only.

Adds a shared embedder-equipped test helper (test_support) and tests for every
strategy.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz marked this pull request as ready for review October 9, 2026 08:43
@ajianaz
ajianaz merged commit a42d455 into develop Oct 9, 2026
19 checks passed
@ajianaz
ajianaz deleted the fix/recall-touch-once-1407 branch October 9, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core): one recall bumps recall_count several times (fusion +3, hybrid +2)

1 participant