Repository navigation
fix(search): use effective-time fallback (mentioned_at, occurred_end) for recency scoring - #2197
Merged
nicoloboschi merged 3 commits intoJun 15, 2026
Conversation
Clears verify-generated-files CI: ruff format collapses the recency effective-time fallback (reranking.py) and a main-drift one-liner in consolidator.py that both fit the 120-char line length.
nicoloboschi
approved these changes
Jun 15, 2026
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.
Problem
apply_combined_scoring(reranking.py) derives the recency boost fromoccurred_startonly — whenoccurred_startisNone, recency stays at the neutral0.5even if the memory carries a usablementioned_at/occurred_end. Temporal retrieval already treats effective time asCOALESCE(occurred_start, mentioned_at, occurred_end)via_coalesce_date(retrieval.py), so recency scoring is the one place that ignores the fallback.Memories that intentionally lack
occurred_start(conversation facts, ongoing states —mentioned_atset,occurred_startNoneperretain/types.py) therefore lose correct recency ordering in recall. This is most acute in slim / passthrough (RRFPassthroughCrossEncoder) deployments, where recency is the only signal modulating RRF rank.Fix
Derive recency from the same effective-time COALESCE order used by
_coalesce_date:occurred_start→mentioned_at→occurred_end. The existing naive→UTC normalization and 365-day linear decay are unchanged and now apply to whichever timestamp is selected.Tests
test_combined_scoring.py: extended_make_resultto acceptmentioned_at/occurred_end, reworded the no-date test to reflect "no effective time at all → neutral", and added coverage for thementioned_at-only path, theoccurred_endlast-fallback, andoccurred_startprecedence (matching_coalesce_date). The new tests fail on the prioroccurred_start-only implementation.Closes #2192.