Skip to content

feat(tier3): reuse a compatible retained no-skill baseline - #384

Merged
chrisknvidia merged 15 commits into
mainfrom
feat/christopherk/reuse-baseline
Nov 10, 2026
Merged

chrisknvidia merged 15 commits into
mainfrom
feat/christopherk/reuse-baseline

Conversation

@chrisknvidia

Copy link
Copy Markdown
Collaborator

Summary

Adds skillevaluator tier3 evaluate --reuse-baseline RUN|latest so a skill author iterating on a skill can run only the with-skill arm against a retained no-skill baseline, instead of paying for the baseline arm on every iteration.

  • Compatibility (tier3/baseline_store.py): a comparison identity is derived from run_config.json and the result — dataset digest and case ids, agents and resolved models/sources, environment settings and resources, task source, judge/provider, grading mode, workspace/repository-context settings, attempt policy, score policy and evaluator version. Unknown run_config fields count as relevant by default; only an explicit allowlist (concurrency, job retention, credential validation, provenance fields) is ignored. Skill content/revision is kept as a separate part of the identity and is not part of baseline compatibility.
  • Eligibility: the source must be a completed run under the current result contract, with a freshly executed (not itself reused) without-skill arm that succeeded with full case/attempt coverage, no job/trial/runtime failures, and readable persisted rows. Partial, failed, missing or corrupt evidence is rejected with a reason; nothing is converted to zero.
  • Flow: selection happens after model resolution and before any agent job runs. An incompatible explicit run id fails before execution with every reason; latest searches newest first and falls back to a fresh baseline, recording bounded rejection diagnostics. Reused rows go through the same aggregation, lift, custom lift, pass@k and security-attribution code as fresh rows, and are copied into the new run.
  • Provenance: result.json gains baseline (fresh / reused / skipped, source run id, timestamp, dir and identity, rejected candidates), comparison_identity, and per-agent execution_counts and measured_usage that keep fresh and reused trials/tokens separate. Terminal, Markdown, HTML and benchmark reports show one Baseline: ... line.
  • Saved reward.json rows now carry a small baseline_evidence envelope with the case/attempt annotations needed to re-pair them. Runs written before this change are therefore not reuse sources (rejected with a reason).

Known limitation: the without-skill task tree is still staged on a reuse run (it is not executed).

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests (tests/test_baseline_store.py: identity/mismatch reasons for changed cases, model, environment, scorer and attempt policy; partial/failed/missing/corrupt/reused-source rejection; reuse lift equal to a fresh pair; CLI mutual exclusion; fake-Harbor runner fresh → reuse → rejection)
  • Updated documentation for user-visible changes
  • Ran make lint
  • Ran make test (full suite; remaining failures are environment-only git-origin/merge-ref and same-inode tests that also fail on a clean main checkout here)
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

Live check with a real OpenCode agent (local env mode, one small arithmetic case): a fresh/fresh run; a --reuse-baseline latest run that executed only the with-skill trial and reported Skill Lift with execution_counts.fresh.without_skill = 0, reused.without_skill = 1; an explicit reuse with --n-attempts 2 refused before execution (attempt policy changed: ...); and latest with --n-attempts 2 falling back to a fresh baseline with the rejected candidate recorded.

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

Add tier3 evaluate --reuse-baseline RUN|latest. A retained run's fresh
without-skill rows are reused only when the dataset, cases, agents and
models, environment, judge/scorer, attempt policy and evaluator version
match; otherwise an explicit run id is refused before execution and
latest falls back to a fresh baseline with recorded rejection reasons.
Reused rows go through the same aggregation and lift pipeline as fresh
rows, and results record baseline provenance plus fresh versus reused
execution counts and measured usage.

Signed-off-by: Christopher Kevin <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: 9 findings (0 P1, 4 P2, 5 P3); 9 posted inline.

