Skip to content

fix(tier3): explain failing scores and show baseline trial rows - #305

Merged
rng1995 merged 16 commits into
mainfrom
naren/port-report-grader-reasons-baseline
Nov 5, 2026
Merged

rng1995 merged 16 commits into
mainfrom
naren/port-report-grader-reasons-baseline

Conversation

@rng1995

@rng1995 rng1995 commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Tier 3 HTML reports now say why an evaluator score failed, and the per-evaluator drill-down and steps chart cover both arms instead of only the with-skill trials. Large reports drop these explanations before any other detail.

  • Failure reasons. A new evaluation/tier3_findings.py builds one bounded, redacted reason per failing metric from the grader's details. It joins up to three distinct parts from reason / message, failing findings (including plain-string findings from legacy and custom graders), failing behavior results, failed rubric criteria, failed named checks, and the security attribution_explanation. It also builds a short excerpt from the first failing finding's evidence.
    • Reasons are capped at 240 characters and excerpts at 300.
    • Redaction applies the two steps of the terminal findings report's _bounded_report_reason: _redact_configured_credentials replaces the exact values of configured credential environment variables, and redact_sensitive_text masks credential patterns. redact_secrets_in_log_line runs between them and also covers JWTs.
    • Failed rubric criteria skip the criteria the grader listed in excluded_criteria, through the findings report's _applicable_accuracy_criteria. A case with no expected skill therefore no longer reports SKILL_IDENTIFIED as failed.
    • secret_leak (which stores its detection regex) and secret_exposure (which stores a fixed placeholder) never become excerpts.
    • Lists and nested checks are scanned up to 64 entries, and at most 8 candidate strings are redacted per metric. Whitespace is collapsed and each string is clipped to 16 KiB before redaction. The window is measured after collapsing, so whitespace padding cannot move the cut-off start of a credential into the visible text. The joined reason is clipped before its final redaction pass; its parts are already redacted.
    • The Harbor and judge helpers are imported lazily, as elsewhere in the report builders, so importing tier3_report, reporting.html or the CLI loads the same Tier 3 modules as on main.
  • Drill-down tooltips. _normalize_trials adds score_reasons to each trial in both arms, next to Share trace evidence, applicable scores and security checks #258's not_applicable_metrics. When a logical trial spans several reward rows, the reason comes from the lowest-scoring failing row, not from group[0]. A failing cell gets title="<Metric>: <reason>" and a dotted underline.
    • The payload keeps one copy of each reason: on the flattened top-level trials (with skill) and on agents[*].trials_baseline. agents[*].trials, which the drill-down does not read, drops them after flattening.
  • Evaluator cards.
    • _metric_evidence redacts the grader text it already showed in notes and failures. When the grader recorded no reason, a failing entry gets the built reason in a separate reason field, so notes still holds only grader text and size limits can drop the built text first. The card shows it where the notes would be. Failing scores also get an excerpt, rendered as <code class="t3-ev-excerpt">.
    • A card with fail status opens its per-trial evidence.
    • When attempts of one case disagree, the card shows the reason and excerpt of the lowest-scoring attempt. Before, it kept the first non-empty note.
  • Size limits drop reasons first.
    • Canonical payload: when the payload is over its 2 MiB budget, _enforce_report_payload_budget now removes built reasons and excerpts before any stage main already had (comparison payloads, non-best-agent details, trials, evidence). The count is recorded as failure_reasons under report_truncation.omitted. The dashboard counts that section as a diagnostic, not a trial-coverage loss.
    • HTML preview: when the display payload is over the 256 KiB preview trigger, _bounded_tier3_preview works on a private copy without reasons and excerpts. If that copy fits under the trigger, it renders in full and reasons are put back, in report order, while room remains. Otherwise the bounded walk runs on the copy exactly as on main, without reasons. Either way the reasons never spend the preview budget ahead of the overview keys. The size notice says how many reasons or excerpts were left out, and the embedded canonical payload keeps all of them.
  • Baseline rows in the drill-down.
    • Rows are built per agent: with-skill rows from the top-level trials, then baseline rows from agents[*].trials_baseline.
    • _sanitize_tier3_agent runs public's _sanitize_tier3_trial on agents[*].trials_baseline with fill_defaults=False. Baseline rows therefore get the same render-time bounds as with-skill rows: non-numeric or out-of-range scores, bool or negative steps, negative tokens and non-list warnings render as — instead of failing the report or showing raw values. Optional fields (agent, baseline_scores, lift_scores, warnings, error_recovery) are normalized only when present, so no empty defaults are added to every row. agents[*].trials is left as recorded.
    • The sanitizer keeps score_reasons only as a mapping from metric to non-empty string, keyed like the scores, and a card's reason and excerpt only when they are non-empty strings.
    • A Condition column (With skill / Without skill) is added. The filter counter counts all rows. When the HTML preview capped rows (64 with-skill rows in total, 64 baseline rows per agent), a note under the filter says so.
    • Metric columns include metrics that only baseline rows scored. The section still renders when only baseline rows exist.
    • It is retitled from "With-Skill Per-Evaluator Drill-Down" to "Per-Evaluator Drill-Down".
  • Steps chart per agent and condition.
    • The new reporting/trial_charts.py (steps_by_case_chart) precomputes one series per agent and condition from the same bounded preview the page renders, and html.py passes it to the template. It replaces the inline JS aggregation.
    • A series with no complete measurement is omitted. A case missing from a series, or with any retry lacking step telemetry, is null. Bool, negative, non-finite and overflowing step values are rejected, and the mean is overflow-safe.
    • The chart is retitled "Steps per Eval Case by Agent and Condition".
  • Size notice fix. The existing notice read tier3_preview_notice.items, which Jinja resolves to the dict's items method, so every bounded report printed <built-in method items of dict object at 0x...> items. It now uses subscript lookups.
  • The token chart stays with-skill only, under its existing title. The Measured Agent Resources table already compares token totals across arms.
  • Docs: new "Failure reasons and per-trial rows" section in docs/reports.mdx, including the size-limit behavior. CHANGELOG: Unreleased > Changed (baseline rows and steps chart) and > Fixed (reasons, size notice).

