Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/eval/inference/hpo_search_baselines.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,14 @@ def primary_metric(metrics: dict[str, Any], scenario: str) -> tuple[float, str |


def gate_passed(metrics: dict[str, Any]) -> bool:
if metrics.get("error"):
return False
if metrics.get("score") == 0:
return False
qc = metrics.get("quality_check") or {}
if qc.get("pass") is False:
qc = metrics.get("quality_check")
if not isinstance(qc, dict):
return False
return True
return qc.get("pass") is True


def _run_text(cmd: list[str], timeout_s: float = 20.0) -> str:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_hpo_search_baselines.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,15 @@ def test_gate_passed_ignores_legacy_success_gate_field():
def test_gate_passed_still_fails_quality_and_zero_score():
assert not hpo.gate_passed({"score": 0, "quality_check": {"pass": True}})
assert not hpo.gate_passed({"quality_check": {"pass": False}})


def test_gate_passed_requires_explicit_successful_quality_check():
assert hpo.gate_passed({"quality_check": {"pass": True}})
assert not hpo.gate_passed({})
assert not hpo.gate_passed({"quality_check": {}})
assert not hpo.gate_passed(
{
"error": "evaluate.py exited with code 1",
"quality_check": {"pass": True},
}
)