Files
DeepTutor/tests/services/search
Rudy Celekli d57770ed65 fix(search): don't let flagged long references bypass Moderation
_moderation_rejections keyed its decision dict by text.strip()[:4000] while
filter_web_search_response looked the decision up by the unstripped row text
(_reference_text(...)[:4000]). When a reference exceeded the 4000-char cap and
the cut landed on whitespace, the stripped key differed from the row text, the
lookup missed, and a reference OpenAI Moderation had flagged survived into the
results — the exact fail-open the stage exists to prevent. Key the dict by each
exact submitted text and cap only the payload sent to the API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-26 10:33:12 -04:00
..