Repository navigation
feat(eval): canonical evaluation rubrics in core + rubric reference doc (closes #430) - #431
Conversation
…ity_report Adds bigquery_agent_analytics.evaluation_rubrics: the canonical 8-metric rubric data (response_usefulness with the scope-conditional declined category, task_grounding, correctness, tool_usage, specificity, scope_compliance, first_time_right, failure_attribution) and the interpreter that turns a metric config into CategoricalMetricDefinition objects -- builtin_metric_config() and build_metrics(eval_config, *, scope_context, has_scope) -- extracted verbatim from the shipping scripts/quality_report.py semantics rather than resurrected from the stale GoogleCloudPlatform#91 snapshot (which froze a 2-category usefulness with no declined handling; this supersedes that Phase-1 approach with the current, recorded-and-published vocabulary). scripts/quality_report.py becomes a thin caller in the same change: get_eval_metrics derives scope inputs from the eval spec and delegates to core build_metrics; a missing eval_config.json now falls back to the SDK builtin instead of raising. A drift-guard test pins builtin_metric_config() to scripts/eval/eval_config.json so the two can never diverge silently. docs/evaluation_rubrics.md is the generated-from-data rubric reference: every metric's judge definition and category vocabulary verbatim, the scope/declined mechanics, golden-grounding interplay, Python + CLI usage, and the override schema.
Code review: canonical evaluation rubrics in coreVerdict: approve with small changes. The extraction is faithful — I diffed the moved interpreter against the original Findings:
Cross-PR note: this PR and #432 both insert their export block at the same anchor in |
caohy1988
left a comment
There was a problem hiding this comment.
Review: Approve with nits
Verified locally: the extraction is token-for-token verbatim from the old interpreter (only the log message wording changed: "Loaded %d metrics" → "Built %d metric definitions"). The drift guard is real and currently passes — confirmed builtin_metric_config() == scripts/eval/eval_config.json as parsed dicts. Reproduced the claimed test count exactly: 6 new + 131 quality-report + 47 skill-evolution/compare-runs = 184, all green. CI green across Python 3.10–3.14.
Findings
MINOR — fallback is silent where it used to fail loudly (scripts/quality_report.py:674)
The old code raised FileNotFoundError naming the expected locations; the new code logs at info and proceeds with builtin rubrics. A user who runs from the wrong cwd (or whose eval/eval_config.json was moved/renamed) now gets a plausible-looking report graded with the canonical vocabulary instead of their custom one, with only an info-level line to hint why. The fallback itself is a reasonable feature, but this should be logger.warning naming the searched locations so a discovery mistake is visible.
MINOR — the behavior change this PR makes is the one thing not tested (scripts/quality_report.py:670-678)
None of the 6 new tests (nor any existing test — _load_eval_config has zero test references) covers the new no-file → builtin fallback or the get_eval_metrics delegation. A cheap test: clear _EVAL_CONFIG_CACHE, monkeypatch _repo_root/_script_dir to empty dirs, assert the builtin is returned and cached. Given the description explicitly calls out "no longer raising" as deliberate, it should be pinned.
MINOR — doc "cannot drift" claim is overstated (docs/evaluation_rubrics.md)
The description says the doc is "generated from the canonical data, so it cannot drift from what the judge actually sees." There is no generator script in the repo; the doc is a third, hand-maintained copy of the rubric text, and the drift guard pins only builtin ↔ eval_config.json, not the doc. The tables do match the config verbatim today (spot-checked all 8 metrics), but either add a generation/consistency check or soften the claim to "mirrors the canonical data."
NIT — stale docstring on _load_eval_config (scripts/quality_report.py:636-646)
Still says "The file is expected to contain: metrics…" with no mention of the builtin fallback when no file exists.
NIT — insert_after typo silently reorders to front (src/bigquery_agent_analytics/evaluation_rubrics.py:280-283)
When insert_after names a nonexistent category, idx = -1 → cats.insert(0, declined_cat), silently placing declined first. Verbatim from the old script (not a regression), but it's now public API consumed by arbitrary custom configs; falling back to append when idx == -1 would be less surprising. The not-found case is also the one injection path the new tests don't cover.
NIT — build_metrics(None) reads the module constant by reference (evaluation_rubrics.py:262-263)
Safe today (the interpreter never mutates the config), but the safety rests on a no-mutation invariant over shared module state; using builtin_metric_config() here would make it self-evidently safe.
NIT — import style (evaluation_rubrics.py:43-44)
Absolute import while sibling categorical_views.py:53 uses relative. Cosmetic.
Positives
- Extraction verified programmatically: identical logic, ordering, and
insert_after/idx+1semantics. - The drift guard is genuine full-dict equality; the deep-copy isolation test correctly pins the mutate-freely contract.
- Doc accuracy is good where checkable:
declineddocumented as inserted aftermeaningful(matches), and the Python example's API names match real signatures. - The
--dimensions primarypath builds a filtered copy rather than mutating the cached config, so the new cached-builtin fallback can't be corrupted by it.
Review by @caohy1988's assistant (Kimi Code CLI).
Code review: current head
|
|
Open-PR sweep recheck at unchanged head No commits have landed since my full current-head review. The Ready to merge verdict still applies, and the current CI checks remain green. I still found no actionable defect in the rubric constants, exports, or reference documentation. Full current-head review: #431 (comment) Coordination note: #432 still edits overlapping evaluator/export surfaces, so whichever PR lands second should be refreshed against the first. |
caohy1988
left a comment
There was a problem hiding this comment.
LGTM - approved at exact head 0ad46a4.
I re-reviewed the full diff and prior threads. The public exports, deep-copy configuration, fallback behavior, and quality_report semantics remain correct. Exact-head focused tests pass (6 tests), and current CI is green.
PR #432 overlaps some export/evaluator surfaces, so whichever lands second should refresh from main and rerun CI.
e8a9b00
into
GoogleCloudPlatform:main
…configurator (#450) * chore(release): 0.5.1 — evalbench reader, canonical rubrics, single-input configurator Version bump 0.5.0 -> 0.5.1 and the changelog cut for everything merged since v0.5.0 (2026-08-11). In the wheel: the EvalBench BigQuery run reader (#444), canonical evaluation rubrics in core (#431), and the CLI judge-feedback escaping fix (#438). Repo/live-template side: the single fully-qualified table-ID configurator entrance (#449), Console table-link paste (#424), the attested external-access contract with its staleness workflow (#446), the end-user manual (#425), Grafana metric and scan-bound fixes (#433) with the one-command local run (#422), and the documentation and CI follow-ups. * chore(release): fold #432 golden-matching into the 0.5.1 cut The release branch was cut one commit before #432 landed on main; the synthetic merge CI builds would already ship golden_matching.py in the 0.5.1 wheel, so the module and its three top-level exports must be in the release section. Merges main and documents the module in Release highlights and Added.
…sion flags (GoogleCloudPlatform#435) New failure_taxonomy module: versioned scaffold config (0.0.0-scaffold, g1_frozen: false) in the GoogleCloudPlatform#431 metric-config schema shape, three mechanical core categories mapped 1:1 from the landed failed-session flags (process_failed / missing_completion / score_failed), an empty D2 dialects slot, and a pure deterministic categorize_failed_session() over dict or SessionVerdict rows. No BigQuery, no LLM, no network. NOT G1: no names frozen; six-week clock not started; partner/D4/live traces stay parked.
…sion flags (GoogleCloudPlatform#435) New failure_taxonomy module: versioned scaffold config (0.0.0-scaffold, g1_frozen: false) in the GoogleCloudPlatform#431 metric-config schema shape, three mechanical core categories mapped 1:1 from the landed failed-session flags (process_failed / missing_completion / score_failed), an empty D2 dialects slot, and a pure deterministic categorize_failed_session() over dict or SessionVerdict rows. No BigQuery, no LLM, no network. NOT G1: no names frozen; six-week clock not started; partner/D4/live traces stay parked.
* feat(evalbench): scaffold mechanical failure taxonomy from failed-session flags (#435) New failure_taxonomy module: versioned scaffold config (0.0.0-scaffold, g1_frozen: false) in the #431 metric-config schema shape, three mechanical core categories mapped 1:1 from the landed failed-session flags (process_failed / missing_completion / score_failed), an empty D2 dialects slot, and a pure deterministic categorize_failed_session() over dict or SessionVerdict rows. No BigQuery, no LLM, no network. NOT G1: no names frozen; six-week clock not started; partner/D4/live traces stay parked. * feat(evalbench): attach scaffold taxonomy categories to failed-session rows (#435) Consume the slice-8 failure_taxonomy scaffold from the failed-sessions path: EvalBenchSession exposes taxonomy_categories as a property computed from its three mechanical flags via categorize_failed_session, and to_dict() serializes it as a list, so failed_sessions() rows and the evalbench-failed-sessions CLI JSON/text output carry the tripped scaffold ids. EvalBenchFailedSessions.to_dict() now serializes nested sessions through EvalBenchSession.to_dict (asdict only sees stored fields). All-flags-false rows (--include-passed) emit [] rather than an invented unknown bucket. Pure Python over flags already returned -- no extra BigQuery round-trip, no SQL changes, fixture/unit tests only. Still NOT G1: ids stay the unfrozen flag names, clock not started, partner/D4/ live-trace work parked. * docs(evalbench): example Week 0 scenario pack demonstrating the full AgentForensics idea (#435) All five Week 0 human gates of docs/agentforensics_mvp_plan.md as one concrete EXAMPLE story on the widget-stock failed session: partner+SANA (example partner Acme Retail Support), runtime+route, pilot-benchmark rubric, D4 boundary memo, preregistration floors — then the session, its mechanical taxonomy_categories, and an EXAMPLE mapping onto SANA-seeded names (fixtures only, never src/). Not a freeze: g1_frozen stays false, the six-week clock has not started, Week 0 remains human-gated. --fixture offline only; no BigQuery, no network. * docs(evalbench): drop out-of-scope plan pointer from #460 example pack (#435) * feat(evalbench): freeze Week 0 partner, D4 boundary, and G1 taxonomy v0.1 (#435) Record Google Cloud BigQuery Agent Analytics as the real pilot partner, land the fail-closed D4 memo for this project's EvalBench datasets, and freeze production failure_taxonomy at v0.1.0 (g1_frozen true) with the SANA seven + unknown. Mechanical flags map to frozen names in frozen order. The 460 example pack stays illustrative. Clock not started. * docs(evalbench): note #460 example pack predates G1 freeze (#435/#461) The example pack's narrative still described the pre-freeze production scaffold (0.0.0-scaffold, g1_frozen false, flag ids in taxonomy_categories). Add a banner and inline caveats to the .md and .sh stating production froze taxonomy v0.1.0 (g1_frozen true) in #461 and now emits the frozen names (task/planning, finalization, tool blockers). The pack stays illustrative; fixtures and script output are unchanged. * feat(evalbench): native agent_events snapshot writer (EvalBench-adapter exit ramp) (#463) NativeAgentEventsRun starts from production ADK agent_events rows and publishes the same BQAA-owned contract EvalBenchRun.materialize already produces -- pinned (job_id, import_version) snapshot events, deterministic goal_completion score rows, manifest with the view_policy pin, and the failed_sessions view pinned to the latest successful native publication -- with no EvalBench configs/results/scores tables anywhere in the path. - Identity: scenario id is the first eight characters of the ADK session_id (7e352c34), falling back to the full id on collision; event and score rows keep the real session_id so the session is the same object with or without the adapter. - Scores: derived from the session alone (1.0 iff AGENT_COMPLETED -- completed, not passed; the EvalScorePolicy gate decides passed). A never-completed session publishes the same ERROR-status prompt-row marker the adapter publishes for returncode != 0, so process_failed holds and the widget-stock silence session 7e352c34 yields the frozen G1 v0.1.0 names task/planning, finalization, tool blockers. - Thin CLI on-ramp: bq-agent-sdk evalbench-native-import, mirroring evalbench-import; the adapter (#97) stays optional and untouched. - Production agent_events is never written (reserved-name guard); the source table is only read. Offline fixture tests only; no live BQ. - The six-week clock has still NOT started. * fix(evalbench): fail-close native source table and pin import_version on traces (#464) Reject non-agent_events native sources (including EvalBench configs/results/scores) before any query, and isolate retained native versions in trace/filter consumers.
Extracts the canonical rubric data and interpreter from
scripts/quality_report.pyintobigquery_agent_analytics.evaluation_rubrics, per #430 — superseding the #91 Phase-1 approach by extraction-from-current rather than resurrection-from-April.What's in core now:
builtin_metric_config()— deep copy of the canonical 8-metric config (response_usefulnesswith the scope-conditionaldeclinedcategory,task_grounding,correctness,tool_usage,specificity,scope_compliance,first_time_right,failure_attribution), same schema as an--eval-configJSON.build_metrics(eval_config=None, *, scope_context='', has_scope=False)— the interpreter, verbatim semantics from the shipping script: scope-aware definition enrichment,declinedinjection withinsert_afterpositioning, scope suffixes.docs/evaluation_rubrics.md— the rubric reference: every metric's judge definition and category vocabulary (generated from the canonical data, so it cannot drift from what the judge actually sees), the scope/declined mechanics, golden-grounding interplay, Python + CLI usage, and the override schema.Same-PR thinning (no dual implementations):
get_eval_metrics()now derives scope inputs from the eval spec and delegates to core; a missingeval_config.jsonfalls back to the SDK builtin instead of raising. A drift-guard test pinsbuiltin_metric_config()toscripts/eval/eval_config.json.Tests: 6 new in
tests/test_evaluation_rubrics.py(canonical set, declined injection + positioning, scope-aware appending, deep-copy isolation, custom-config passthrough, builtin↔file parity); full quality-report/skill-evolution/compare-runs suites green (184).Relation to #91: same destination file name and intent, but built from the current, recorded-and-published vocabulary;
policy_compliancefrom #91 can layer on top afterwards. Refs #63, #397.