Checked the comparison identity and mismatch reasons, source eligibility, latest selection and fallback, the reused-row path through collection, execution_counts/measured_usage, the CLI and tier3 PATH flag checks, and the report lines, with probes built on the PR's fake-Harbor runner harness and real task generation, plus cross-version runs that wrote a source with main and reused it with this head.
Tests run at 4379999: tests/test_baseline_store.py (24 passed); the collector, skill-activation, judge-lift, max-cases and unscored-grading suites (456 passed, 4 skipped); the config-key parity, evaluation service, compare, result display, publication/benchmark gate, results location, runner status/artifacts, reporting and cli suites (3334 passed, 6 skipped); tier3 skip-with-skill, workflow and progress suites (229 passed).
Merge with main: one import-line conflict in src/skillevaluator/reporting/html.py (main's recorded_evaluated_source next to this PR's baseline_description; keep both).
Conflicts with other open PRs: src/skillevaluator/evaluation/options.py and CHANGELOG.md with #225 (both add a field after max_cases); CHANGELOG.md only with #372, #374, #375, #377, #378, #381-383 and #385. #387 and #388 are stacked on this branch: merge this PR first, then rebase both.
Overlap with #225: on --backend nemo-gym, --reuse-baseline is silently dropped. Overlap with #376: its "Baseline in this run: Yes" column is misleading for a baseline reused from an earlier run.

Comment thread src/skillevaluator/cli.py Resolved
Comment thread src/skillevaluator/reporting/cli.py Resolved
Signed-off-by: Christopher Kevin <[email protected]>
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Evaluation run

SkillEvaluator CI results

Required gate: Skipped

Only Tier 1 blocks CI; Tier 2 and Tier 3 are advisory.

Skill Tier 1: Static and Security Validation Tier 2: Deduplication Tier 3: Live Agent Evaluation Report
No skills evaluated SKIPPED · issues unknown · No selected skills changed; Tier 1 evaluation did not run. INCOMPLETE · issues unknown · The tier did not produce retained evidence; inspect its failed or cancelled CI job. INCOMPLETE · issues unknown · The tier did not produce retained evidence; inspect its failed or cancelled CI job. Report

Commit: d488f1a60067e00f36bb80ec39c7aa7be3fac043 · Environment: docker

…se-baseline

Signed-off-by: Christopher Kevin <[email protected]>

# Conflicts:
#	CHANGELOG.md
…se-baseline

Signed-off-by: Christopher Kevin <[email protected]>

# Conflicts:
#	CHANGELOG.md
…se-baseline

Signed-off-by: Christopher Kevin <[email protected]>

# Conflicts:
#	CHANGELOG.md
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
@chrisknvidia
chrisknvidia merged commit 01b1e63 into main Nov 10, 2026
22 checks passed
@chrisknvidia
chrisknvidia deleted the feat/christopherk/reuse-baseline branch November 10, 2026 13:25
rng1995 added a commit that referenced this pull request Nov 11, 2026
Main's --reuse-baseline (#384) copies the reused run's baseline
reward.json, trajectory.json and result.json files into the new run, so
token_usage counted their tokens as this run's baseline usage. When the
run config records a reused baseline, token_usage now carries
baseline_reused: true, and every token usage table (validate and
tier3 evaluate terminal output, the Markdown report, BENCHMARK.md and
the HTML report) says that the baseline tokens were used in the earlier
run, not in this one. Sums and the change stay as they were: the copied
rows are measurements like any other.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995 added a commit that referenced this pull request Nov 12, 2026
* feat(tier3): add token usage accounting per case, agent and run

New skillevaluator.tier3.token_usage sums each attempt's token counters
per case, per agent arm and over all agents, with coverage. Cached
tokens are part of the prompt and are never added again. Missing or
invalid counters add nothing and leave the arm partial; nothing is
estimated. Attempts that failed before scoring count as unscored usage.
A change needs complete counts for the same attempts in both arms and
no failed arm. It is a measurement only and changes no score.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(tier3): keep the token usage of attempts that scores never read

