fix: prevent TypeError in metrics collect_metrics when reward is None#243
Open
JasonOA888 wants to merge 1 commit intobenchflow-ai:mainfrom
Open
fix: prevent TypeError in metrics collect_metrics when reward is None#243JasonOA888 wants to merge 1 commit intobenchflow-ai:mainfrom
JasonOA888 wants to merge 1 commit intobenchflow-ai:mainfrom
Conversation
collect_metrics picks the best result per task across retries by comparing
reward values. When a verifier returns rewards={'reward': None, 'rubric': [...]}
(a dict with a None reward), the comparison raises TypeError.
Fix: add _safe_reward() helper that normalizes None/missing reward values
to 0.0 before comparison.
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.
collect_metrics picks the best result per task across retries by comparing reward values. When a verifier returns
rewards={"reward": None, "rubric": [...]}(a truthy dict with a None reward), the comparisonfloat > NoneraisesTypeError.This can happen when a rubric verifier returns partial results — individual items pass but the overall reward is unresolved.
Fix: add
_safe_reward()helper that normalizes None/missing reward values to 0.0 before comparison.Repro: