Skip to content

Fail closed when a quality metric has no valid score - #7735

Merged
peterwald merged 1 commit into
dotnet:mainfrom
thaildhe172591:fix/quality-interpret-score-fail-closed
Sep 3, 2026
Merged

peterwald merged 1 commit into
dotnet:mainfrom
thaildhe172591:fix/quality-interpret-score-fail-closed

Conversation

@thaildhe172591

@thaildhe172591 thaildhe172591 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7665

The quality evaluators interpret their own score through InterpretScore(NumericMetric). That method only reached the failed branch when the metric's value parsed to a double below the minimum passing score of 4.0, so two cases fell through to not-failed:

  • the value is null, which is what happens when the judge returns text the evaluator cannot parse a score out of
  • the value is outside the scale the ratings cover: above 5.0, or NaN and infinity, both of which double.TryParse accepts

Both already produced an Inconclusive rating, so the metric carried a rating saying nothing was concluded alongside a result that reads as a pass. A pipeline gating on Failed treats a metric that was never successfully scored as green.

This marks both cases as failed. The BooleanMetric overload in the same file already fails closed on a null value, and the report UI already counts a metric with an error diagnostic as failed, which every parse failure produces. So the flag now agrees with what the rest of the library already treats as a failure.

On the compatibility guidance in CONTRIBUTING: this does change observable behavior. A run that previously reported no failures can now report one, in exactly the cases where the judge did not return a usable score. Values inside the scale are unaffected, including the 4.0 boundary and the existing reason text for scores below it.

The same shape exists in InterpretContentSafetyScore and InterpretContentHarmScore in the Safety package, and in the NLP package's ScoreInterpretationExtensions. I left those alone since the issue is scoped to Quality, and can follow up if you want them consistent.

Verified locally with the pinned SDK on net10.0, net9.0, net8.0 and net472. With the fix reverted and the new tests present, the test project fails 3 of 173; with the fix applied, 174 of 174 pass on every target.

Microsoft Reviewers: Open in CodeFlow

Fixes dotnet#7665

InterpretScore(NumericMetric) only marked a metric as failed when its
value parsed to a double below the minimum passing score. A metric
with no value at all, which is what happens when the judge's reply
cannot be parsed, took the not-failed branch, and so did a value
outside the scale the ratings cover. Both already carry an
Inconclusive rating, so a pipeline that gates on Failed treated a
metric that was never scored as a pass.

Metrics with no value, and values outside the range the ratings
cover, are now marked as failed. The BooleanMetric overload in the
same file already behaved this way.

@peterwald peterwald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution

@peterwald
peterwald merged commit 47b6b06 into dotnet:main Sep 3, 2026
7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Evaluation.Quality] InterpretScore(NumericMetric) marks unparseable (null) and out-of-range scores as not-failed

2 participants