The report loader skipped attempts without a usable reward.json and
cleared the rewards of an arm whose scores it withholds, so their tokens
were lost. It now keeps, per arm, usage_only_attempts: the trajectory
token counters of each unscored attempt and of each scored attempt of a
failed or unknown arm. Scores, pass@k, rewards_complete and resource
totals do not read them.

The token usage module counts these attempts, matches an unscored
attempt's trial-name prefix to its case (Harbor cuts task names to 32
characters), and adds recovered timeout attempts to the expected count.
It also gains helpers to drop per-case rows and to keep only the agent
sums.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(reporting): add token_usage to the canonical Tier 3 payload

build_agent_eval_payload adds a token_usage object (per agent arm, per
case and over all agents) when any attempt has token counts. The
payload budget drops its per-case rows together with the trials they
summarize. The Tier 3 report step also records the per-agent sums in
the run result for the terminal summary. resources keeps its own
complete-only totals.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(reporting): show Tier 3 token usage in every report

New reporting/tier3_token_usage.py turns the token_usage payload into
table rows that every report shares, so the numbers and wording match:

- BENCHMARK.md: a Token Usage section after Results at a Glance, with
  agent and all-agent rows, notes on why a change is missing, and the
  first 50 case rows in a collapsed table.
- Markdown report: the same table under the Tier 3 section.
- HTML report: a table of every case under Measured Agent Resources.
- Terminal: the full validate report and tier3 evaluate --verbose print
  the agent rows.

Each table says the numbers are measured and not scored. Case and agent
names are escaped for each format.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): document Tier 3 token usage

Describe the token_usage payload, its coverage and change rules, and
where each report shows it. Add a CHANGELOG entry under Unreleased >
Added and a test that keeps the docs and the entry in step with the
payload fields.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(reporting): import the token usage table where the Markdown report uses it

Open pull requests add their own imports right below the run_status
import of markdown.py. Importing inside the Tier 3 block leaves that
line alone, so those branches merge without a conflict.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say where Tier 3 token usage case rows beyond the table are

BENCHMARK.md and the Markdown report now point at the JSON payload's
token_usage for case rows past the first 50. The HTML report bounds its
Tier 3 lists for large payloads, so the docs say it shows at most 64
case rows per agent then, and that the payload keeps every case unless
the size budget drops them with the trials.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(tier3): define the usage loader helpers next to load_agent_data

A sibling branch adds its own helper right after
_trajectory_token_counter. Keeping the usage helpers just above
load_agent_data leaves that spot alone, so both branches merge cleanly.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reporting): say the JSON payload keeps every token usage case row

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say BENCHMARK.md shows the first 50 token usage case rows

The cap counts case rows across all agents, not cases.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): attribute unscored token usage to its case and withhold unsafe changes

An attempt without a usable reward now takes its case from the task
directory its copied Harbor result.json or config.json names. Without
those files it uses the trial name before Harbor's "__<id>" suffix
(rsplit, since a case ID may contain "__"), then a stop-on-pass trial
name (...-<with|without>-<case>-attemptNNN__...), then Harbor's
32-character cut. A case such as auth__login no longer gets a phantom
"auth" row, and a timed-out stop-on-pass attempt no longer adds a row
named after its job.

A change also needs both arms to have succeeded: an arm that ran with an
unrecognized run status, whose scores the report withholds, now blocks it
with <arm>_status_unknown. A sum above 2**53 - 1 is unavailable with
total_out_of_range and null totals, and blocks the change with
<arm>_total_out_of_range, instead of turning null after the payload is
sanitized while its status still said complete.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): add token usage after the report budget so it never displaces score evidence

