Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(tier3): keep custom_only grading policy on unscored conditions (#287)

Narendran Raghavan9d131bd43c78
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77053ca1..78babe59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -417,6 +417,17 @@ All notable changes to SkillEvaluator are documented in this file.
or whose scores are outside 0–100%; consistent whole-number cards from
earlier releases still pass.
+- Tier 3 `custom_only` runs no longer label a condition without a scoreable
+ reward, for example one whose attempts all failed, with the standard metric
+ set and `skill-evaluator-dimension-mean-v1` policy. That condition's
+ `summary.json`, the agent's recorded metrics and score policies,
+ `attempt_policy.json`, and the report's score definition now carry the
+ `custom-only` metric set and `custom-overall-v1` policy. When a Harbor job
+ never started, both conditions' persisted `summary.json` files record that
+ metric set and policy. A failed custom-only agent is therefore no longer
+ treated as a standard agent. Scores were already cleared for these
+ conditions, and observed rewards still determine their own metric set.
+
- PII email scans recognize all RFC 2606 reserved domains, including their
subdomains, mixed-case forms, trailing dots, and prose ellipses. A local-part
boundary prevents quadratic rescanning of long excluded addresses. Ordinary
diff --git a/docs/custom-graders.mdx b/docs/custom-graders.mdx
index 86c6654d..f7cc993a 100644
--- a/docs/custom-graders.mdx
+++ b/docs/custom-graders.mdx
@@ -310,7 +310,10 @@ Custom scores flow into the same results tree as everything else:
- In `custom_only` mode, your `overall` reward drives pass@k and the overall
lift. The standard dimension rows stay visible but render `NO SCORE` —
unscored metrics are never coerced to 0.0, and your custom metrics are
- never re-labeled as standard dimensions.
+ never re-labeled as standard dimensions. An arm that produces no scoreable
+ reward (for example, every attempt fails) still records the `custom-only`
+ metric set and `custom-overall-v1` score policy in its summary and in the
+ run's attempt policy.
Custom lift needs both arms — a `--skip-baseline` run reports your custom
scores but no lift. [Reports & Results](reports.mdx) covers the full on-disk
diff --git a/src/skillevaluator/tier3/harbor/collector.py b/src/skillevaluator/tier3/harbor/collector.py
index 99a467eb..33ba588f 100644
--- a/src/skillevaluator/tier3/harbor/collector.py
+++ b/src/skillevaluator/tier3/harbor/collector.py
@@ -6917,12 +6917,16 @@ def collect_harbor_results(
env_mode: str | None = None,
agent_models: dict[str, dict[str, str]] | None = None,
launch_errors: list[str] | None = None,
+ grading_mode: str | None = None,
) -> dict[str, Any]:
"""Collect results from Harbor jobs into evals/results/<agent>/ structure.
Returns a dict with per-agent scores, lift, and a cross-agent comparison.
``skip_with_skill`` collects only the baseline arm of a baseline-only run:
the with-skill arm is recorded as skipped and no lift is computed.
+ ``grading_mode`` labels a condition with no scoreable reward with the
+ requested metric set and score policy; observed rewards still declare
+ their own.
"""
if skip_baseline and skip_with_skill:
raise ValueError("skip_baseline and skip_with_skill are mutually exclusive (no arm would run)")
@@ -6936,17 +6940,23 @@ def collect_harbor_results(
expected_case_ids,
)
+ # Unscored conditions keep the requested grading policy instead of
+ # falling back to the default metric set, which custom_only never grades.
+ fallback_metric_set, fallback_metrics = (
+ (CUSTOM_ONLY_METRIC_SET, ()) if grading_mode == "custom_only" else (DEFAULT_METRIC_SET, DISPLAY_METRICS)
+ )
+ fallback_policy = score_policy_for_metrics(fallback_metrics)
all_results: dict[str, Any] = {
"agents": {},
- "metric_set": DEFAULT_METRIC_SET,
- "metrics": list(DISPLAY_METRICS),
- "score_policy": DEFAULT_SCORE_POLICY,
+ "metric_set": fallback_metric_set,
+ "metrics": list(fallback_metrics),
+ "score_policy": fallback_policy,
"attempt_policy": {
"max_attempts": n_attempts,
"pass_threshold": pass_threshold,
"stop_on_pass": stop_on_pass,
- "score_definition": score_definition(DISPLAY_METRICS),
- "score_policy": DEFAULT_SCORE_POLICY,
+ "score_definition": score_definition(fallback_metrics),
+ "score_policy": fallback_policy,
},
}
@@ -6976,7 +6986,7 @@ def collect_harbor_results(
with_job_recovered = False
with_execution: dict[str, Any] = {}
with_overall_score: float | None = None
- with_policy = DEFAULT_SCORE_POLICY
+ with_policy = fallback_policy
with_policy_ambiguous = False
with_metrics: tuple[str, ...] = ()
with_summary: dict[str, Any] | None = None
@@ -7021,6 +7031,8 @@ def collect_harbor_results(
with_mixed_metric_contracts = rewards_have_mixed_metric_contracts(with_rewards)
with_trial_failures.extend(invalid_score_failures)
with_scores, with_metric_set, with_metrics = average_metrics(with_logical_rewards)
+ if not with_logical_rewards:
+ with_metric_set, with_metrics = fallback_metric_set, fallback_metrics
with_not_applicable = not_applicable_metrics(with_logical_rewards, with_metrics)
with_policy, with_policy_ambiguous = _score_policy_for_rewards(with_logical_rewards, with_metrics)
all_results["metric_set"] = with_metric_set
@@ -7126,29 +7138,6 @@ def collect_harbor_results(
f"Harbor job directory was not created: {with_job_name}",
)
with_job_failure = _published_job_failure(with_job_failure)
- summary_dir = agent_dir / "with-skill"
- summary_dir.mkdir(parents=True, exist_ok=True)
- _write_generated_root_json(
- summary_dir / "summary.json",
- output_dir,
- {
- "agent": agent,
- "model": agent_model,
- "model_source": agent_model_source,
- "scores": {},
- "custom_scores": {},
- "overall_score": None,
- "metric_set": DEFAULT_METRIC_SET,
- "metrics": list(DISPLAY_METRICS),
- "dimensions": {},
- "num_trials": 0,
- "num_reward_rows": 0,
- "mixed_metric_contracts": False,
- "pass_at_k": {},
- "job_failure": with_job_failure,
- "trial_failures": [],
- },
- )
if not with_execution:
with_execution = _condition_execution_summary(
@@ -7164,6 +7153,10 @@ def collect_harbor_results(
)
# A skipped with-skill arm still writes its summary: report loading keys
# agent presence on it, and its "skipped" status marks a baseline-only run.
+ # A with-skill job that never started records the requested grading
+ # policy, like an arm whose attempts all failed; a skipped arm was never
+ # graded, so it records no metric set or score policy. Both keep
+ # metrics [], matching the returned agent result.
if with_job_dir is None:
summary_dir = agent_dir / "with-skill"
summary_dir.mkdir(parents=True, exist_ok=True)
@@ -7177,7 +7170,9 @@ def collect_harbor_results(
"scores": {},
"custom_scores": {},
"overall_score": None,
+ **({} if skip_with_skill else {"metric_set": fallback_metric_set}),
"metrics": [],
+ **({} if skip_with_skill else {"score_policy": fallback_policy}),
"dimensions": {},
"num_trials": 0,
"num_reward_rows": 0,
@@ -7204,7 +7199,7 @@ def collect_harbor_results(
without_job_recovered = False
without_execution: dict[str, Any] = {}
without_overall_score: float | None = None
- without_policy = DEFAULT_SCORE_POLICY
+ without_policy = fallback_policy
without_policy_ambiguous = False
without_metrics: tuple[str, ...] = ()
without_summary: dict[str, Any] | None = None
@@ -7261,6 +7256,8 @@ def collect_harbor_results(
without_mixed_metric_contracts = rewards_have_mixed_metric_contracts(without_rewards)
without_trial_failures.extend(invalid_score_failures)
without_scores, without_metric_set, without_metrics = average_metrics(without_logical_rewards)
+ if not without_logical_rewards:
+ without_metric_set, without_metrics = fallback_metric_set, fallback_metrics
without_not_applicable = not_applicable_metrics(without_logical_rewards, without_metrics)
without_policy, without_policy_ambiguous = _score_policy_for_rewards(
without_logical_rewards, without_metrics
@@ -7373,30 +7370,6 @@ def collect_harbor_results(
f"Harbor job directory was not created: {without_job_name}",
)
without_job_failure = _published_job_failure(without_job_failure)
- summary_dir = agent_dir / "without-skill"
- summary_dir.mkdir(parents=True, exist_ok=True)
- _write_generated_root_json(
- summary_dir / "summary.json",
- output_dir,
- {
- "agent": agent,
- "model": agent_model,
- "model_source": agent_model_source,
- "scores": {},
- "custom_scores": {},
- "overall_score": None,
- "metric_set": DEFAULT_METRIC_SET,
- "metrics": list(DISPLAY_METRICS),
- "score_policy": DEFAULT_SCORE_POLICY,
- "dimensions": {},
- "num_trials": 0,
- "num_reward_rows": 0,
- "mixed_metric_contracts": False,
- "pass_at_k": {},
- "job_failure": without_job_failure,
- "trial_failures": [],
- },
- )
if not without_execution:
without_execution = _condition_execution_summary(
@@ -7423,8 +7396,9 @@ def collect_harbor_results(
"scores": {},
"custom_scores": {},
"overall_score": None,
+ "metric_set": fallback_metric_set,
"metrics": [],
- "score_policy": DEFAULT_SCORE_POLICY,
+ "score_policy": fallback_policy,
"dimensions": {},
"num_trials": 0,
"num_reward_rows": 0,
diff --git a/src/skillevaluator/tier3/harbor/runner.py b/src/skillevaluator/tier3/harbor/runner.py
index 8ccc2d7d..13f06395 100644
--- a/src/skillevaluator/tier3/harbor/runner.py
+++ b/src/skillevaluator/tier3/harbor/runner.py
@@ -5772,6 +5772,7 @@ def _run_harbor_eval_impl(
env_mode=env_mode,
agent_models=model_resolution,
launch_errors=errors,
+ grading_mode=grading_mode,
)
except Exception:
reporter.emit(ProgressEvent(stage="collection", state="failed", detail="result collection failed"))
diff --git a/tests/test_harbor_unscored_grading_policy.py b/tests/test_harbor_unscored_grading_policy.py
new file mode 100644
index 00000000..9c15dfd1
--- /dev/null
+++ b/tests/test_harbor_unscored_grading_policy.py
@@ -0,0 +1,199 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Unscored Tier 3 conditions keep the requested grading policy."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+import pytest
+
+from skillevaluator.evaluation.tier3_report import build_agent_eval_payload
+from skillevaluator.tier3.harbor import report_data
+from skillevaluator.tier3.harbor.collector import collect_harbor_results
+from skillevaluator.tier3.harbor.metrics import (
+ CUSTOM_ONLY_METRIC_SET,
+ CUSTOM_SCORE_POLICY,
+ DEFAULT_METRIC_SET,
+ DEFAULT_METRICS,
+ DEFAULT_SCORE_POLICY,
+ score_definition,
+)
+
+
+def _expected_contract(grading_mode: str | None) -> tuple[str, tuple[str, ...], str]:
+ if grading_mode == "custom_only":
+ return CUSTOM_ONLY_METRIC_SET, (), CUSTOM_SCORE_POLICY
+ return DEFAULT_METRIC_SET, DEFAULT_METRICS, DEFAULT_SCORE_POLICY
+
+
+def _write_json(path: Path, value: dict[str, object]) -> None:
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(json.dumps(value), encoding="utf-8")
+
+
+def _write_failed_job(job_dir: Path) -> None:
+ """Persist a Harbor job whose only trial failed before producing a reward."""
+ _write_json(
+ job_dir / "result.json",
+ {
+ "n_total_trials": 1,
+ "stats": {
+ "n_trials": 1,
+ "n_errors": 1,
+ "evals": {"eval": {"n_trials": 0, "n_errors": 1, "reward_stats": {}}},
+ },
+ },
+ )
+ _write_json(
+ job_dir / "case-001__attempt" / "result.json",
+ {
+ "task_name": "case-001",
+ "trial_name": "case-001__attempt",
+ "exception_info": {"exception_type": "RuntimeError", "exception_message": "sandbox connection lost"},
+ },
+ )
+
+
+def _write_scored_job(job_dir: Path, reward: dict[str, object]) -> None:
+ _write_json(
+ job_dir / "result.json",
+ {
+ "n_total_trials": 1,
+ "stats": {
+ "n_completed_trials": 1,
+ "n_errored_trials": 0,
+ "n_running_trials": 0,
+ "n_pending_trials": 0,
+ "n_cancelled_trials": 0,
+ "n_retries": 0,
+ "evals": {
+ "eval": {"n_trials": 1, "n_errors": 0, "reward_stats": {"reward": {"0.75": ["case-001__attempt"]}}}
+ },
+ },
+ },
+ )
+ _write_json(job_dir / "case-001__attempt" / "result.json", {"trial_name": "case-001__attempt"})
+ _write_json(job_dir / "case-001__attempt" / "verifier" / "reward.json", reward)
+
+
[email protected]("grading_mode", [None, "default", "default_plus_custom", "custom_only"])
[email protected]("skip_baseline", [True, False])
+def test_failed_conditions_keep_requested_grading_policy(
+ tmp_path: Path, grading_mode: str | None, skip_baseline: bool
+) -> None:
+ jobs_dir = tmp_path / "jobs"
+ _write_failed_job(jobs_dir / "demo-codex-with")
+ if not skip_baseline:
+ _write_failed_job(jobs_dir / "demo-codex-without")
+
+ result = collect_harbor_results(
+ "demo",
+ ["codex"],
+ tmp_path / "results",
+ jobs_dir,
+ skip_baseline=skip_baseline,
+ expected_cases=1,
+ expected_case_ids=["case-001"],
+ grading_mode=grading_mode,
+ )
+
+ metric_set, metrics, policy = _expected_contract(grading_mode)
+ assert result["execution_status"] == "failed"
+ assert result["scored_attempts"] == 0
+ assert result["metric_set"] == metric_set
+ assert result["metrics"] == list(metrics)
+ assert result["score_policy"] == result["attempt_policy"]["score_policy"] == policy
+ assert result["attempt_policy"]["score_definition"] == score_definition(metrics)
+ persisted_policy = json.loads((tmp_path / "results" / "attempt_policy.json").read_text(encoding="utf-8"))
+ assert persisted_policy["score_policy"] == policy
+ agent = result["agents"]["codex"]
+ conditions = ["with_skill"] if skip_baseline else ["with_skill", "without_skill"]
+ for condition in conditions:
+ assert agent[f"metrics_{condition}"] == list(metrics)
+ assert agent[f"score_policy_{condition}"] == policy
+ assert agent[condition] == {}
+ summary_path = tmp_path / "results" / "codex" / condition.replace("_", "-") / "summary.json"
+ summary = json.loads(summary_path.read_text(encoding="utf-8"))
+ assert summary["metric_set"] == metric_set
+ assert summary["metrics"] == list(metrics)
+ assert summary["score_policy"] == policy
+ assert summary["execution_status"] == "failed"
+ assert not summary["scores"] and not summary["custom_scores"] and not summary["dimensions"]
+ assert not list((tmp_path / "results").rglob("reward.json"))
+
+ # The report header must describe the requested policy, not the default fallback.
+ payload = build_agent_eval_payload(
+ "demo",
+ report_data.load_agent_data(tmp_path / "results"),
+ attempt_policy=persisted_policy,
+ use_llm_judge=False,
+ )
+ assert payload is not None
+ assert payload["score_policy"] == payload["attempt_policy"]["score_policy"] == policy
+ assert payload["overall_score"] is None
+
+
[email protected]("grading_mode", ["default", "custom_only"])
+def test_missing_jobs_keep_requested_grading_policy(tmp_path: Path, grading_mode: str) -> None:
+ result = collect_harbor_results(
+ "demo",
+ ["codex"],
+ tmp_path / "results",
+ tmp_path / "jobs",
+ expected_cases=1,
+ expected_case_ids=["case-001"],
+ launch_errors=["codex with-skill Harbor run failed: sandbox unavailable"],
+ grading_mode=grading_mode,
+ )
+
+ metric_set, metrics, policy = _expected_contract(grading_mode)
+ assert result["execution_status"] == "failed"
+ assert result["metric_set"] == metric_set
+ assert result["score_policy"] == result["attempt_policy"]["score_policy"] == policy
+ assert result["attempt_policy"]["score_definition"] == score_definition(metrics)
+ agent = result["agents"]["codex"]
+ assert agent["score_policy_with_skill"] == agent["score_policy_without_skill"] == policy
+ for condition in ("with_skill", "without_skill"):
+ # The persisted summary, not just the returned result, records the policy.
+ summary_path = tmp_path / "results" / "codex" / condition.replace("_", "-") / "summary.json"
+ summary = json.loads(summary_path.read_text(encoding="utf-8"))
+ assert summary["execution_status"] == "failed"
+ assert summary["metric_set"] == metric_set
+ assert summary["metrics"] == agent[f"metrics_{condition}"] == []
+ assert summary["score_policy"] == policy
+ assert summary["job_failure"]
+ with_summary = json.loads(
+ (tmp_path / "results" / "codex" / "with-skill" / "summary.json").read_text(encoding="utf-8")
+ )
+ assert with_summary["job_failure"] == "sandbox unavailable"
+ loaded = report_data.load_agent_data(tmp_path / "results")["codex"]
+ assert loaded["score_policy_with_skill"] == loaded["score_policy_without_skill"] == policy
+
+
[email protected]("grading_mode", ["default", "default_plus_custom", "custom_only"])
[email protected]("default_reward", [False, True])
+def test_observed_rewards_still_determine_metric_set(tmp_path: Path, grading_mode: str, default_reward: bool) -> None:
+ reward: dict[str, object] = {"entry_id": "case-001", "overall": 0.75}
+ if default_reward:
+ reward.update({"metric_set": DEFAULT_METRIC_SET, **dict.fromkeys(DEFAULT_METRICS, 0.75)})
+ _write_scored_job(tmp_path / "jobs" / "demo-codex-with", reward)
+
+ result = collect_harbor_results(
+ "demo",
+ ["codex"],
+ tmp_path / "results",
+ tmp_path / "jobs",
+ skip_baseline=True,
+ expected_cases=1,
+ expected_case_ids=["case-001"],
+ grading_mode=grading_mode,
+ )
+
+ assert result["execution_status"] == "succeeded"
+ assert result["scored_attempts"] == 1
+ assert result["metric_set"] == (DEFAULT_METRIC_SET if default_reward else CUSTOM_ONLY_METRIC_SET)
+ assert result["metrics"] == (list(DEFAULT_METRICS) if default_reward else [])
+ assert result["score_policy"] == (DEFAULT_SCORE_POLICY if default_reward else CUSTOM_SCORE_POLICY)
diff --git a/tests/test_tier3_config_key_parity.py b/tests/test_tier3_config_key_parity.py
index 14909ad8..1c92575a 100644
--- a/tests/test_tier3_config_key_parity.py
+++ b/tests/test_tier3_config_key_parity.py
@@ -121,6 +121,8 @@ def test_user_config_parses_and_routes_end_to_end(monkeypatch: pytest.MonkeyPatc
assert captured["collect"]["stop_on_pass"] is False
assert captured["collect"]["pass_threshold"] == 0.6
assert captured["collect"]["expected_trials"] == 1
+ # Collection labels unscored conditions with the normalized grading mode.
+ assert captured["collect"]["grading_mode"] == "default_plus_custom"
def test_environment_kwargs_cli_routes_to_every_harbor_run(