Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ All notable changes to SkillEvaluator are documented in this file.

### Fixed

- Malformed optional trajectory `final_metrics` leave condition usage unavailable
Comment thread
Afloat16 marked this conversation as resolved.
Resolved
instead of aborting the collection of completed Tier 3 results.
- GitLab JUnit collection includes nested skill folders in catalog reports.
- API caller now percent-encodes scalar OpenAPI path values as individual segments and rejects `.` and `..` values with a JSON input error.
- Direct Tier 1 validates the target, selected checks and LLM configuration before
Expand Down
3 changes: 3 additions & 0 deletions src/skillevaluator/tier3/baseline_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def measured_condition_usage(condition_dir: Path) -> dict[str, float | None]:
seen.add(trial_id)
trajectory = json.loads(reward_path.with_name("trajectory.json").read_text(encoding="utf-8"))
metrics = trajectory["final_metrics"]
if not isinstance(metrics, dict):
Comment thread
Afloat16 marked this conversation as resolved.
Resolved
complete = False
continue
for field in fields:
value = metrics.get(field)
if type(value) in (int, float) and math.isfinite(value) and value >= 0:
Expand Down
43 changes: 43 additions & 0 deletions tests/tier3/test_usage_metric_shapes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Malformed optional trajectory usage cannot abort completed result collection."""

import json
from pathlib import Path

import pytest

from skillevaluator.tier3.baseline_store import measured_condition_usage


@pytest.mark.parametrize("metrics", [None, [], False, 42, "unavailable"])
@pytest.mark.parametrize("with_valid_trial", [False, True])
def test_nonobject_final_metrics_leave_condition_usage_unavailable(
tmp_path: Path, metrics: object, with_valid_trial: bool
) -> None:
records = [("bad", metrics)]
if with_valid_trial:
records.append(
(
"good",
{
"total_prompt_tokens": 10,
"total_completion_tokens": 4,
"total_cached_tokens": 2,
"total_cost_usd": 0.05,
},
)
)
for trial_id, final_metrics in records:
trial = tmp_path / "trials" / trial_id
trial.mkdir(parents=True)
(trial / "reward.json").write_text(json.dumps({"trial_id": trial_id}), encoding="utf-8")
(trial / "trajectory.json").write_text(json.dumps({"final_metrics": final_metrics}), encoding="utf-8")

assert measured_condition_usage(tmp_path) == {
"total_prompt_tokens": None,
"total_completion_tokens": None,
"total_cached_tokens": None,
"total_cost_usd": None,
}
Loading