Token usage used to join the payload before the size budget, which only
measured bytes and dropped its case rows only in the stage that also
drops every trial. Its case rows (about 45 JSON values each per agent)
could push a run that is valid on main past the 100,000-node report
limit, so a PASS run read as Tier 3 Incomplete in the HTML report and
BENCHMARK.md. Under the byte budget they also cost the non-best agents'
details and, for large runs, the best agent's trials.

The budget now runs on the payload without token usage, exactly as on
main. Token usage is added afterwards only while the payload stays within
the embedded size budget and passes agent_eval_report_serialization_issue.
Otherwise its case rows go first (token_usage.case_rows_omitted and
report_truncation.omitted.token_usage_case_rows), then the sums
(report_truncation.omitted.token_usage). If even that record does not
fit, the payload stays exactly as the budget left it. Read-only payloads
(enforce_embedded_size=False) keep everything, as before.

Dashboards treat the two new omission keys as diagnostics, so dropped
token rows never mark trial coverage truncated. Main's retained-run
dashboard test now sizes its budget from the payload without token
usage, which keeps its intent: only the non-best agent's details go.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(reporting): read the HTML token table from the full Tier 3 data

The HTML token table read the bounded Tier 3 preview. Above 256 KiB the
preview walk spends its character budget in key order and reaches
token_usage last, so it blanked coverage.status, delta.status and
entry_id: complete rows printed "(partial)", changes printed N/A, and
case rows were named "unknown".

The table now reads the full display payload, like the steps-by-case
chart, and shows at most 64 case rows per agent with a line that says how
many more are in the JSON payload. (This supersedes the "a table of every
case" wording in 2db3fa8.) The bounded preview leaves token_usage out, so
token rows can neither trigger the preview nor spend its budget.

When the payload dropped the case rows to stay within its limits, the
HTML table, the Markdown report, BENCHMARK.md and the terminal say how
many. The terminal names the files that hold the case rows for each
command: the HTML, Markdown and JSON reports for validate, and
report.html and tier3-benchmark.md in the run directory for
tier3 evaluate. BENCHMARK.md is not one of them.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): document how Tier 3 token usage stays within the report limits

docs/reports.mdx now says that token usage joins the payload after the
size budget and never displaces score evidence, which fields record
dropped case rows or sums, that a change needs both arms to have
succeeded (baseline_status_unknown), that a sum above 2^53 - 1 is
total_out_of_range, where an unscored attempt's case comes from, that
the HTML table reads the full data with at most 64 case rows per agent,
and which files each terminal command points to. The CHANGELOG entry and
the docs test follow.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(reporting): leave token usage out inside the bounded preview function

The preview call in HTMLReporter.render_all is back to main's single
line, and _bounded_tier3_preview itself drops token_usage before it
measures the payload. The behavior is the same; the call line stays free
for the open PR that adds lines right after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): keep token usage within the report limits after later payload writes

Token usage filled the payload up to the report limits when it was built.
Two steps then write to the same payload: the tier3 evaluate report step adds
its case findings, and validate adds its applicability fields. Either could
push a payload with token usage past the 100,000-value limit, so a passing
run read as Tier 3 Incomplete although the same run passes without token
usage.

fit_token_usage now runs after the build and again after each of those
writes. It drops the token case rows, then the sums, and records each drop
in report_truncation. If even that record does not fit, it removes the token
usage and its records, which leaves the payload as it is without token usage.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): show token usage of a baseline that did not run as not run

A run with no baseline arm for an agent reads as baseline not run in the
score tables. Its token usage said baseline 0/0, "Baseline token counts
cover 0 of 0 attempts", "baseline status unknown" and "The arms ran
different cases", three reasons for one cause.

An arm without attempts is now not_run when the payload mode leaves it out
(with_skill_only or baseline_only) or the agent has no record of it. An
arm without attempts no longer gets a status-unknown reason, and its
incomplete reason says that no attempts were recorded. A case scope
mismatch needs attempts in both arms.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say when Tier 3 token usage is left out without a record

