You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rlv): production hardening — 6 robustness improvements
1. Input validation (orchestrator.py):
- Guard None/empty doc_text and question → clear error dict
- No more crashes on invalid inputs
2. JSON response parsing (\_llm.py):
- Handle malformed/null choices, missing message field
- Detect empty responses → mark is_error=True
- Validate max_tokens (0/negative → default 64)
3. Refusal detection precision (verifier.py):
- Only flag refusal when phrase is in first 120 chars AND answer < 200 chars
- Prevents false positives on legitimate answers like
"The study does not provide evidence for..." (long quoted content)
- Narrowed phrase list to more specific patterns
4. BM25 IDF robustness (locator.py):
- Clamp IDF to ≥ 0 (prevent negative scores on edge cases)
- Adaptive RRF k: k=60 for <100 chunks, k=min(N,200) for large docs
5. Error-aware researcher (researcher.py):
- Skip verification on lookup errors (server crash/timeout)
- Log error and continue to next chunk instead of crashing
6. max_tokens validation (\_llm.py):
- Clamp ≤ 0 values to default 64
Tested: None inputs, empty docs, refusal precision (long vs short),
BM25 all-identical-chunks, max_tokens=0.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments