.agents/memory/2026-02-27-predictor-bug-fix-reject-mismatched-candidate-feat.md

12 lines
1013 B
Markdown

# 2026-02-27 Session Notes
## Predictor Bug Fix: Reject Mismatched candidate_features
Nicholai implemented a fix to eliminate silent data corruption in `packages/predictor/src/main.rs` (line 79). The code previously silently replaced mismatched `candidate_features` vectors with all-zero values when their length didn't match `candidate_ids`. This masked upstream bugs and degraded ranking quality without signaling the problem.
The fix changed the logic to:
1. If `candidate_features` is empty → zero-fill (correct, feature not provided)
2. If length matches `candidate_ids` → use as-is (correct, provided correctly)
3. If provided but length mismatches → return explicit error (fixed from silent zero-fill)
This brings consistency with how `candidate_embeddings` and `candidate_texts` already handle the same scenario (returning explicit length-mismatch errors). The change was applied via Edit tool and preserves the empty-features fallback behavior while fixing the dangerous silent-corruption case.