Fix perf gate crash when report uses nested metrics schema#69
Merged
Conversation
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.
Motivation
TypeErrorwhen the evaluation report used the newer JSON schema that nests metrics undermetrics, because the script expected flat top-level fields and tried to formatNonevalues.scripts/check_perf_gate.pyrobust to both the v1 nested schema and legacy flat schema and to avoid formatting errors for missing metrics.Description
_extract_metricsto read fromreport.get("metrics", report)so the v1 nestedmetricsblock is used when present while falling back to legacy flat keys._fmt_metric(value, spec)that returns"N/A"forNoneand otherwise formats the value, and use it for verbose output to preventNoneTypeformatting errors._fmt_metricforblue_win_rateandcvar_10, while preserving gate logic that treats missing metrics as failures with user-friendly messages.Testing
python scripts/check_perf_gate.py /tmp/perf_gate_sample.json --min-win-rate 0.45 --max-cvar10 40.0with a v1-style report and observed normal evaluation output and expected gate failure due to thresholds (script ran without crashing).python scripts/check_perf_gate.py /tmp/perf_gate_empty.json --min-win-rate 0.45 --max-cvar10 40.0with a report missing metrics and observedN/Aprinted and clean failure messages instead of an exception.python evaluate.py --fast --no-progress --seed 42 --output-json /tmp/perf_gate.jsonfollowed bypython scripts/check_perf_gate.py /tmp/perf_gate.json --min-win-rate 0.45 --max-cvar10 40.0and confirmed the perf gate runs to completion (noTypeError) and reports gate result (failed on CVaR threshold)Codex Task