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.

Report budget overruns and unavailable baseline pass rates (#505)

Narendran Raghavanf62ab6e248fb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b920e072..f583b002 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,13 @@ All notable changes to SkillEvaluator are documented in this file.
### Fixed
+- The supporting Tier 3 Pass@k table displays an unavailable or skipped
+ baseline rate as `N/A`, preserving an observed baseline rate of `0%`.
+- Tier 3 budget summaries disclose measured usage above configured limits,
+ including after the final admitted attempt, and identify incomplete usage.
+ Additive `budget.observed_overruns` metadata is separate from admission
+ `status`; limits are checked between logical admission units, so a completed
+ run can exceed a cap without becoming partial or failed.
- Grader qualification reports null behavior-step results with a matching
`not_checked` expectation as insufficient evidence instead of errors. Raw
scores and unjudgeable rates are unchanged.
diff --git a/docs/tier3-live-evaluation.mdx b/docs/tier3-live-evaluation.mdx
index 2032e6c8..5322cbf9 100644
--- a/docs/tier3-live-evaluation.mdx
+++ b/docs/tier3-live-evaluation.mdx
@@ -978,6 +978,22 @@ and each uses the full `--n-concurrent` budget. For example, two agents with
`--n-concurrent 4` run up to eight trials at once, fewer when fewer cases
remain.
+Run budgets (`--max-agent-tokens`, `--max-judge-calls`,
+`--max-attempts-total`, and priced `--max-cost-usd`) control admission between
+logical units of work. Already admitted work can take measured usage above a
+cap, including on the final unit. These are admission boundaries, so a priced
+cost budget does not guarantee a hard dollar cap.
+
+`budget.status` and `exhausted_limit` describe admission decisions;
+`budget.partial` records attempts left not run. Separately,
+`budget.observed_overruns` maps each exceeded limit to its measured `used`,
+configured `limit`, and `excess` (with attempts measured by started attempts).
+Only usage strictly above a cap is an overrun; completion exactly at a cap
+remains within it. Summaries derive these facts from usage and limits,
+including for older saved runs. Missing or partially measured bounded usage
+is reported as unverified, and unconfigured limits are not checked. An observed
+overrun alone does not change scores, execution success, or partial-run status.
+
In a terminal, `--progress auto` uses the `rich` view: one table of the run
plan and its stages that keeps the same height for the whole run. Each row is
one line, and a long value ends in an ellipsis instead of wrapping. The agent
diff --git a/src/skillevaluator/reporting/templates/report.html.j2 b/src/skillevaluator/reporting/templates/report.html.j2
index 37dad4ad..a66caf80 100644
--- a/src/skillevaluator/reporting/templates/report.html.j2
+++ b/src/skillevaluator/reporting/templates/report.html.j2
@@ -2208,7 +2208,7 @@
{% set t3_evidence_links = t3_harbor.get('evidence_links') or [] %}
{% set t3_agent_anchor_ids = {} %}
{% set t3_agent_panel_ids = {} %}
- {% if t3_budget.status == 'exhausted' and tier3.budget_summary %}
+ {% if tier3.budget_summary and (t3_budget.status == 'exhausted' or 'overrun observed' in tier3.budget_summary or 'not fully verified' in tier3.budget_summary) %}
<p class="warning">{{ tier3.budget_summary }}</p>
{% endif %}
{% for name, _agent in t3_agents.items() %}
@@ -3081,7 +3081,7 @@
{% set bi = bp.rate_interval or {} %}
{% set paired = lf.paired_comparison if lf.paired_comparison is mapping else {} %}
{% set wp_rate = wp.get('rate') %}
- {% set bp_rate = bp.get('rate') %}
+ {% set bp_rate = bp.get('rate') if (tier3.baseline or {}).get('mode') != 'skipped' else none %}
{% set arm_delta = wp_rate - bp_rate if wp_rate is number and bp_rate is number else none %}
{% if wp %}
<tr>
@@ -3103,7 +3103,7 @@
<tr>
<td></td>
<td>Without skill</td>
- <td>{{ "%.0f%%" | format((bp_rate or 0.0) * 100) }}</td>
+ <td>{% if bp_rate is number and bp_rate is not boolean %}{{ "%.0f%%" | format(bp_rate * 100) }}{% else %}N/A{% endif %}</td>
<td>{% if bi %}{{ bi | adaptive_interval_percent }}{% else %}—{% endif %}</td>
<td>{{ bp.passed_cases or 0 }} of {{ bp.total_cases or 0 }}</td>
<td>{{ t3_attempts_passed(bp) }}</td>
diff --git a/src/skillevaluator/tier3/harbor/run_budget.py b/src/skillevaluator/tier3/harbor/run_budget.py
index 516a14aa..bd133ba6 100644
--- a/src/skillevaluator/tier3/harbor/run_budget.py
+++ b/src/skillevaluator/tier3/harbor/run_budget.py
@@ -238,7 +238,7 @@ class BudgetController:
def metadata(self) -> dict[str, Any]:
with self._lock:
- return {
+ metadata = {
"limits": {
"max_agent_tokens": self.max_agent_tokens,
"max_judge_calls": self.max_judge_calls,
@@ -264,6 +264,8 @@ class BudgetController:
"attempts_not_run": len(self.not_run),
"not_run": list(self.not_run),
}
+ metadata["observed_overruns"] = _budget_observations(metadata)[0]
+ return metadata
@staticmethod
def _not_run(agent: str, arm: str, case_id: str, attempt: int) -> dict[str, Any]:
@@ -277,32 +279,101 @@ class BudgetController:
}
+_BUDGET_LIMITS = {
+ "agent_tokens": ("max_agent_tokens", "agent tokens"),
+ "judge_calls": ("max_judge_calls", "judge calls"),
+ "cost_usd": ("max_cost_usd", "cost"),
+ "attempts": ("max_attempts_total", "attempts"),
+}
+
+
+def _measured_number(value: Any) -> int | float | None:
+ if isinstance(value, bool) or not isinstance(value, (int, float)) or value < 0:
+ return None
+ return value if isinstance(value, int) or math.isfinite(value) else None
+
+
+def _budget_observations(metadata: dict[str, Any]) -> tuple[dict[str, Any], list[str], bool]:
+ """Derive reporting facts, including for legacy metadata, without changing admission."""
+ limits = metadata.get("limits", {})
+ if not isinstance(limits, dict):
+ return {}, ["limits invalid"], True
+ used = metadata.get("used")
+ used = used if isinstance(used, dict) else {}
+ unmeasured = metadata.get("unmeasured_attempts", {})
+ overruns: dict[str, Any] = {}
+ incomplete = []
+ configured = False
+ for key, (limit_key, label) in _BUDGET_LIMITS.items():
+ raw_cap = limits.get(limit_key)
+ if raw_cap is None:
+ continue
+ configured = True
+ cap = _measured_number(raw_cap)
+ if cap is None:
+ incomplete.append(f"{label} limit invalid")
+ continue
+ value = _measured_number(metadata.get("started_attempts") if key == "attempts" else used.get(key))
+ if value is None:
+ incomplete.append(f"{label} not measured")
+ else:
+ if value > cap:
+ overruns[key] = {"used": value, "limit": cap, "excess": value - cap}
+ if key != "attempts":
+ missing = _measured_number(unmeasured.get(key, 0)) if isinstance(unmeasured, dict) else None
+ if missing is None:
+ incomplete.append(f"{label} measurement completeness unknown")
+ elif missing > 0:
+ incomplete.append(f"{label} usage partially measured")
+ return overruns, incomplete, configured
+
+
+def _budget_number(value: Any, *, cost: bool = False, missing: str = "not measured") -> str:
+ number = _measured_number(value)
+ if number is None:
+ return missing
+ if cost:
+ return f"${number:,.2f}" if number == 0 or number >= 0.01 else f"${number:.6g}"
+ return f"{number:,}"
+
+
def budget_line(metadata: dict[str, Any]) -> str:
- status = metadata.get("status")
- if status != "exhausted":
- return "Budget: within configured limits"
- used = metadata.get("used") or {}
- limit = metadata.get("exhausted_limit") or "budget"
- value = used.get({"agent_tokens": "agent_tokens", "judge_calls": "judge_calls", "cost": "cost_usd"}.get(limit, ""))
- cap = (metadata.get("limits") or {}).get(
- {"agent_tokens": "max_agent_tokens", "judge_calls": "max_judge_calls", "cost": "max_cost_usd"}.get(limit, "")
- )
- shown = (
- "not measured"
- if value is None or value == "not measured"
- else (f"${value:.2f}" if limit == "cost" else f"{value:,}")
- )
- cap_shown = "not configured" if cap is None else (f"${cap:.2f}" if limit == "cost" else f"{cap:,}")
- planned = metadata.get("planned_attempts")
- not_run = metadata.get("attempts_not_run", len(metadata.get("not_run") or []))
- if limit == "attempts":
- started = metadata.get("started_attempts", 0)
- cap = (metadata.get("limits") or {}).get("max_attempts_total", "not configured")
- return (
- f"Budget exhausted (attempts {started:,} of {cap:,}): "
- f"{not_run:,} of {planned:,} attempts not run; results are partial"
- )
- return (
- f"Budget exhausted ({limit.replace('_', ' ')} {shown} of {cap_shown}): "
- f"{not_run:,} of {planned:,} attempts not run; results are partial"
+ # Recompute from usage and limits: cached observations may be absent or stale.
+ overruns, incomplete, configured = _budget_observations(metadata)
+ observations = "; ".join(
+ f"{_BUDGET_LIMITS[key][1]} {_budget_number(row['used'], cost=key == 'cost_usd')} "
+ f"of {_budget_number(row['limit'], cost=key == 'cost_usd')}"
+ for key, row in overruns.items()
)
+ not_run = _measured_number(metadata.get("attempts_not_run"))
+ if not_run is None:
+ rows = metadata.get("not_run")
+ not_run = len(rows) if isinstance(rows, list) else 0
+ if metadata.get("status") == "exhausted":
+ limit = metadata.get("exhausted_limit")
+ key = {"cost": "cost_usd"}.get(limit, limit) if isinstance(limit, str) else None
+ limit_key, label = _BUDGET_LIMITS.get(key, ("", "budget"))
+ used = metadata.get("used")
+ used = used if isinstance(used, dict) else {}
+ limits = metadata.get("limits")
+ limits = limits if isinstance(limits, dict) else {}
+ value = metadata.get("started_attempts") if key == "attempts" else used.get(key)
+ shown = _budget_number(value, cost=key == "cost_usd")
+ cap = _budget_number(limits.get(limit_key), cost=key == "cost_usd", missing="not configured")
+ line = f"Budget exhausted ({label} {shown} of {cap})"
+ elif observations:
+ line = f"Budget overrun observed ({observations})"
+ elif incomplete:
+ line = "Budget: configured limits not fully verified"
+ else:
+ line = "Budget: within configured limits" if configured else "Budget: no limits configured"
+ if not_run:
+ planned = _budget_number(metadata.get("planned_attempts"), missing="unknown")
+ line += f": {not_run:,} of {planned} attempts not run; results are partial"
+ if observations and metadata.get("status") == "exhausted":
+ line += f"; overrun observed ({observations})"
+ if incomplete:
+ if observations or metadata.get("status") == "exhausted":
+ line += "; configured limits not fully verified"
+ line += f" ({'; '.join(incomplete)})"
+ return line
diff --git a/tests/reporting/test_unified_tier3_report.py b/tests/reporting/test_unified_tier3_report.py
index 3016cd40..6c9b1a2f 100644
--- a/tests/reporting/test_unified_tier3_report.py
+++ b/tests/reporting/test_unified_tier3_report.py
@@ -3834,6 +3834,46 @@ def test_pass_at_k_final_column_has_a_narrow_viewport_scroll_contract() -> None:
assert ".pass-at-k-table { min-width: 720px; }" in html
+ "mode,baseline,expected",
+ [
+ ("skipped", {}, "N/A"),
+ ("skipped", {"attempts_used": 0, "max_attempts_possible": 0}, "N/A"),
+ ("skipped", {"rate": 0.0}, "N/A"),
+ ("fresh", {"attempts_used": 0, "max_attempts_possible": 0}, "N/A"),
+ ("fresh", {"rate": None}, "N/A"),
+ ("fresh", {"rate": 0.0, "passed_cases": 0, "total_cases": 1}, "0%"),
+ ("fresh", {"rate": 1.0, "passed_cases": 1, "total_cases": 1}, "100%"),
+ ],
+)
+def test_supporting_baseline_pass_rate_distinguishes_unavailable_from_observed_zero(mode, baseline, expected):
+ # The retained skipped-baseline result has {}, which the canonical loader
+ # normalizes to zero attempt counters without supplying an observed rate.
+ payload = build_agent_eval_payload(
+ "supporting-pass-rate",
+ {
+ "opencode": {
+ "execution_status": "succeeded",
+ "expected_attempts": 1,
+ "scored_attempts": 1,
+ "with_skill": dict.fromkeys(DEFAULT_METRICS, 1.0),
+ "pass_with_skill": {"rate": 1.0, "passed_cases": 1, "total_cases": 1},
+ "pass_without_skill": baseline,
+ }
+ },
+ run_config={"baseline": {"mode": mode}},
+ use_llm_judge=False,
+ )
+ assert payload is not None
+ html = _render_agent_payload(payload)
+ table = re.search(r'<table class="summary-table pass-at-k-table".*?</table>', html, re.DOTALL)
+ assert table is not None
+ baseline_row = re.search(r"<td>Without skill</td>\s*<td>(.*?)</td>", table.group(), re.DOTALL)
+ assert baseline_row is not None
+ assert baseline_row.group(1).strip() == expected
+ assert baseline.get("rate") == payload["agents"]["opencode"]["pass_at_k"]["without_skill"].get("rate")
+
+
def test_shared_metric_pass_lift_is_labelled_separately_from_arm_rates() -> None:
from skillevaluator.reporting.summary_copy import pass_at_k_summary
from skillevaluator.tier3.harbor.collector import _shared_metric_pass_lift
diff --git a/tests/tier3/test_run_budget.py b/tests/tier3/test_run_budget.py
index e02223ad..3d78a9e3 100644
--- a/tests/tier3/test_run_budget.py
+++ b/tests/tier3/test_run_budget.py
@@ -536,3 +536,170 @@ def test_html_overview_renders_budget_warning():
html = HTMLReporter(include_timestamp=False).render_all([result])
assert "Budget exhausted (agent tokens 1,000 of 1,000): 2 of 3 attempts not run; results are partial" in html
assert 'class="warning"' in html
+
+
+def test_final_attempt_overrun_is_reported_without_changing_admission_status():
+ # Retained A2 shape: all four attempts finished, but no fifth admission
+ # happened to update the admission status after usage exceeded 32,000.
+ budget = BudgetController(max_agent_tokens=32_000, max_judge_calls=12, max_attempts_total=4, planned=4)
+ for attempt, tokens in enumerate([10_000, 10_000, 10_000, 15_236], start=1):
+ assert budget.admit(agent="a", arm="with", case_id="c", attempt=attempt)
+ budget.record_usage({"total_tokens": tokens, "judge_calls": 3})
+
+ metadata = budget.metadata()
+ assert metadata["status"] == "ok"
+ assert metadata["partial"] is False
+ assert metadata["exhausted_limit"] is None
+ assert metadata["attempts_not_run"] == 0
+ assert metadata["observed_overruns"] == {
+ "agent_tokens": {"used": 45_236, "limit": 32_000, "excess": 13_236},
+ }
+ assert budget_line(metadata) == "Budget overrun observed (agent tokens 45,236 of 32,000)"
+
+
[email protected]("cached", [None, {}, {"agent_tokens": {"used": 1, "limit": 0, "excess": 1}}])
+def test_legacy_summary_derives_overruns_from_usage_instead_of_cached_fields(cached):
+ metadata = {
+ "status": "ok",
+ "limits": {"max_agent_tokens": 32_000},
+ "used": {"agent_tokens": 45_236},
+ "observed_overruns": cached,
+ }
+ assert budget_line(metadata) == "Budget overrun observed (agent tokens 45,236 of 32,000)"
+ metadata["used"]["agent_tokens"] = 32_000
+ assert budget_line(metadata) == "Budget: within configured limits"
+
+
[email protected]("cap,used", [(0, 0), (10, 10), (10, 9)])
+def test_measured_usage_at_or_below_cap_has_no_overrun(cap, used):
+ budget = BudgetController(max_agent_tokens=cap)
+ budget.record_usage({"total_tokens": used})
+ assert budget.metadata()["observed_overruns"] == {}
+ assert budget_line(budget.metadata()) == "Budget: within configured limits"
+
+
+def test_multiple_overruns_include_partial_measurements_and_not_run_state():
+ prices = PriceBook({"model": Price(1.0, 2.0)})
+ budget = BudgetController(max_agent_tokens=10, max_judge_calls=1, max_cost_usd=0.01, price_book=prices, planned=3)
+ assert budget.admit(agent="a", arm="with", case_id="c", attempt=1)
+ budget.record_usage({"total_tokens": 12, "judge_calls": 2, "cost_usd": 0.02})
+ budget.record_usage({})
+ assert not budget.admit(agent="a", arm="with", case_id="c", attempt=3)
+ metadata = budget.metadata()
+ assert metadata["observed_overruns"] == {
+ "agent_tokens": {"used": 12, "limit": 10, "excess": 2},
+ "judge_calls": {"used": 2, "limit": 1, "excess": 1},
+ "cost_usd": {"used": 0.02, "limit": 0.01, "excess": 0.01},
+ }
+ line = budget_line(metadata)
+ assert "Budget exhausted (agent tokens 12 of 10): 1 of 3 attempts not run; results are partial" in line
+ assert "overrun observed (agent tokens 12 of 10; judge calls 2 of 1; cost $0.02 of $0.01)" in line
+ assert "usage partially measured" in line
+
+
[email protected]("usage", [None, {}, {"total_tokens": 5}])
+def test_bounded_unmeasured_or_partial_usage_is_not_claimed_within_limits(usage):
+ budget = BudgetController(max_agent_tokens=10)
+ budget.record_usage(usage)
+ budget.record_usage({})
+ line = budget_line(budget.metadata())
+ assert "within configured limits" not in line
+ assert "not fully verified" in line
+ assert ("partially measured" if usage else "not measured") in line
+
+
+def test_unconfigured_usage_does_not_imply_a_budget_verification():
+ budget = BudgetController()
+ budget.record_usage({"total_tokens": 100})
+ assert budget.metadata()["observed_overruns"] == {}
+ assert budget_line(budget.metadata()) == "Budget: no limits configured"
+
+
+ "key,cap,value,expected",
+ [
+ ("agent_tokens", 0, 1, "agent tokens 1 of 0"),
+ ("judge_calls", 0, 1, "judge calls 1 of 0"),
+ ("cost_usd", 0.00001, 0.00002, "cost $2e-05 of $1e-05"),
+ ("attempts", 1, 2, "attempts 2 of 1"),
+ ],
+)
+def test_legacy_overrun_boundaries_include_zero_and_subcent_costs(key, cap, value, expected):
+ limit = {
+ "agent_tokens": "max_agent_tokens",
+ "judge_calls": "max_judge_calls",
+ "cost_usd": "max_cost_usd",
+ "attempts": "max_attempts_total",
+ }[key]
+ metadata = {"limits": {limit: cap}, "used": {key: value}, "started_attempts": value}
+ assert budget_line(metadata) == f"Budget overrun observed ({expected})"
+
+
[email protected]("invalid", [True, False, -1, "[bold]bad[/bold]", float("nan"), float("inf"), [], {}])
[email protected]("field", ["used", "limits", "unmeasured_attempts"])
+def test_malformed_bounded_metadata_never_claims_verified_usage_or_breaks_rich(invalid, field):
+ metadata = {"limits": {"max_agent_tokens": 10}, "used": {"agent_tokens": 5}}
+ metadata[field] = {"max_agent_tokens" if field == "limits" else "agent_tokens": invalid}
+ line = budget_line(metadata)
+ output = Console(record=True, force_terminal=False)
+ output.print(line)
+ assert "within configured limits" not in output.export_text()
+ assert "not fully verified" in line
+
+
[email protected]("invalid", [None, True, float("inf"), "[bold]bad[/bold]", []])
+def test_sparse_or_malformed_exhausted_metadata_is_safe_to_render(invalid):
+ metadata = {
+ "status": "exhausted",
+ "exhausted_limit": invalid,
+ "limits": invalid,
+ "used": invalid,
+ "planned_attempts": invalid,
+ "attempts_not_run": invalid,
+ }
+ output = Console(record=True, force_terminal=False)
+ output.print(budget_line(metadata))
+ assert "Budget exhausted" in output.export_text()
+ assert "[bold]" not in output.export_text()
+ assert "results are partial" not in output.export_text()
+
+
[email protected]("legacy", [False, True])
+def test_completed_budget_overrun_reaches_terminal_html_and_json_summary(legacy):
+ from skillevaluator.evaluation.tier3_report import build_agent_eval_payload
+ from skillevaluator.models.result import ValidationResult
+ from skillevaluator.reporting import HTMLReporter, JSONReporter
+ from skillevaluator.tier3.harbor.metrics import DEFAULT_METRICS
+ from skillevaluator.tier3.result_display import render_evaluation_result
+
+ budget = BudgetController(max_agent_tokens=32_000, planned=4)
+ budget.record_usage({"total_tokens": 45_236})
+ metadata = budget.metadata()
+ if legacy:
+ metadata.pop("observed_overruns", None)
+ payload = build_agent_eval_payload(
+ "budget-fixture",
+ {
+ "a": {
+ "execution_status": "succeeded",
+ "expected_attempts": 1,
+ "scored_attempts": 1,
+ "with_skill": dict.fromkeys(DEFAULT_METRICS, 1.0),
+ }
+ },
+ run_config={"budget": metadata},
+ use_llm_judge=False,
+ )
+ assert payload is not None
+ expected = "Budget overrun observed (agent tokens 45,236 of 32,000)"
+ assert payload["budget_summary"] == expected
+ assert payload["summary"]["execution_status"] == "succeeded"
+ result = ValidationResult(validator_name="AGENT_EVAL", validator_description="Live evaluation")
+ result.metadata["agent_eval"] = payload
+ html = HTMLReporter(include_timestamp=False).render_all([result])
+ assert f'<p class="warning">{expected}</p>' in html
+ report = json.loads(JSONReporter(include_timestamp=False).render_all([result]))
+ assert report["tier3"]["budget_summary"] == expected
+ output = Console(record=True, force_terminal=False, width=160)
+ render_evaluation_result({"execution_status": "succeeded", "budget": metadata}, console=output)
+ assert expected in output.export_text()