Not in this PR:

Coordination:

  • Reason extractors. Public already has two other readers of grader reasons: tier3/harbor/report._collect_fail_reasons (terminal findings report; metric-aware, all findings, per-finding attribution, attribution_completeness, error_recovery corrections) and feat(tier3): case-first CLI summary and case-based report findings #255's tier3/case_summary._failed_reasons (what_to_fix.json; details[metric]["reason"] below 0.8). This PR keeps its own extractor because the HTML needs one short, bounded, per-trial reason built only from failing entries. It shares _applicable_accuracy_criteria and the redaction steps with the findings report and, like it, reads plain-string findings. A follow-up can make the terminal report and case_summary reuse tier3_findings.failure_reason, so all three explain a failure the same way.
  • PR feat(plugin): Add Plugin evaluation support across all tiers #28 (plugin evaluation, open). No duplicated code, but textual conflicts: feat(plugin): Add Plugin evaluation support across all tiers #28 adds trial_na / na_reason and title="{{ na_reason }}" data-not-applicable on the same drill-down score <td>, inside the {% for trial in tier3.trials %} loop this PR replaces with t3_condition_trial_rows; and it adds trial["not_applicable"] in _normalize_trials where this PR adds score_reasons. The two title attributes do not overlap: the N/A title applies when the score is none and the reason title only when a score is present, so a merge can combine them.
  • PR feat(tier3): add --skip-with-skill for baseline-only runs #284 (--skip-with-skill, open). Also edits tier3_report.py, html.py and the template (hero and evaluator table), so expect textual conflicts. Behavior is complementary: a baseline-only run's drill-down shows its baseline rows and their reasons.
  • Merged PR Share trace evidence, applicable scores and security checks #258 added not_applicable_metrics next to the lines that add score_reasons; both are kept.

Why

  • A failing score came with no explanation. A failing Tier 3 score such as Security 0.00 could render with no explanation. The grader had recorded the reason and the offending command in reward.json, but the report showed neither:
    • The drill-down kept only scores.
    • Cards read only a top-level reason, so graders that write message, findings or criteria showed nothing.
    • No card ever quoted the command.
  • A passing attempt could hide a failing one. In multi-attempt runs, a passing attempt's "No unsafe agent-issued actions..." note hid a failing attempt's reason in the same case.
  • Credentials could reach the HTML. Grader reasons were embedded without credential redaction, so a key that an agent echoed into a judge or grader reason reached the HTML.
  • Baseline trials were missing. The drill-down and steps chart read only with-skill trials. Reviewers could not compare baseline per-evaluator scores, steps or tokens per trial there, and baseline-only cases never appeared.