The Token usage section said token_usage appears whenever an attempt
recorded token counts, and that a drop is recorded in report_truncation.
When the payload cannot carry even that record, for example because it
already exceeds the report limits without token usage, token_usage is left
out without a record. The section now says so.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(reporting): read the Tier 3 verdict from the HTML hero chip

The case findings regression test read the verdict after the hidden
"Tier 3 verdict:" label, which only some template versions carry. It now
reads the hero's verdict chip, incomplete reason and score, so it does not
depend on that label.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(tier3): keep token usage within the report limits after main's next steps

Main now adds the run's next steps to a built Tier 3 payload: the loader
reads them from the run's result.json, and the report step adds them with
its case findings. Both writes happen before fit_token_usage runs in the
report step and in validate, so no code change is needed. The validate
test now also runs with a result.json whose next steps push the payload
past the node limit after the build, and the report step test checks
that its payload carries next steps. The docs and CHANGELOG name the next
steps among the later writes.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(tier3): label a reused baseline's token usage

Main's --reuse-baseline (#384) copies the reused run's baseline
reward.json, trajectory.json and result.json files into the new run, so
token_usage counted their tokens as this run's baseline usage. When the
run config records a reused baseline, token_usage now carries
baseline_reused: true, and every token usage table (validate and
tier3 evaluate terminal output, the Markdown report, BENCHMARK.md and
the HTML report) says that the baseline tokens were used in the earlier
run, not in this one. Sums and the change stay as they were: the copied
rows are measurements like any other.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): reject invalid cache counters in usage-only attempts

Signed-off-by: Narendran Raghavan <[email protected]>

---------

Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
rng1995 added a commit that referenced this pull request Nov 12, 2026
…t run (#407)

* fix(reporting): describe a failed Tier 3 arm as incomplete, not as not run

When one attempt of an agent's no-skill baseline fails, for example on the
agent timeout, the baseline arm fails while the with-skill arm keeps its
scores. BENCHMARK.md then printed "baseline not run; uplift unavailable"
for a baseline that ran, and no report said which arm was missing.

- The canonical payload gains coverage_notices: one entry per arm whose
  recorded execution_status is failed, with its scored and expected
  attempts, the first Harbor exception type in words, and a message.
- BENCHMARK.md cells read "baseline incomplete (s of e attempts scored)"
  or "baseline unavailable" when nothing scored; a skipped baseline still
  reads "baseline not run". An Agent coverage list under the table names
  each failed arm, and the Tier 3 evidence cell names the agent and arm.
- The HTML report shows the notices under Agent coverage notes, and the
  terminal prints them in the Tier 3 block.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): document incomplete Tier 3 arms and coverage notices

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(reporting): keep Tier 3 coverage notes whole and visible in every report

- HTML: the display sanitizer keeps only coverage notices that are objects
  with a non-empty message, so a malformed `coverage_notices` value (a
  number, a boolean, a single object) no longer breaks the report. The key
  is walked right after `execution_status`, so the bounded preview of a
  payload above 256 KiB keeps every message whole instead of cutting it to
  an empty bullet. The template also drops empty messages.
- Terminal: `validate` runs Tier 3 non-blocking by default, and a failed
  non-blocking result has errors but no findings, so its Tier 3 block was
  never printed. A non-blocking result that carries coverage notes is now
  rendered with the non-blocking findings, so the notes show without
  `--block-on-agent-eval`.
- First failure: an acronym keeps its trailing digits
  (`S3UploadFailedError` gives `s3 upload failed error`, `HTTP2Error` gives
  `http2 error`), and the collector's case-coverage diagnostics, which list
  case IDs, are skipped so a case ID shaped like an exception type is never
  named as the failure.
- The notice code is `baseline_failed` or `with_skill_failed`: the arm whose
  recorded status is `failed`, distinct from any notice for an agent that
  stays scored. When the agent itself is marked failed, the message says the
  agent and the Tier 3 run are marked failed.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): list the coverage notice fields and where they print

