Fuse recent and lexical skills in shadow selection (#38204)

## What changed

- Add the `lru_plus_lexical_v1` selector, combining the 50 most recent skills
  with weighted lexical matches through reciprocal rank fusion.
- Include the combined selector in the shadow-selection experiment and propagate
  query and candidate truncation metadata from both inputs.
- Generalize the existing reciprocal-rank fusion helper to accept a rank
  constant while preserving the existing lexical/character selector behavior.

## Testing

- Cover lexical-only selection, merging recent and matching skills, promotion
  from agreement between both rankings, and weak overlaps.
- Extend the skills extension test to verify invocation metrics for the new
  selector alongside `lru_v1`.

GitOrigin-RevId: 1b7b82bc97ea919c719cd05a009351b701019306
This commit is contained in:
jif authored and copyberry committed 2026-08-12 15:17:54 +00:00
1 parent 9dd22890f5
commit 3d7f9b4637
6 files changed
+204 -8

No files matched your search

@@ -2,6 +2,7 @@ mod character_ngram;
mod character_routing_card;
mod fielded_bm25;
mod lru;
mod lru_plus_lexical;
mod multi_query_lexical;
mod routing_card_lexical;
mod rrf_lexical_char;
@@ -11,6 +12,7 @@ pub(crate) use character_routing_card::CharacterRoutingCardSkillSelector;
use codex_skills::SkillDependencies;
pub(crate) use fielded_bm25::FieldedBm25SkillSelector;
pub(crate) use lru::LruSkillSelector;
pub(crate) use lru_plus_lexical::LruPlusLexicalSkillSelector;
pub(crate) use multi_query_lexical::MultiQueryLexicalSkillSelector;
pub(crate) use routing_card_lexical::RoutingCardLexicalSkillSelector;
pub(crate) use rrf_lexical_char::RrfLexicalCharSkillSelector;