Skip to main content

passes

Function passes 

Source
pub fn passes(reranked: &[Hit], cfg: &Config) -> Vec<Hit>
Expand description

Apply the reranker-scale guardrails to a reranked candidate list: keep hits at or above rerank_min and within rerank_margin of the best reranked score. Returns hits sorted by descending reranked score (input order is preserved as it already is). The caller still applies deny/session/cap.

Stage-1 agreement. Before the reranker thresholds, a candidate must have a bi-encoder score (the preserved stage-1 Hit::stage1_score; rerank only overwrites score with the logit) within [AGREEMENT_SLACK] of stage-1’s own injection floor (min_similarity). Every channel counts: the phrase term is included on purpose — a confident multi-token trigger match is exactly the “stage-1 judged relevant” signal this gate looks for, so it may carry an otherwise sub-floor cosine through; the context term rides along for the same reason. (The project term is in the sum too and — since it fires from crate::rank::PROJECT_GATE_SLACK below the floor — can likewise carry a near-floor ecosystem skill through, which is deliberate: the workspace’s own ecosystem skill is exactly the recall ski should lean toward, and the reranker logit still gates it.) The cross-encoder’s job is to reorder and confirm the retrieved relevant set, not to resurrect a skill stage-1 judged irrelevant. Without this gate a prompt with no real match — “implement the builder pattern in Java”, “RSA key generation from scratch” — lets the reranker pull a sub-floor skill to the top and inject noise; the logits there interleave with genuine weak matches (so no rerank_min value separates them), but their stage-1 scores sit lower (~0.57-0.59 vs ~0.63 for borderline real matches).