Document each `coverage_notices` field, including `code` and the null
counts with state `failed` when an arm's counters are unusable, the
`baseline failed` cell, and that `validate` prints the notes also when
Tier 3 is non-blocking.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say that only the full terminal report prints coverage notes

A plain `validate` shows the compact pipeline view and drops the `cli`
reporter, so the Tier 3 coverage notes print only with `validate --verbose`
or an explicit `-r cli`. The docs and the CHANGELOG entry said `validate`
prints them. They now say the compact default view leaves them to the HTML
and JSON reports and `BENCHMARK.md`. A new test pins that behavior and the
wording.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say that HTML agent details label a failed baseline as missing

An agent whose baseline arm ran and failed gets the same per-agent HTML
labels as a skipped baseline: `no baseline` and `baseline N/A`. Only the
Agent coverage notes callout tells the two apart. The **no baseline**
definition now covers a failed baseline arm and points to the callout, and
the callout paragraph names the shared labels. A new test pins the labels,
the callout and the wording. The labels themselves are unchanged.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(reporting): read only the score rows of Results at a Glance

Main now adds Required checks passed, Goals met and Security clean rows
to the BENCHMARK.md Results at a Glance table. They compare counts, not a
baseline score, and read N/A for a failed baseline arm. The incomplete-arm
tests now read only the Overall and dimension rows, and the reports guide
says those are the cells that name an incomplete baseline.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(reporting): pin where the terminal prints non-blocking coverage notes

Main now prints the agent tables of a Tier 3 result that is in neither
the Failure Details nor the Non-blocking Findings section, so the notes
of a non-blocking failed result would print even without this branch's
wider non-blocking condition, as a bare table above both sections. The
test now checks that the notes print once, under Non-blocking Findings,
with the result's errors. It fails if that condition is dropped.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(tier3): report token usage per case and agent (#427)

* feat(tier3): add token usage accounting per case, agent and run

New skillevaluator.tier3.token_usage sums each attempt's token counters
per case, per agent arm and over all agents, with coverage. Cached
tokens are part of the prompt and are never added again. Missing or
invalid counters add nothing and leave the arm partial; nothing is
estimated. Attempts that failed before scoring count as unscored usage.
A change needs complete counts for the same attempts in both arms and
no failed arm. It is a measurement only and changes no score.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(tier3): keep the token usage of attempts that scores never read

The report loader skipped attempts without a usable reward.json and
cleared the rewards of an arm whose scores it withholds, so their tokens
were lost. It now keeps, per arm, usage_only_attempts: the trajectory
token counters of each unscored attempt and of each scored attempt of a
failed or unknown arm. Scores, pass@k, rewards_complete and resource
totals do not read them.

The token usage module counts these attempts, matches an unscored
attempt's trial-name prefix to its case (Harbor cuts task names to 32
characters), and adds recovered timeout attempts to the expected count.
It also gains helpers to drop per-case rows and to keep only the agent
sums.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(reporting): add token_usage to the canonical Tier 3 payload

build_agent_eval_payload adds a token_usage object (per agent arm, per
case and over all agents) when any attempt has token counts. The
payload budget drops its per-case rows together with the trials they
summarize. The Tier 3 report step also records the per-agent sums in
the run result for the terminal summary. resources keeps its own
complete-only totals.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(reporting): show Tier 3 token usage in every report

New reporting/tier3_token_usage.py turns the token_usage payload into
table rows that every report shares, so the numbers and wording match:

- BENCHMARK.md: a Token Usage section after Results at a Glance, with
  agent and all-agent rows, notes on why a change is missing, and the
  first 50 case rows in a collapsed table.
- Markdown report: the same table under the Tier 3 section.
- HTML report: a table of every case under Measured Agent Resources.
- Terminal: the full validate report and tier3 evaluate --verbose print
  the agent rows.