Kept from public

  • Card evidence pipeline. _metric_evidence keeps its scan limits, report budget, fingerprint deduplication with occurrences, sampling metadata, custom_details precedence (now shared through _metric_detail), failures / checks / evidence_refs, and its 512-character note cap.
  • Card layout. Cards still group per eval case, with counts and average scores. The "lowest-scoring attempt" rule is added to that dedup instead of switching to per-attempt rows, which would have defeated fingerprint dedup and grown the payload.
  • Logical trial grouping. logical_trial_reward_groups and per-row metric sets are respected when choosing a reason.
  • Unavailable telemetry. A partially measured case still has no average, as the old JS steps chart already ensured. Missing steps and tokens still render as —, and the tokens.prompt / completion keys are unchanged.
  • Token chart. It keeps the coverage gate and the non-stacked "Cached (included in prompt)" series.
  • Payload size. main's canonical budget stages and HTML preview limits are unchanged; this PR only puts its own reasons ahead of them. Probe: N trials per arm, 2 of 6 with-skill and 4 of 6 baseline metrics failing on every trial, about 200-character grader messages, display payload through _bounded_tier3_preview:
    • 2 agents x 30: main 131 KB; this PR 238 KB, below the trigger, rendered in full with every reason.
    • 2 agents x 40: main 165 KB; this PR 298 KB. The preview keeps the full overview (best agent, dimension ids, card ids) and every row, puts back as many reasons as fit, and says how many it left out.
    • 3 agents x 60: main 339 KB, preview omits 7,609 characters and 116 items; this PR 613 KB, preview omits the same 7,609 characters and 116 items plus all reasons. The overview is intact in both.
    • The full payload, with every reason, stays embedded for download.
  • Build time. Building reasons redacts grader text for every failing metric of every trial. In a 3-agent x 60-trial run with all six metrics failing on every trial (three 130-character findings each), the payload builds in about 3.5 s (warm) versus 0.07 s on main; nearly all of it is redact_sensitive_text. With 64 findings of 2 KB each per metric it is about 24 s, because each redacted candidate keeps its 16 KiB scan window (see the redaction bullet). Typical runs, with fewer failing metrics and short messages, add well under a second.
  • Trustworthy evidence policy. A payload that _tier3_report_data rejects as untrustworthy (for example, no with-skill score) still renders the fallback stub.

