fix: guard against None content in JudgeRubric judge response#1312
Open
vominh1919 wants to merge 1 commit intoPrimeIntellect-ai:mainfrom
Open
fix: guard against None content in JudgeRubric judge response#1312vominh1919 wants to merge 1 commit intoPrimeIntellect-ai:mainfrom
vominh1919 wants to merge 1 commit intoPrimeIntellect-ai:mainfrom
Conversation
When the judge model returns tool_calls or a refusal, message.content is None. The previous code did str(None) which produced the string "None", causing the judge to silently score the literal string "None" instead of raising an error. Now raises RuntimeError with a clear message when content is None, so the caller can handle the failure appropriately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
verifiers/rubrics/judge_rubric.py:98, the judge response is extracted with:When the judge model returns tool_calls or a refusal (e.g., content filter),
message.contentisNone. In Python,str(None)produces the literal string"None", which is then parsed as the judge's scoring response. This causes:Fix
Check for
Nonecontent and raise a clearRuntimeErrorwith diagnostic info:The error is raised inside the existing
try/except Exceptionblock (line 126), so it will be caught and logged properly with the model name.Before vs After
content = Nonestr(None)="None"→ silent wrong scoreRuntimeError→ logged + propagatedstr(None)="None"→ silent wrong scoreRuntimeError→ logged + propagatedTests
This change only affects the error path when
content is None. The happy path (non-None content) is completely unchanged. Existing tests that mock the judge client with valid responses will continue to pass.Note
Medium Risk
Changes judge scoring behavior to raise an exception when the model returns
Nonecontent (e.g., tool calls/refusals), which may surface new runtime failures for callers that previously received a silent "None" string.Overview
Prevents silent mis-scoring in
JudgeRubricby validating the judge model response before parsing.When
choices[0].message.contentisNone(commonly due to tool calls or refusals), the code now raises a descriptiveRuntimeErrorinstead of convertingNoneto the literal string"None"and caching/returning it.Reviewed by Cursor Bugbot for commit 2e8644b. Bugbot is set up for automated code reviews on this repo. Configure here.