Each table says the numbers are measured and not scored. Case and agent
names are escaped for each format.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): document Tier 3 token usage

Describe the token_usage payload, its coverage and change rules, and
where each report shows it. Add a CHANGELOG entry under Unreleased >
Added and a test that keeps the docs and the entry in step with the
payload fields.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(reporting): import the token usage table where the Markdown report uses it

Open pull requests add their own imports right below the run_status
import of markdown.py. Importing inside the Tier 3 block leaves that
line alone, so those branches merge without a conflict.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say where Tier 3 token usage case rows beyond the table are

BENCHMARK.md and the Markdown report now point at the JSON payload's
token_usage for case rows past the first 50. The HTML report bounds its
Tier 3 lists for large payloads, so the docs say it shows at most 64
case rows per agent then, and that the payload keeps every case unless
the size budget drops them with the trials.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(tier3): define the usage loader helpers next to load_agent_data

A sibling branch adds its own helper right after
_trajectory_token_counter. Keeping the usage helpers just above
load_agent_data leaves that spot alone, so both branches merge cleanly.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reporting): say the JSON payload keeps every token usage case row

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say BENCHMARK.md shows the first 50 token usage case rows

The cap counts case rows across all agents, not cases.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): attribute unscored token usage to its case and withhold unsafe changes

An attempt without a usable reward now takes its case from the task
directory its copied Harbor result.json or config.json names. Without
those files it uses the trial name before Harbor's "__<id>" suffix
(rsplit, since a case ID may contain "__"), then a stop-on-pass trial
name (...-<with|without>-<case>-attemptNNN__...), then Harbor's
32-character cut. A case such as auth__login no longer gets a phantom
"auth" row, and a timed-out stop-on-pass attempt no longer adds a row
named after its job.

A change also needs both arms to have succeeded: an arm that ran with an
unrecognized run status, whose scores the report withholds, now blocks it
with <arm>_status_unknown. A sum above 2**53 - 1 is unavailable with
total_out_of_range and null totals, and blocks the change with
<arm>_total_out_of_range, instead of turning null after the payload is
sanitized while its status still said complete.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): add token usage after the report budget so it never displaces score evidence

Token usage used to join the payload before the size budget, which only
measured bytes and dropped its case rows only in the stage that also
drops every trial. Its case rows (about 45 JSON values each per agent)
could push a run that is valid on main past the 100,000-node report
limit, so a PASS run read as Tier 3 Incomplete in the HTML report and
BENCHMARK.md. Under the byte budget they also cost the non-best agents'
details and, for large runs, the best agent's trials.

The budget now runs on the payload without token usage, exactly as on
main. Token usage is added afterwards only while the payload stays within
the embedded size budget and passes agent_eval_report_serialization_issue.
Otherwise its case rows go first (token_usage.case_rows_omitted and
report_truncation.omitted.token_usage_case_rows), then the sums
(report_truncation.omitted.token_usage). If even that record does not
fit, the payload stays exactly as the budget left it. Read-only payloads
(enforce_embedded_size=False) keep everything, as before.

Dashboards treat the two new omission keys as diagnostics, so dropped
token rows never mark trial coverage truncated. Main's retained-run
dashboard test now sizes its budget from the payload without token
usage, which keeps its intent: only the non-best agent's details go.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(reporting): read the HTML token table from the full Tier 3 data

The HTML token table read the bounded Tier 3 preview. Above 256 KiB the
preview walk spends its character budget in key order and reaches
token_usage last, so it blanked coverage.status, delta.status and
entry_id: complete rows printed "(partial)", changes printed N/A, and
case rows were named "unknown".