Tests

  • New tests/reporting/test_tier3_failure_reasons.py (23 tests).
    • Card reason, excerpt, open state, and the drill-down tooltip.
    • No reasons without details, and none for passing metrics.
    • Baseline rows carry their own reasons.
    • secret_leak / secret_exposure evidence is not quoted back.
    • Credential redaction across the card, trials and HTML, including a configured credential value with no recognizable shape in both arms (set through monkeypatch).
    • Whitespace padding cannot move a clipped credential prefix into the visible text.
    • Criteria listed in excluded_criteria are not reported as failed.
    • Malformed score_reasons and excerpt values are dropped at render time.
    • Single escaping of markup.
    • A message-only detail puts the built reason in the card's reason field, not notes, and the card shows it.
    • A passing attempt does not hide a failing attempt.
    • Multi-row logical trials.
    • Plain-string findings, the candidate cap, reason dedup after redaction, criteria / named-check / attribution parts, truncation, and the excerpt fallback.
    • Size limits: a 2-agent x 40-trial failing run keeps the preview overview (best agent, dimension ids, every agent's card ids), stays under the trigger, restores part of the reasons, reports the rest in the notice, and leaves the canonical payload complete; a 3-agent x 60-trial run drops every reason before the bounded walk and keeps the best agent; with the canonical budget set between the sizes with and without reasons, only failure_reasons is omitted, agents and trials are otherwise unchanged, and the dashboard does not count it as lost trial coverage.
  • New tests/reporting/test_tier3_baseline_trial_views.py (21 tests).
    • Steps chart: retries averaged per condition, unmeasured series omitted with case gaps kept, partially measured cases left unaveraged, non-counter values rejected, and a finite mean for very large values.
    • Rendered HTML: both condition series, with-skill and baseline rows with the Condition column and counts, missing baseline, baseline rows without with-skill rows, baseline-only metric columns, unavailable baseline telemetry, and legacy trials without an agent.
    • Malformed baseline values (string or out-of-range overall and scores, non-mapping scores, bool or negative steps, negative tokens) render as — while the with-skill row is unchanged.
    • The display sanitizer adds no default fields to baseline rows, bounds non-list warnings, and leaves agents[*].trials as recorded.
  • Updated tests/reporting/test_unified_tier3_report.py for the new titles. The JS partial-telemetry assertion is replaced by a check of the embedded chart data. The escape-heavy preview test now also checks the notice reads "HTML preview omitted N characters." without a method repr.
  • pytest tests/reporting tests/evaluation tests/tier3 tests/test_oss_packaging.py tests/test_ci_change_classifier.py (-n 8): 7,578 passed, 13 failed. All 13 are test_generated_custom_only_script_* in tests/tier3/test_judge_failure_artifacts.py; they run the generated grader under the host's python3 3.9, which rejects int | float, and fail the same way on unmodified main.
  • The 18 other test modules that build or render Tier 3 reports or report truncation (tests/ci/test_native_reports.py, tests/test_harbor_html_report_failures.py, tests/test_publication_evidence.py, tests/test_public_benchmark_gate.py, tests/validators/test_security.py and others): 1,959 passed, 5 skipped.
  • ruff check src tests, and ruff format --check on the changed Python files: clean.
  • scripts/check_oss_boundary.py: passed.
  • Gitleaks v8.30.0 (the CI image and config) on every commit of the branch: no leaks found.

🤖 Generated with Claude Code

A failing Tier 3 evaluator score could render as a bare 0.00. Graders
already record why in reward.json details, but the drill-down kept only
scores, evaluator cards read only a top-level reason and never the
offending command, and when attempts of one case disagreed the card kept
the first non-empty note, so a passing attempt's "no unsafe actions" text
could hide a failing attempt's reason. Grader reasons were also embedded
without credential redaction. The drill-down and steps chart read only
with-skill trials, so baseline per-evaluator scores, steps and tokens
could not be compared there.

Add evaluation/tier3_findings to build one bounded, redacted reason per
failing metric (up to three distinct parts from reason/message, failing
and plain-string findings, failing behavior results, failed criteria
except those the grader excluded, failed checks and the attribution
note) and a short evidence excerpt. Redaction matches the terminal
findings report: configured credential values, then credential patterns.
Secret-detector findings never quote their pattern. Harbor and judge
helpers are imported lazily, so report imports stay as light as before.

Each normalized trial in both arms carries score_reasons, taken from the
lowest-scoring row of a logical trial; failing drill-down cells show it
as a tooltip. Evaluator cards redact grader text, add the built reason
in a separate evidence "reason" field when the grader recorded none, add
the excerpt for failing scores, open when the card fails, and show the
lowest-scoring attempt's reason per case.

Size limits drop these built reasons first. The canonical payload budget
removes them before any existing stage and records failure_reasons
under report_truncation.omitted, which the dashboard treats as a
diagnostic. The HTML preview works on a copy without them, puts them
back only into room left under the preview trigger, and otherwise runs
the existing bounded walk without them, so they never displace the
overview. The size notice now uses subscript lookups; notice.items
resolved to the dict method and printed its repr.

The drill-down lists with-skill and baseline rows with a Condition
column and includes metrics scored only on baseline rows. Baseline rows
get the trial sanitizer's bounds without added default fields;
agents[*].trials, which nothing renders, is left as recorded. Steps per
case are precomputed per agent and condition in reporting/trial_charts;
a case with missing or partial telemetry stays a gap. The token chart
remains with-skill only.

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

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review: 12 findings (0 P1, 2 P2, 10 P3); 12 posted inline.

rng1995 and others added 4 commits November 2, 2026 11:23
Conflicted files: src/skillevaluator/reporting/html.py (imports).

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Card evidence: the built reason and excerpt are no longer part of the
  dedup fingerprint and are built only for new entries, so attempts that
  quote different commands under one grader reason collapse with
  occurrences again instead of filling the card and the evidence budget.
- Card fallback reason leaves out failing behavior results, which the card
  already lists as failures.
- Reason extraction falls back to a finding's type and skips blank
  candidates, so message-less findings cannot exhaust the candidate cap.
- The scan window keeps whole words only (a word cut at its edge is
  dropped) and keeps line breaks through redaction, so a masked
  `key: value` pair ends at its line.
- HTML preview: the unrendered top-level card copy no longer counts as a
  left-out reason; the drill-down row-cap note shows only when trial rows
  were capped and says how many.
- Drill-down adds a column for metrics only baseline rows scored.
- Steps chart is computed from the full display payload, capped at 200
  cases with a note.
- Tests cover the above, failures redaction, glued keys, the rendered
  size notice, and the lowest-scoring reason rule.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also move this PR's CHANGELOG entries back under Unreleased > Fixed; the
merge of main had left them after the new Security subsection.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicted files: CHANGELOG.md (Unreleased > Fixed).

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

@chrisknvidia chrisknvidia 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.

I read the findings builder, the card and drill-down changes, the preview and canonical size handling and the new chart module. The template side is fine: autoescape is on and the chart data goes through tojson. The thing I would fix first is the new excerpt text. It quotes raw agent commands and the shared redactor does not mask password flags, so a credential can reach the published HTML. The earlier comments on the dedup fingerprint and on the steps chart reading the bounded preview matter too.

rng1995 and others added 5 commits November 2, 2026 19:05
Conflicted files: none.

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

Grader excerpts quote raw command lines. Mask curl -u/--user user:pass,
--password/--token style flags with a value, sshpass -p, attached MySQL -pVALUE
and every Cookie header pair before the shared redaction runs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
The curl -u fixture added to the grader reason redaction tests trips the
curl-auth-user rule, and Gitleaks scans the full branch history, so a
later edit cannot clear it. Allow that one value, in that one test file,
for that one rule, and pin the scope of curl-auth-user allowlists.

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

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clean merge of origin/main (f878f99); CHANGELOG.md auto-merged with this
PR's entries kept under Unreleased.

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

@chrisknvidia chrisknvidia 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.

Follow-up on the current head. The masking now covers the cases from my last comment: curl -u/--user, quoted and unquoted --password/--token, attached -pVALUE, sshpass -p and whole Cookie: headers, while mkdir -p and mysql -u root stay intact. A 300-character quoted password is masked too. One small leftover, not blocking: curl's short cookie flag is left in clear (curl -b "session=abcdef123456" https://x), while --cookie is masked, because _CLI_SECRET_FLAG_RE only matches long flags. The other review fixes and the docs updates read correctly to me.

Redact cookie values passed with curl's short -b flag while preserving non-cookie uses.

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

Copy link
Copy Markdown
Collaborator

I added the fix for the curl -b leftover from my review in d3b2dcf. A -b value that holds a cookie pair (name=value) is now masked like --cookie, while flags such as tar -b 20 stay intact. Tests in test_tier3_failure_reasons.py cover single- and double-quoted cookie values.

@rng1995
rng1995 enabled auto-merge (squash) November 5, 2026 18:06
rng1995 and others added 2 commits November 5, 2026 10:36
Resolve the CHANGELOG.md conflict: keep main's report finding-count entry
(#310) and add this PR's baseline-trial drill-down entry after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the CHANGELOG.md conflict: keep main's Tier 2 JSON-in-prose entry
(#297) and add this PR's failing-score explanation entries after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995
rng1995 merged commit e8f2a1d into main Nov 5, 2026
22 checks passed
@rng1995
rng1995 deleted the naren/port-report-grader-reasons-baseline branch November 5, 2026 20:17
rng1995 added a commit that referenced this pull request Nov 5, 2026
Resolve the docs/reports.mdx conflict: keep this PR's LLM and tool timing
table and notes at the end of "Measured agent resources", followed by
main's new "Failure reasons and per-trial rows" section (#305).

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995 rng1995 mentioned this pull request Nov 6, 2026
7 of 8 tasks
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