The table now reads the full display payload, like the steps-by-case
chart, and shows at most 64 case rows per agent with a line that says how
many more are in the JSON payload. (This supersedes the "a table of every
case" wording in 2db3fa8.) The bounded preview leaves token_usage out, so
token rows can neither trigger the preview nor spend its budget.

When the payload dropped the case rows to stay within its limits, the
HTML table, the Markdown report, BENCHMARK.md and the terminal say how
many. The terminal names the files that hold the case rows for each
command: the HTML, Markdown and JSON reports for validate, and
report.html and tier3-benchmark.md in the run directory for
tier3 evaluate. BENCHMARK.md is not one of them.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): document how Tier 3 token usage stays within the report limits

docs/reports.mdx now says that token usage joins the payload after the
size budget and never displaces score evidence, which fields record
dropped case rows or sums, that a change needs both arms to have
succeeded (baseline_status_unknown), that a sum above 2^53 - 1 is
total_out_of_range, where an unscored attempt's case comes from, that
the HTML table reads the full data with at most 64 case rows per agent,
and which files each terminal command points to. The CHANGELOG entry and
the docs test follow.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(reporting): leave token usage out inside the bounded preview function

The preview call in HTMLReporter.render_all is back to main's single
line, and _bounded_tier3_preview itself drops token_usage before it
measures the payload. The behavior is the same; the call line stays free
for the open PR that adds lines right after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): keep token usage within the report limits after later payload writes

Token usage filled the payload up to the report limits when it was built.
Two steps then write to the same payload: the tier3 evaluate report step adds
its case findings, and validate adds its applicability fields. Either could
push a payload with token usage past the 100,000-value limit, so a passing
run read as Tier 3 Incomplete although the same run passes without token
usage.

fit_token_usage now runs after the build and again after each of those
writes. It drops the token case rows, then the sums, and records each drop
in report_truncation. If even that record does not fit, it removes the token
usage and its records, which leaves the payload as it is without token usage.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): show token usage of a baseline that did not run as not run

A run with no baseline arm for an agent reads as baseline not run in the
score tables. Its token usage said baseline 0/0, "Baseline token counts
cover 0 of 0 attempts", "baseline status unknown" and "The arms ran
different cases", three reasons for one cause.

An arm without attempts is now not_run when the payload mode leaves it out
(with_skill_only or baseline_only) or the agent has no record of it. An
arm without attempts no longer gets a status-unknown reason, and its
incomplete reason says that no attempts were recorded. A case scope
mismatch needs attempts in both arms.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(reports): say when Tier 3 token usage is left out without a record

The Token usage section said token_usage appears whenever an attempt
recorded token counts, and that a drop is recorded in report_truncation.
When the payload cannot carry even that record, for example because it
already exceeds the report limits without token usage, token_usage is left
out without a record. The section now says so.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(reporting): read the Tier 3 verdict from the HTML hero chip

The case findings regression test read the verdict after the hidden
"Tier 3 verdict:" label, which only some template versions carry. It now
reads the hero's verdict chip, incomplete reason and score, so it does not
depend on that label.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(tier3): keep token usage within the report limits after main's next steps

Main now adds the run's next steps to a built Tier 3 payload: the loader
reads them from the run's result.json, and the report step adds them with
its case findings. Both writes happen before fit_token_usage runs in the
report step and in validate, so no code change is needed. The validate
test now also runs with a result.json whose next steps push the payload
past the node limit after the build, and the report step test checks
that its payload carries next steps. The docs and CHANGELOG name the next
steps among the later writes.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(tier3): label a reused baseline's token usage

Main's --reuse-baseline (#384) copies the reused run's baseline
reward.json, trajectory.json and result.json files into the new run, so
token_usage counted their tokens as this run's baseline usage. When the
run config records a reused baseline, token_usage now carries
baseline_reused: true, and every token usage table (validate and
tier3 evaluate terminal output, the Markdown report, BENCHMARK.md and
the HTML report) says that the baseline tokens were used in the earlier
run, not in this one. Sums and the change stay as they were: the copied
rows are measurements like any other.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier3): reject invalid cache counters in usage-only attempts

Signed-off-by: Narendran Raghavan <[email protected]>

---------

Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

---------

Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants