Repository navigation
feat(evalbench): span-level G1 taxonomy on span_id (#466) - #467
haiyuan-eng-google merged 2 commits into
Conversation
caohy1988
left a comment
There was a problem hiding this comment.
Reviewer: Kimi
Review: PR #467 — span-level G1 taxonomy on span_id (#466)
- HEAD:
35e40f2c21c28cee461e54ebfb6f86b68f57e9c2 - Base:
f5c6109(PR #464 native writer HEAD) — verifiedgit merge-base --is-ancestor; unique commit vs 464 is exactly35e40f2. - Diff reviewed:
git diff f5c6109..HEAD— 3 files, +774:src/bigquery_agent_analytics/span_taxonomy.py(394),tests/test_span_taxonomy.py(357),CHANGELOG.md(+23, additions only). - Tests:
.venv/bin/python -m pytest tests/test_span_taxonomy.py -q→ 14 passed (offline, 1.16s).
Verdict: LGTM / APPROVE
- P0 count: 0
- P1 count: 0
- P2 count: 3 (informational only, none blocking)
P0 audit — none triggered
- No live BQ / no
--synth:span_taxonomy.pyhas nogoogle.cloud/ network imports; tests are in-memory fixtures built ontest_native_events_writerhelpers. Nothing reaches BigQuery. - No writes to production
agent_events: module is pure functions over row mappings. evalbench-importadapter (#97) untouched;evalbench.py,failure_taxonomy.py,native_events.pybyte-identical to base (empty diff).- No clock start / preregistration sealing / Week 1 kickoff; CHANGELOG bullet explicitly keeps "the six-week clock has still NOT started".
- No #465 (
2169889) or #462 (7f5a954) commits inf5c6109..HEAD; no reset offf5c6109. - No Acme-as-partner, no fake D4 people, no SANA fork, no new G1 category strings — categories come from
FROZEN_CATEGORY_NAMESand non-frozen names are rejected at construction (span_taxonomy.py:114-120). - No synthetic span identifiers: rows without a real
span_idfail closed withValueError(span_taxonomy.py:208-214); gap marker anchors to a real last span (target_kind="gap_after_span"). - Session-level
failed_sessions+ G1 denominator preserved: the module never classifies; it consumes the landed verdict viacategorize_failed_sessionandclassify_sessions(span_taxonomy.py:175,263-265).test_session_level_g1_is_unchanged_by_span_labelsasserts the widget-stock verdict stays(True, True, True, True)→("task/planning", "finalization", "tool blockers"). - Identity rule intact:
eval_idcomes from_native_scenario_ids(first-8, full id on collision),span_taxonomy.py:258; no unconditional 8-char truncation. - No conflict markers in the diff.
- No rewrites of
NativeAgentEventsRun/failure_taxonomy/classify_sessionsproduction paths.
P1 audit — none triggered
- Widget-stock
7e352c34-4c1c-4395-acd5-fb3c8f215346silence localizes to the real last span:test_silence_localizes_to_the_last_real_span_agent_startinganchors all three labels on theAGENT_STARTINGspan (_AGENT_STARTING_SPAN = "b7ad6b7169203331", drawn from the fixture rows) withtarget_kind="gap_after_span";test_evidence_states_no_tool_starting_and_no_check_inventoryasserts the evidence states "no TOOL_STARTING event follows", "check_inventory was never called", and "no AGENT_COMPLETED event follows". Session G1 unchanged. ✔ - Required tuple present:
SpanFailureLabel.as_tuple()returns(trace_id, span_id, failure_category, evidence, confidence)(span_taxonomy.py:132-142);test_rfc_tuple_shape_is_trace_span_category_evidence_confidencecovers it. ✔ - Frozen names only: used throughout; a fourth name is rejected at construction (
__post_init__,span_taxonomy.py:115-120) and covered bytest_a_fourth_category_string_is_rejected_at_construction. ✔ - #429 reuse: no parallel span model — inputs are the same native
agent_eventsrows; the turn coordinate reuses the #429USER_MESSAGE_RECEIVED-anchored turn counting thatsub_trajectories.start_turn/end_turnaddress (_turn_index,span_taxonomy.py:371-383;test_turn_index_counts_user_message_received_turns_like_429). See P2-2 for a nuance. ✔ - Required tests all present: widget-stock punchline ✔, no-synthetic-span-id ✔ (
test_rows_without_span_id_fail_closed_instead_of_inventing_one,test_every_emitted_span_id_comes_from_the_input_rows), first-8 collision identity ✔ (test_first8_collision_falls_back_to_the_full_session_id— twin7e352c34-ffff-...forces full-id fallback for both), frozen-name reject ✔, session G1 unchanged ✔. - CHANGELOG keeps the 463/464 bullets: the diff is additions-only; the #463 native-writer bullet directly below the new one is untouched (verified against
f5c6109:CHANGELOG.md). ✔ - Stacking: unique commit is stacked on
f5c6109. ✔
P2 (informational, not blockers)
- Silence wording in the direct-ERROR path can overstate. In
_evidence(span_taxonomy.py:302-305, reused at335-343), thefinalizationandtask/planningevidence strings always append "the trace goes silent after {descriptor}: no subsequent agent_events row exists" / "no further plan step follows {descriptor}". Fortarget_kind="span"the target is the first ERROR row, which need not be the last row — a trace can log an ERROR mid-stream and continue. In that case the evidence would assert a false "fact" atconfidence=1.0(which the module defines as a checkable fact of the stream,span_taxonomy.py:52-57). The existing ERROR test's span is the last row, so this is uncovered. Suggest gating the silence clause ontarget_index == len(ordered) - 1or rewording for the mid-trace case. Can wait — no current fixture trips it. - #429 turn anchoring is reimplemented, not shared.
_turn_indexre-countsUSER_MESSAGE_RECEIVEDevents inline. The real #429sub_trajectoriesturn tagging lives inscripts/quality_report.py(LLM-driven, not an importable library symbol), so there is nothing sensible to import today; the docstring's alignment claim (span_taxonomy.py:46-51) is accurate by convention. If a shared turn-index helper ever lands in the package, this should converge on it. Fine as-is. - Protected-member access on
NativeAgentEventsRun.label_native_runcallsrun._kept_and_skipped()andrun._score_facts_with_prompts()with pylint disables (span_taxonomy.py:255,260). Same-package and consistent with the run's contract, but a small public accessor would be tidier. Non-blocking.
What can wait
- P2-1 mid-trace-ERROR evidence wording (plus a test with a non-terminal ERROR span).
- P2-2 shared turn helper convergence; P2-3 public accessors on
NativeAgentEventsRun. - Sub-1.0 confidences remain reserved for the labeler/judge study per the plan of record — correctly out of scope here.
Reviewed locally only; nothing posted to GitHub, no pushes, no merges, clock stays off, no live BQ, worktree unmodified.
caohy1988
left a comment
There was a problem hiding this comment.
Reviewer: Codex
Code Review Results
PR: 467 - span-level G1 taxonomy on span_id for #466
Verdict: REQUEST_CHANGES
P0 count: 0
P1 count: 5
P2 count (informational): 0
HEAD SHA: 35e40f2
Scope: f5c6109..35e40f2 (unique commit 35e40f2 only; 3 files)
Mode: report-only; no worktree or GitHub mutation
The widget-stock acceptance path works, but five P1 contract defects remain. Four can emit labels that are valid-looking but false or unjoinable. The fifth allows forbidden span-level category names.
Triage Groups
| Group | Findings | Context | Preferred resolution | Why |
|---|---|---|---|---|
| Frozen contract alignment | #1, #4 | The public label and turn coordinate are broader or different from the frozen contracts | Restrict the category set, then consume the actual #429 coordinate | This restores joinability before downstream consumers depend on the new rows |
| Evidence integrity | #2, #3, #5 | Evidence can contradict the same event stream or borrow tools from unrelated sessions | Make targets category-specific, branch on observed calls, and match gold evidence per scenario | These fixes keep confidence=1.0 evidence mechanically true |
P1 -- High
| # | File | Issue | Reviewer | Confidence |
|---|---|---|---|---|
| 1 | src/bigquery_agent_analytics/span_taxonomy.py:115 | Span labels accept forbidden fourth G1 names | correctness, testing, adversarial-claude | 100 |
| 2 | src/bigquery_agent_analytics/span_taxonomy.py:302 | Mid-stream errors emit false end-of-trace evidence | correctness, adversarial-claude | 100 |
| 3 | src/bigquery_agent_analytics/span_taxonomy.py:318 | Started tools are reported as never started | correctness, adversarial-claude | 100 |
| 4 | src/bigquery_agent_analytics/span_taxonomy.py:383 | turn_index forks the #429 coordinate | correctness, maintainability, adversarial-claude | 100 |
| 5 | src/bigquery_agent_analytics/span_taxonomy.py:270 | Gold evidence leaks across unrelated sessions | adversarial-claude; independently validated | 75 |
-
#1 - Reject all fourth span-level names. The guard checks the eight-name failure_taxonomy.FROZEN_CATEGORY_NAMES tuple, not the three mechanically emittable names required for this layer. As a result, wrong source, execution/computation, incomplete evidence, turn-waste, and unknown are accepted. The existing test at tests/test_span_taxonomy.py:257 rejects only agent starvation, which is outside the broader vocabulary and does not prove the frozen three-name contract. Validate against exactly task/planning, finalization, and tool blockers, and test rejection with an in-vocabulary fourth name such as wrong source.
-
#2 - Keep absence labels on the real end boundary. The shared silence text at line 302 says that no subsequent row exists even when line 204 selected the first ERROR span and later native rows are present. Finalization and task/planning are then anchored to that mid-stream ERROR and carry false evidence at confidence 1.0. Keep tool blockers on the real ERROR span, but anchor finalization and end-of-trace planning evidence to the last real span. Add an ERROR-followed-by-later-rows regression.
-
#3 - Check called before claiming no tool ever started. When gold_events is empty, or when the failed and gold sessions called the same tools, missing_tools is empty and line 318 emits no tool was ever started without consulting the already-computed called set. A TOOL_STARTING-then-silence trace therefore contradicts its own label. Emit that sentence only when called is empty; otherwise describe the actual gap. Add a regression for a failed session that called a tool before silence.
-
#4 - Use the #429 full-conversation coordinate. The helper counts USER_MESSAGE_RECEIVED rows and returns a zero-based user-message ordinal. The #429 path indexes the full reconstructed conversation, including agent responses; for an interleaved user/agent/user trace, the second user is coordinate 2 while this code returns 1. This is a parallel turn model and cannot reliably join sub_trajectories.start_turn/end_turn. Pass or derive the existing #429 mapping. If that cannot be done faithfully in this slice, omit turn_index rather than publishing a falsely compatible value. Add an interleaved conversation test.
-
#5 - Match gold evidence per failed scenario. label_native_run appends every completed session into one gold_pool and gives that union to every failed session. In a normal multi-scenario run, a widget-stock failure can therefore claim that unrelated refund or translation tools were missing and were called by the completed sibling. Build gold evidence from an unambiguous same-scenario sibling, using the existing prompt as the available match key, and omit missing-tool claims when no match exists. Add a multi-scenario run test.
Actionable Findings
| # | File | Route | Required response |
|---|---|---|---|
| 1 | src/bigquery_agent_analytics/span_taxonomy.py:115 | gated_auto -> downstream-resolver | Restrict the constructor to the frozen mechanical three and harden the rejection test |
| 2 | src/bigquery_agent_analytics/span_taxonomy.py:302 | gated_auto -> downstream-resolver | Use category-specific targets and test a mid-stream ERROR |
| 3 | src/bigquery_agent_analytics/span_taxonomy.py:318 | gated_auto -> downstream-resolver | Branch on called and test TOOL_STARTING followed by silence |
| 4 | src/bigquery_agent_analytics/span_taxonomy.py:383 | manual -> downstream-resolver | Consume the actual #429 coordinate or omit the incompatible field |
| 5 | src/bigquery_agent_analytics/span_taxonomy.py:270 | manual -> downstream-resolver | Scope gold evidence to an unambiguous same-scenario sibling |
What can wait
- Direct-call robustness for unparseable timestamps and mismatched verdict/session inputs can be handled separately.
- Selection among several raw ERROR spans can wait until production evidence establishes recovered-error behavior.
- Private-helper coupling, naming, and other P2-level cleanup are not blockers for this review.
Coverage
- Stack and scope verified: HEAD is 35e40f2; f5c6109 is its ancestor; the only unique commit is 35e40f2; the unique files are CHANGELOG.md, span_taxonomy.py, and test_span_taxonomy.py.
- Prohibited commits 2169889 (#465) and 7f5a954 (#462) are absent from HEAD. There are no conflict markers.
- No P0 trigger was found: no live BigQuery or --synth execution path was added, no production agent_events write was added, evalbench-import stays intact, the clock remains off, and NativeAgentEventsRun, failure_taxonomy.py, and classify_sessions were not rewritten.
- Required positive fixtures are present for the widget-stock AGENT_STARTING silence punchline, real span IDs, collision-safe eval_id, tuple shape, frozen-name rejection attempt, and unchanged session G1. Findings #1 and #4 explain why two of those tests prove weaker contracts than required.
- Offline verification: 71 focused tests passed across test_span_taxonomy.py, test_failure_taxonomy.py, and test_native_events_writer.py. Pyink and isort checks passed. No live BigQuery test ran.
- Independent review: correctness, testing, maintainability, and an independent Claude adversarial pass. The Claude receipt reports claude-opus-5, requested effort high, actual effort unverified, and independence_verified=true. Findings #1-#4 had cross-model corroboration; finding #5 passed a separate fresh validator.
- No reviewer failures, malformed findings, pre-existing blockers, or final confidence suppressions. All three preliminary fast-pass items survived and were merged into #1, #2, and #4.
- No separate implementation plan was selected; issue #466 and the user-provided frozen contracts were the explicit requirements source.
Verdict
REQUEST_CHANGES
Five P1 defects must be fixed before approval. Fix #1 and #4 first to restore the frozen taxonomy and turn-coordinate contracts, then fix #2, #3, and #5 so every confidence=1.0 evidence string remains true for real multi-event, multi-session native runs.
Actionable Findings Summary
- #1 - P1 - src/bigquery_agent_analytics/span_taxonomy.py:115 - restrict span labels to the three allowed names - gated_auto - suggested fix present - confidence 100
- #2 - P1 - src/bigquery_agent_analytics/span_taxonomy.py:302 - prevent false silence evidence after a mid-stream ERROR - gated_auto - suggested fix present - confidence 100
- #3 - P1 - src/bigquery_agent_analytics/span_taxonomy.py:318 - do not report started tools as never started - gated_auto - suggested fix present - confidence 100
- #4 - P1 - src/bigquery_agent_analytics/span_taxonomy.py:383 - reuse the #429 full-conversation coordinate - manual - suggested fix present - confidence 100
- #5 - P1 - src/bigquery_agent_analytics/span_taxonomy.py:270 - isolate gold evidence by scenario - manual - suggested fix present - confidence 75
…oogleCloudPlatform#467) Restrict span labels to the frozen three names, keep silence evidence true for mid-stream ERROR and started tools, omit a false GoogleCloudPlatform#429 turn_index, and scope gold missing-tool evidence to the same-scenario sibling.
caohy1988
left a comment
There was a problem hiding this comment.
Reviewer: Kimi
Re-review: PR #467 — Span-level G1 taxonomy on span_id (#466)
- Verdict: LGTM / APPROVE
- P0 count: 0
- P1 count: 0
- HEAD SHA reviewed: a7fd389 (
a7fd389, "fix(evalbench): tighten span G1 names, evidence, and gold matching (#467)") - Range reviewed:
git diff f5c6109..HEAD/git log f5c6109..HEAD(stacked on PR #464 HEADf5c6109; the prior Kimi LGTM on35e40f2does not carry over — this is a fresh review of the new HEAD). - Diff shape: 3 files, +1007/−0 vs
f5c6109:src/bigquery_agent_analytics/span_taxonomy.py(new, 432 lines),tests/test_span_taxonomy.py(new, 546 lines),CHANGELOG.md(+29). Purely additive localization layer; no rewrites ofNativeAgentEventsRun,failure_taxonomy.py, orclassify_sessions. - Tests:
python -m pytest tests/test_span_taxonomy.py -q→ 19 passed.
Stacking / scope hygiene (P0 screen — all clear)
git log f5c6109..HEADshows exactly the two expected commits:35e40f2thena7fd389. No #465 demo commit (2169889) and no #462 commit (7f5a954) is an ancestor of HEAD (verified viagit merge-base --is-ancestor). Branchfeat/466-span-g1-taxonomyis properly stacked onf5c6109.- No conflict markers, no live BigQuery client /
--synth, no network, no LLM judge anywhere in the new module (grep-verified). Module docstring (span_taxonomy.py:59-64) and CHANGELOG both state the six-week clock has not started; nothing seals preregistration. - Adapter #97 (
evalbench-import) untouched; nativeagent_eventsremains the source of truth. No productionagent_eventswrites, no Acme/fake-D4/SANA fork, no synthetic span ids (span_taxonomy.py:243-248fails closed withValueErrorwhen a target row lacks a realspan_id). - Session-level
failed_sessions+ G1 remains the denominator:label_native_run(span_taxonomy.py:296-302) reads verdicts from the unchangedclassify_sessionsand only localizes categories the verdict already tripped (label_failed_session_spans,span_taxonomy.py:203-205returns()when no category tripped). - Widget-stock
7e352c34punchline preserved in the acceptance fixtures/tests (10 references in the test file) and in the CHANGELOG.
The five prior Codex P1s on 35e40f2 — all resolved in a7fd389
P1-1 — SpanFailureLabel must accept ONLY the three mechanically emittable names. RESOLVED.
SPAN_CATEGORY_NAMES (span_taxonomy.py:97-101) is derived from FLAG_TO_CATEGORY.values() (the three flags' frozen names: task/planning, finalization, tool blockers — confirmed against failure_taxonomy.py:90-94), and SpanFailureLabel.__post_init__ (span_taxonomy.py:134-141) now rejects everything else, including in-vocabulary frozen names. Regression coverage: tests/test_span_taxonomy.py test_a_fourth_category_string_is_rejected_at_construction now constructs dataclasses.replace(label, failure_category="wrong source") — an in-vocabulary fourth name — and asserts rejection, and test_span_labels_are_restricted_to_the_three_emittable_names pins the exact 3-tuple.
P1-2 — Mid-stream ERROR must not yield false end-of-trace evidence. RESOLVED.
Target selection is now per category (span_taxonomy.py:233-240): only tool blockers anchors to the first raw status == "ERROR" row with target_kind="span"; finalization and task/planning always anchor to the last existing span, the only span for which "no subsequent row exists" is true. The ERROR-anchored evidence (span_taxonomy.py:353-357) states only logged status ERROR — no silence claim. Regression: test_mid_stream_error_keeps_silence_evidence_on_the_last_span builds an ERROR-followed-by-a-later-LLM_RESPONSE trace and asserts the blocker carries no "goes silent" text while finalization anchors to the last span id and excludes the ERROR span id.
P1-3 — "no tool was ever started" only when no tool was started. RESOLVED.
_category_evidence (span_taxonomy.py:358-377) now branches: missing_tools from the same-scenario sibling → "never called"; else if the session did start tools (called non-empty) → "though <tools> was started earlier in the session"; only the empty-called case emits "no tool was ever started". Regression: test_a_started_tool_is_not_reported_as_never_started runs the TOOL_STARTING-then-silence shape both with and without gold and asserts the denial is absent and the actual started tool is named.
P1-4 — turn_index omitted rather than a false ordinal. RESOLVED.
The field, the _turn_index helper, and the _PROMPT_EVENT import are all removed; the docstring contract (span_taxonomy.py:50-58, 119-121) explains why: the #429 coordinate indexes the full reconstructed conversation and has no importable package mapping, so publishing a user-message ordinal under the same name would fork it. Regression: test_no_turn_index_is_published keeps the interleaved two-user-message conversation (exactly where the ordinals would diverge) and asserts "turn_index" is absent from both dataclasses.fields and the instance.
P1-5 — Gold evidence from a same-scenario sibling only. RESOLVED.
label_native_run (span_taxonomy.py:303-327) replaces the run-wide gold_pool with gold_by_prompt: a failed session's gold is the one completed sibling that asked the same prompt; ambiguous prompts (multiple completed siblings) are marked None and supply no gold; no match supplies no gold. Regressions: test_gold_evidence_is_scoped_to_the_same_prompt_sibling (multi-scenario run — the refund-policy sibling's lookup_policy must not leak into the widget-stock session's evidence) and test_missing_tool_claims_are_omitted_without_a_same_prompt_sibling (no same-prompt sibling → no "never called" claim at all).
Findings at this HEAD
None at P0/P1 severity.
What can wait (non-blocking, P2-tier — not blockers)
label_failed_session_spanswith a raw-dict verdict relies on_verdict_field(verdict, "session_id")only as a fallback when rows lacksession_id; a dict verdict withoutsession_idand rows withsession_idstill labels fine, but the error paths assume one or the other is present. Documented well enough; no change needed now.SPAN_CATEGORY_NAMESis computed dynamically fromFLAG_TO_CATEGORY.values(). If a fourth mechanical flag is ever added upstream, this set silently widens. The pinning test (test_span_labels_are_restricted_to_the_three_emittable_names) would catch it in CI, so this is acceptable as-is.- The ambiguous-prompt case (two completed siblings, same prompt) silently drops gold evidence rather than surfacing the ambiguity to the caller. Conservative and safe; a future observability note could log/count it.
_prompt_textmatching is exact-string; near-identical prompts across scenarios won't match. Conservative direction (under-matching gold is safe); fine for the mechanical layer.
Bottom line
All five prior Codex P1s are fixed at the root with targeted regression tests, the frozen contracts from #466 hold (denominator, frozen 3-name taxonomy, real span ids only, identity collision fallback, widget-stock punchline, offline, clock off), and the diff stays strictly inside the localization layer. LGTM / APPROVE at a7fd389. Skip-if-exists note: this approval is per-SHA and applies only to a7fd3899c3726a8de257783a2f1dcd50d96299e3; any new HEAD requires a fresh review.
caohy1988
left a comment
There was a problem hiding this comment.
Reviewer: Codex
Code Review Results
PR: 467 — span-level G1 taxonomy on span_id for #466
Verdict: LGTM / APPROVE
P0 count: 0
P1 count: 0
HEAD SHA: a7fd389
Scope: f5c6109..a7fd389 (unique commits 35e40f2, a7fd389; three files)
Mode: report-only; no GitHub or worktree mutation
No P0 or P1 findings remain on this HEAD. The fix commit closes all five prior Codex P1s from 35e40f2, and the complete PR diff remains within the requested localization layer.
Findings and prior-P1 resolution
-
Resolved — frozen span names:
src/bigquery_agent_analytics/span_taxonomy.py:97defines the mechanically emittable set as exactlytask/planning,finalization, andtool blockers;src/bigquery_agent_analytics/span_taxonomy.py:133rejects every other value.tests/test_span_taxonomy.py:256now proves rejection with the in-vocabulary fourth namewrong source, as well as an out-of-vocabulary string. -
Resolved — mid-stream ERROR anchoring:
src/bigquery_agent_analytics/span_taxonomy.py:223finds the real ERROR row, while the category-specific selection atsrc/bigquery_agent_analytics/span_taxonomy.py:233keepstool blockerson that row and anchorsfinalization/ end-of-tracetask/planningevidence to the last real span. The ERROR-followed-by-later-rows regression attests/test_span_taxonomy.py:328verifies that no false end-of-trace claim is attached to the earlier ERROR span. -
Resolved — started-tool evidence:
src/bigquery_agent_analytics/span_taxonomy.py:358computescalled, and the branches atsrc/bigquery_agent_analytics/span_taxonomy.py:360emit “no tool was ever started” only when that set is empty.tests/test_span_taxonomy.py:381coversTOOL_STARTINGfollowed by silence and requires the evidence to describe the tool that started earlier. -
Resolved — #429 coordinate fork:
SpanFailureLabelomitsturn_indexatsrc/bigquery_agent_analytics/span_taxonomy.py:124; no user-message-only ordinal is published. The interleaved user/agent conversation regression attests/test_span_taxonomy.py:421verifies the field is absent. -
Resolved — scenario-scoped gold evidence:
src/bigquery_agent_analytics/span_taxonomy.py:305builds completed-sibling evidence by exact prompt key and passes it only to the matching failed session atsrc/bigquery_agent_analytics/span_taxonomy.py:318; absent or ambiguous matches yield no gold tool claims. The multi-scenario and no-match regressions are attests/test_span_taxonomy.py:462andtests/test_span_taxonomy.py:504.
Frozen-contract check
- Session-level
classify_sessionsplus G1 remains the denominator; span code only localizes categories (src/bigquery_agent_analytics/span_taxonomy.py:203,src/bigquery_agent_analytics/span_taxonomy.py:300). - Every emitted label uses a real input
span_idand fails closed rather than inventing one (src/bigquery_agent_analytics/span_taxonomy.py:241). - Collision-safe identity still comes from
_native_scenario_idsand is applied to labels (src/bigquery_agent_analytics/span_taxonomy.py:295,src/bigquery_agent_analytics/span_taxonomy.py:324). as_tuple()preserves(trace_id, span_id, failure_category, evidence, confidence)(src/bigquery_agent_analytics/span_taxonomy.py:153).- The widget-stock
7e352c34silence path still localizes all three labels to its realAGENT_STARTINGspan (tests/test_span_taxonomy.py:132). CHANGELOG.md:42retains the stacked native-writer / PR 464 entry, including theevalbench-importadapter guarantee; the new span-localization entry is additive.
Stack, scope, and safety
f5c6109is an ancestor of HEAD; only35e40f2anda7fd389are unique versus PR 464.- Prohibited commits
2169889(#465) and7f5a954(#462) are not ancestors of HEAD. - The diff changes only
CHANGELOG.md,src/bigquery_agent_analytics/span_taxonomy.py, andtests/test_span_taxonomy.py; it does not rewriteNativeAgentEventsRun,failure_taxonomy.py, orclassify_sessions. - No conflict markers or
git diff --checkerrors were found. No live BigQuery /--synthpath ran, no productionagent_eventswriter was added, the adapter remains present, and the six-week clock stays off.
Verification
- Focused offline gate: 76 passed across
test_span_taxonomy.py,test_native_events_writer.py, andtest_failure_taxonomy.py. - Full offline suite: 4570 passed, 56 skipped.
- Pyink and isort checks passed for both changed Python files.
- Worktree remained unchanged apart from the pre-existing ignored/untracked
.venv.
What can wait
- A real
turn_indexcan be added later when #429 exposes an importable full-conversation mapping; omission is correct for this slice. - Richer scenario identity than the existing prompt match key, selection policy for multiple raw ERROR spans, and private-helper/API cleanup can wait. None is a P0/P1 blocker for #466.
Verdict
LGTM / APPROVE. P0 count: 0. P1 count: 0.
…rm#466) Localization layer over the native agent_events path (GoogleCloudPlatform#435 Phase 2): span_taxonomy.label_failed_session_spans / label_native_run attach the G1-frozen categories a failed session already tripped to the span where the failure is observable, emitting (trace_id, span_id, failure_category, evidence, confidence) rows. Session-level failed_sessions + G1 stays the denominator; eval_id keeps the frozen first-8-on-collision identity; no synthetic span ids (silence targets the last real span as gap_after_span, rows without span_id fail closed); GoogleCloudPlatform#429 turn coordinate reused; taxonomy stays frozen at v0.1.0. Offline fixture tests only; clock still OFF.
…oogleCloudPlatform#467) Restrict span labels to the frozen three names, keep silence evidence true for mid-stream ERROR and started tools, omit a false GoogleCloudPlatform#429 turn_index, and scope gold missing-tool evidence to the same-scenario sibling.
a7fd389 to
0d37fcd
Compare
3222207
into
GoogleCloudPlatform:main
caohy1988
left a comment
There was a problem hiding this comment.
Reviewer: Kimi
Re-review: PR #467 — Span-level G1 taxonomy on span_id (#466)
Round: 467-rebase-after-464
- PR: #467
- HEAD reviewed:
0d37fcd14cf83aee85fdde8c7ba790106d10a378(fix(evalbench): tighten span G1 names, evidence, and gold matching (#467)) - Base: merged #464 squash
04dcadb739c366e1681f95014a44083867414d3c(verified:git merge-base upstream/main HEAD==upstream/main==04dcadb). The earlier stacked-on-unmerged-464 base is gone; prior Kimi reviews of35e40f2/a7fd389were not carried over — this is a fresh review of the rebased HEAD. - Unique commits vs main:
44d0499(feat, formerly35e40f2),0d37fcd(P1 fix, formerlya7fd389) — exactly the expected pair.
Verdict: LGTM / APPROVE
- P0 count: 0
- P1 count: 0
Base / scope verification (P0 gates — all clear)
- Diff slice is exactly the expected three files (
git diff --stat upstream/main..HEAD, 1007 insertions, 0 deletions):src/bigquery_agent_analytics/span_taxonomy.py(+432, new)tests/test_span_taxonomy.py(+546, new)CHANGELOG.md(+29, one new bullet block under Unreleased → Added)
No 458–464 spillover files, no extra surface — the rebase onto the merged #464 squash is clean.
- No forbidden PR content:
git log upstream/main..HEADcontains only44d0499and0d37fcd; no sign of #465 (2169889), #468 (0778125), #462 (7f5a954), #456, #457, or #470. - No conflict markers in any touched file.
- Localization layer only: no changes to
native_events.py,failure_taxonomy.py,evalbench.py/classify_sessions, or any production write path. The evalbench-import adapter (#97) is untouched and remains; nativeagent_eventsstays the source of truth for this layer's inputs. - No live BQ / no
--synth/ no clock start:span_taxonomy.pyis pure and deterministic — imports only fromevalbench/failure_taxonomy/native_events, no BigQuery client, no network, no LLM judge, no writes. The only "clock"/"synth" strings are docstring statements that the clock stays off and that no synthetic span ids are minted (span_taxonomy.py:39-45,:61,:289). CHANGELOG bullet restates "the six-week clock has still NOT started". - No synthetic span ids:
SpanFailureLabel.__post_init__rejects empty/non-str span ids (span_taxonomy.py:147-151), andlabel_failed_session_spansfails closed withValueErrorwhen the target row has no realspan_id(span_taxonomy.py:243-248). Covered bytests/test_span_taxonomy.py:233-250. - Session-level denominator intact:
label_native_runcomputes verdicts via the unchangedclassify_sessions(run.to_agent_event_rows(), score_rows, policy)(span_taxonomy.py:300-302); categories come from the unchangedfailure_taxonomy.categorize_failed_session(span_taxonomy.py:203).test_session_level_g1_is_unchanged_by_span_labels(tests/test_span_taxonomy.py:112-129) pins the three-flag verdict, taxonomy version0.1.0, and the frozen-order category tuple. - Identity rule honored:
eval_idcomes fromnative_events._native_scenario_ids(frozen first-8-with-full-id-on-collision) inlabel_native_run(span_taxonomy.py:295,:324), andlabel_failed_session_spansrequires an eval_id or verdictscenario_id, failing closed otherwise (span_taxonomy.py:211-216). Collision fallback pinned bytest_first8_collision_falls_back_to_the_full_session_id(tests/test_span_taxonomy.py:211-227). - Widget-stock punchline present: session
7e352c34localizes all three tripped categories onto its realAGENT_STARTINGspan withtarget_kind="gap_after_span"and evidence that noTOOL_STARTING/check_inventory/AGENT_COMPLETEDfollowed (tests/test_span_taxonomy.py:132-197).
The five prior Codex P1s — all still fixed after rebase
- Taxonomy restriction (fourth name rejected).
SPAN_CATEGORY_NAMESis derived asFROZEN_CATEGORY_NAMES ∩ FLAG_TO_CATEGORY.values()= exactly("task/planning", "finalization", "tool blockers")in frozen order (span_taxonomy.py:97-101; verified againstfailure_taxonomy.py:71-94).SpanFailureLabel.__post_init__raisesValueErrorfor anything else (span_taxonomy.py:134-141).test_a_fourth_category_string_is_rejected_at_constructionrejects the in-vocabulary fourth name"wrong source"(and the out-of-vocabulary"agent starvation") viadataclasses.replace(tests/test_span_taxonomy.py:256-266), andtest_span_labels_are_restricted_to_the_three_emittable_namespins the tuple (:269-274). ✅ - Mid-stream ERROR is not false end-of-trace evidence. Only
tool blockersmay anchor to the ERROR row (target_kind="span",span_taxonomy.py:235-236);finalization/task/planningalways anchor to the last existing span withgap_after_span(:238-240). The ERROR-anchored evidence states only "logged status ERROR" — no silence claim (:353-357). Regression testtest_mid_stream_error_keeps_silence_evidence_on_the_last_spanuses an ERROR row followed by a laterLLM_RESPONSErow and asserts the blocker stays on the ERROR span (no "goes silent") while finalization anchors to the last span (tests/test_span_taxonomy.py:328-378). ✅ - "No tool was ever started" only when nothing was started.
_category_evidencebranches: missing-tools-from-sibling → "was never called"; else if the session did start tools → "though X was started earlier in the session"; only the empty-calledcase says "no tool was ever started" (span_taxonomy.py:358-373). Regressiontest_a_started_tool_is_not_reported_as_never_started(TOOL_STARTING then silence, with and without gold) asserts the denial never appears (tests/test_span_taxonomy.py:381-418). ✅ - No forked #429 turn coordinate.
SpanFailureLabelhas noturn_indexfield and the module docstring explains why a lookalike ordinal would fork the coordinate (span_taxonomy.py:50-58,:119-121).test_no_turn_index_is_publisheduses the interleaved user/agent conversation — exactly where an ordinal would diverge — and asserts noturn_indexfield or attribute exists (tests/test_span_taxonomy.py:421-456). ✅ - Gold evidence scoped to same-scenario sibling only.
label_native_runkeys gold by prompt (the only same-scenario key the rows carry); ambiguous prompts (multiple completed siblings) are markedNoneand supply no gold, and missing-tool claims are omitted rather than pooled (span_taxonomy.py:303-313,:318-326). Multi-scenario regressiontest_gold_evidence_is_scoped_to_the_same_prompt_siblingproveslookup_policyfrom an unrelated completed scenario never leaks into the widget-stock evidence, andtest_missing_tool_claims_are_omitted_without_a_same_prompt_siblingproves the no-sibling case emits no "never called" claim (tests/test_span_taxonomy.py:462-532). ✅
Test execution (offline, no worktree writes)
PYTHONDONTWRITEBYTECODE=1 python -m pytest tests/test_span_taxonomy.py \
tests/test_failure_taxonomy.py tests/test_native_events_writer.py \
tests/test_week0_real_freeze.py -p no:cacheprovider -q
→ 99 passed
All 22 new span-taxonomy tests plus the adjacent taxonomy/native-events/freeze suites pass at HEAD 0d37fcd.
What can wait (non-blocking, P2)
label_native_runreaches into protected members ofNativeAgentEventsRun(_kept_and_skipped,_score_facts_with_prompts, with explicit pylint disables atspan_taxonomy.py:292,:298). Same-package and tested, but a small public accessor on the run would remove the protected access if a third consumer ever appears.- The gold-sibling key is the raw prompt text; two semantically identical but textually different prompts will not share gold evidence. That is the documented, conservative choice (omit rather than borrow) — fine for the mechanical layer.
confidenceis a constantMECHANICAL_CONFIDENCE = 1.0; the docstring already reserves sub-1.0 values for the labeler/judge study, so nothing to do now.
None of these block merge.
Bottom line: the rebase onto merged #464 (04dcadb) is correct, the diff is exactly the expected three-file slice, all five prior Codex P1s remain fixed with regression tests intact, every P0 gate passes, and the frozen contracts of #466 (session denominator, three-name freeze, no synthetic span ids, first-8 identity, widget-stock punchline, offline/clock-off) are all honored. Approve.
caohy1988
left a comment
There was a problem hiding this comment.
Reviewer: Codex
Verdict: REQUEST_CHANGES
P0 count: 0
P1 count: 1
HEAD SHA: 0d37fcd
Findings
- [P1] The required terminal
TOOL_STARTINGregression is still open.src/bigquery_agent_analytics/span_taxonomy.py:365unconditionally says a non-emptycalledset means the tool "was started earlier in the session." When the source trace ends on theTOOL_STARTINGrow itself, that row is also the gap anchor selected atspan_taxonomy.py:240, so the emitted evidence is:no TOOL_STARTING event follows TOOL_STARTING ... though check_inventory was started earlier in the session. The tool was started on the anchor, not earlier, and the text does not describe the actual post-start gap. This is a reachable native case because an incomplete source session gets the landed process-failure marker for the denominator. The new test attests/test_span_taxonomy.py:381does not cover the requestedTOOL_STARTING-then-silence trace: it adds aTOOL_COMPLETEDrow attests/test_span_taxonomy.py:395, making that later row the anchor. Add the exact terminal-TOOL_STARTINGregression and make its evidence say that the tool started on the anchor but no subsequent completion/event followed.
Prior P1 status
- Closed:
SpanFailureLabelaccepts onlytask/planning,finalization, andtool blockers; the regression rejects in-vocabularywrong source. - Closed: a real mid-stream
ERRORowns only thetool blockerslabel, while finalization/end-of-trace evidence anchors to the last real row; an ERROR-followed-by-later-rows regression is present. - Still open: non-empty
calledno longer produces "no tool was ever started," but the exactTOOL_STARTING-then-silence path still emits inaccurate evidence and lacks the required regression, as described above. - Closed:
turn_indexis omitted, with an interleaved-conversation regression. - Closed: gold tool evidence is keyed to a unique completed same-prompt sibling, and missing-tool claims are omitted when no prompt match exists; both multi-scenario regressions are present.
Rebase and scope audit
merge-base(upstream/main, HEAD)is04dcadb739c366e1681f95014a44083867414d3c;44d0499is directly parented by that merged #464 squash, followed only by0d37fcd.upstream/main..HEADcontains exactly the two expected commits and exactly the three expected files:CHANGELOG.md,src/bigquery_agent_analytics/span_taxonomy.py, andtests/test_span_taxonomy.py.- The forbidden known commits
2169889(#465),0778125(#468),7f5a954(#462), and stacked-unmergedf5c6109are not ancestors of HEAD; no #456, #457, or #470 commit appears in the two-commit unique log. - There are no changes to
NativeAgentEventsRun,failure_taxonomy.py,classify_sessions, the CLI, or theevalbench-importadapter. The merged #463/#464 changelog content is preserved relative toupstream/main. - No conflict markers, synthetic span identifiers, live BigQuery execution, production
agent_eventswrites, Week 1/clock action, or forbidden partner/taxonomy changes were introduced.
Verification
105 passedacrosstests/test_span_taxonomy.py,tests/test_native_events_writer.py,tests/test_failure_taxonomy.py, andtests/test_evalbench_import_sessions.py, offline with pytest cache and bytecode writes disabled.git diff --check, Pyink check, and isort check all pass.- A direct terminal-
TOOL_STARTINGprobe reproduces the inaccurate "started earlier" evidence above.
What can wait
P2/nit-level cleanup can wait; none is required for this review. The single P1 evidence/regression defect is the only merge blocker found.
…gleCloudPlatform#469) Publish the landed GoogleCloudPlatform#466/GoogleCloudPlatform#467 span-level localization as BQAA-owned snapshot rows on the native path, so the widget-stock AGENT_STARTING silence is queryable as data, not only a library return. - NativeAgentEventsRun.materialize gains an opt-in span_labels_table: span rows are derived by reusing label_native_run (frozen fallback EvalScorePolicy({"goal_completion": 1.0}), never an empty policy per the GoogleCloudPlatform#468 P1 finding) BEFORE any write, so a failed session without a real span_id fails the whole publish closed - no synthetic span ids. - Rows carry the RFC tuple (trace_id, span_id, failure_category, evidence, confidence), target_kind, the frozen first-8 eval_id join identity, taxonomy_version 0.1.0, and the (job_id, import_version) pin; sync is keyed delete-then-load per pin (derived state, same convergence rule as the failed-sessions view). - Session-level failed_sessions + G1 stays the denominator, unchanged. - Thin CLI extension: evalbench-native-import --span-labels-table. - Offline fixture tests only; the EvalBench adapter (GoogleCloudPlatform#97) stays; clock stays off; production agent_events is never written.
… (#470) * feat(evalbench): persist span-level G1 labels on native snapshot (#469) Publish the landed #466/#467 span-level localization as BQAA-owned snapshot rows on the native path, so the widget-stock AGENT_STARTING silence is queryable as data, not only a library return. - NativeAgentEventsRun.materialize gains an opt-in span_labels_table: span rows are derived by reusing label_native_run (frozen fallback EvalScorePolicy({"goal_completion": 1.0}), never an empty policy per the #468 P1 finding) BEFORE any write, so a failed session without a real span_id fails the whole publish closed - no synthetic span ids. - Rows carry the RFC tuple (trace_id, span_id, failure_category, evidence, confidence), target_kind, the frozen first-8 eval_id join identity, taxonomy_version 0.1.0, and the (job_id, import_version) pin; sync is keyed delete-then-load per pin (derived state, same convergence rule as the failed-sessions view). - Session-level failed_sessions + G1 stays the denominator, unchanged. - Thin CLI extension: evalbench-native-import --span-labels-table. - Offline fixture tests only; the EvalBench adapter (#97) stays; clock stays off; production agent_events is never written. * fix(evalbench): align span-label policy, atomic publish, pin join (#469) Address the Codex/Kimi P1 findings on the span-label publication: - One frozen policy for span rows AND the session denominator: resolve_span_label_policy resolves the CLI default (None) to the frozen EvalScorePolicy({"goal_completion": 1.0}), merges any other policy (the truthy-but-empty EvalScorePolicy({}) included) with that gate, rejects a conflicting goal_completion threshold, and passes the SAME resolved policy to label_native_run and super().materialize, so the manifest view_policy / failed_sessions view and the published span rows can never disagree about the gate. - Atomic, serialized span replacement: rows are staged into an expiring staging table, then one multi-statement transaction claims the dataset's import lock, re-checks the manifest generation the rows were derived from, and replaces the keyed slice. A load failure or a cancelled concurrent sync preserves the previously published rows (no more zero-row or duplicated slices); staging is cleaned in finally and expires regardless. - Pin-aware join boundary: a companion <span_labels_table>_pinned view (byte-verified ownership, ETag-conditional replace) is kept pinned to the job's latest publication - the same manifest row failed_sessions pins - so eval_id joins no longer fan out across retained versions; CLI help and docstring teach the job_id + import_version + eval_id join. EvalBenchImportResult reports span_labels_view. - CHANGELOG: Keep-a-Changelog bullet for #469 above the #466 entry. Offline fixture tests only; clock stays off; production agent_events is never written; the evalbench-import adapter (#97) stays. * fix(evalbench): bind span labels to policy and manifest generation (#469) Address the three Codex r2 P1 findings on the span-label publication by making the opt-in a durable, generation-checked binding: - Durable policy binding (P1 #1): a new fixed-name per-dataset registry (evalbench_span_bindings, one row per job) records the span table, the ONE resolved score policy, and the synchronized manifest generation. Every later native materialize of a bound job — span_labels_table passed or not — re-resolves the same frozen-gate policy (a conflicting goal_completion threshold is rejected) and re-derives and re-syncs the span rows, so an ordinary same-pin call can no longer rewrite the committed view_policy to NULL while the span rows stay behind. The span sync now also checks the expected canonical view_policy plus the exact generation, both in its pre-read and inside the lock-serialized transaction, so a delayed writer cannot adopt a newer generation committed under a different gate. - Fail-closed base/span generation skew (P1 #2): span rows are stamped with the exact manifest generation_id they were synchronized under, the binding upsert rides the same transaction as the row replace, and the pinned view is rendered with a latest-generation guard: it exposes rows only while its pinned generation is still the job's latest manifest generation. A changed-source same-version replace whose span sync fails therefore yields an EMPTY active view instead of exposing the previous generation's rows as if they belonged to the new base snapshot; re-running materialize heals it. - Lockstep join boundary (P1 #3): a later unlabelled import or same-pin replace of a bound job maintains the span snapshot (rows, binding, and view advance together with failed_sessions), and a bound corpus that cannot be span-labelled (no real span_id) fails the whole publish closed BEFORE the base snapshot or the denominator advances. View synchronization now targets only the generation whose span rows were just published and stands down when that generation is not the job's latest, so re-syncing an older retained version can no longer repin the view to a newer generation that has no synchronized span rows. Regressions cover: span-enabled default then ordinary same-pin call (gate and rows retained), gate re-committed between derive and sync, failed span sync after a changed-source replace (active view empty, heal on re-run), labelled v1 then unlabelled v2, labelled then unlabelled same-pin replace, unlabelable bound corpus failing before publish, bound-job span-table switch refusal, and older-version resync not repinning the view. Offline fixture tests only; the six-week clock stays off. * fix(evalbench): make span binding authoritative under import lock (#469) Apply the stored binding policy on no-policy bound calls (never re-resolve to the fallback-only gate; explicit policies stay deliberate changes), reject failed_sessions_view=None whenever span publication is active (explicit or registry-restored, CLI flags included) before anything is written, enforce one span table per job inside the span sync transaction so racing first opt-ins cannot both bind, and re-validate the binding state inside the base publish transaction and the unchanged-path policy recommit via a registry guard predicate so a stale pre-read can neither commit a snapshot nor rewrite view_policy around a binding that landed meanwhile (the registry table is created idempotently by every native publish so the guard always has an authority to read). * fix(evalbench): close span binding SQL escape and lock races (#469) Codex r4 on PR #470 (P0 x1, P1 x2): - P0: remove the public raw-SQL binding_guard hook from EvalBenchRun.materialize. The native writer now passes private structured state (_SpanBindingState): the registry reference is re-validated segment by segment before it is rendered as an identifier, the expected table/policy travel only as query parameters, and the guard SQL is always one of two fixed predicates. Any non-structured span_binding argument is rejected with TypeError before anything runs; offline regressions prove no public argument can introduce an executable statement boundary. - P1: run the unchanged-path policy recommit as its own multi-statement transaction that claims the dataset import lock before evaluating the binding guard and the expected-generation UPDATE (_RECORD_VIEW_POLICY_SCRIPT). A standalone manifest UPDATE and the span-binding transaction mutate disjoint tables, so two mutually stale snapshots could both commit under snapshot isolation; sharing the lock sentinel makes BigQuery cancel one. Deterministic offline overlap regression covers the mutually stale snapshots. - P1: reject, inside the span sync transaction and before any row or binding DML, a requested span table already bound to another job (_SPAN_TABLE_OWNED_MESSAGE). The losing concurrent job stays unbound and can retry with its own table instead of bricking on the shared table's single-owner pinned view; paused-load regression included. Offline gate: 232 passed (span labels, CLI native import, importer, native writer, span taxonomy); full offline suite 4625 passed. * fix(evalbench): require exact _SpanBindingState class at materialize (#469) Codex r5 P0: the public materialize(span_binding=...) gate used isinstance, so a _SpanBindingState subclass overriding predicate()/ parameters() could smuggle caller-shaped SQL past the two fixed guard predicates. The admission is now an exact-class check (type(span_binding) is _SpanBindingState); non-state arguments still fail with TypeError before any BigQuery call. Adds an offline regression that passes such an overriding subclass and proves TypeError with zero client calls. * fix(evalbench): authenticate pinned span view against committed refs (#469) A copied, self-consistent span view at the managed name could pass ownership: _read_managed_span_view re-rendered the expected body from the view's OWN claimed span_labels_table / manifest_table / generation, so a byte-canonical copy verified against nothing but itself, and the sync would overwrite it as managed. The read now authenticates the pin against trusted state before the view is accepted (mirroring evalbench._read_managed_view): the pin's span and manifest references must be exactly the refs this call derived (never the view's claim), and the claimed generation must be one the pinned (job_id, import_version) manifest row committed — its current generation_id or one recorded in its superseded_generations history. The authentication read is labeled _VIEW_FEATURE like the sync's own latest-manifest read. Regression covers same-job canonical copies over foreign refs, an uncommitted generation, and an unpublished version: refused fail-fast, foreign body left byte-identical, nothing published. * fix(evalbench): revalidate pre-read span binding under sync lock (#469) A delayed resync of a retained older version passes the span sync's manifest guard (its own manifest row still carries the policy and generation it derived under) and the same-table binding guard, yet its unconditional binding upsert could replace a binding a newer richer-policy sync committed meanwhile with the old values — and the next no-policy call would then recommit the newer manifest back to the stale gate, moving the failed-session denominator (Codex r9 P1). The span sync transaction now revalidates, before any span-row or binding DML, the exact binding state this call pre-read: a pre-read row must still be committed byte-for-byte (table, policy, import version, generation), and a pre-read of 'no binding' requires the job to still be unbound. The observed values travel as their own query parameters, separate from the policy/generation being installed, so a deliberate explicit policy change still replaces exactly the state it observed. Regression: pause a v1 maintenance call after its base publish, land a richer-policy v2 publish + sync, resume v1 — v1 fails closed, the v2 binding keeps the richer gate, and a later no-policy v2 call retains it.
…luators Version bump 0.5.1 -> 0.5.2 and the changelog cut for everything merged since v0.5.1 (2026-08-29), 19 commits. In the wheel: the versioned EvalBench import pipeline (#451-#453: immutable snapshots with the W0.4 failed-session contract, the version-pinned failed_sessions view, evalbench-score), the native agent_events snapshot writer (#464), the failure taxonomy frozen at G1 v0.1.0 and its span-level localisation layer with persisted span labels (#467, #470), the evaluator API unification behind PerformanceEvaluator with compatibility aliases (#123), and the canonical metric factories plus opt-in policy scorecard (#91). Repo side: skill-evolution host hooks and auditable patch provenance (#395, #477), the scheduled skill-evolution Cloud Run Job (#472), the OKF adapter example (#474), the AgentForensics Week 0 freeze and sealed preregistration (#435, #473), and the EvalBench demo and CLI-discoverability follow-ups. Entries the Unreleased section lacked are added in this cut: #91, #123 (its bullets move under Changed with the PR number), #395, #472, #474, #476.
…478) * chore(release): 0.5.2 — EvalBench snapshots, G1 taxonomy, unified evaluators Version bump 0.5.1 -> 0.5.2 and the changelog cut for everything merged since v0.5.1 (2026-08-29), 19 commits. In the wheel: the versioned EvalBench import pipeline (#451-#453: immutable snapshots with the W0.4 failed-session contract, the version-pinned failed_sessions view, evalbench-score), the native agent_events snapshot writer (#464), the failure taxonomy frozen at G1 v0.1.0 and its span-level localisation layer with persisted span labels (#467, #470), the evaluator API unification behind PerformanceEvaluator with compatibility aliases (#123), and the canonical metric factories plus opt-in policy scorecard (#91). Repo side: skill-evolution host hooks and auditable patch provenance (#395, #477), the scheduled skill-evolution Cloud Run Job (#472), the OKF adapter example (#474), the AgentForensics Week 0 freeze and sealed preregistration (#435, #473), and the EvalBench demo and CLI-discoverability follow-ups. Entries the Unreleased section lacked are added in this cut: #91, #123 (its bullets move under Changed with the PR number), #395, #472, #474, #476. * chore(release): file the skill-evolution bullets as repo-side scripts/skill_evolution.py is not in the wheel (which ships only src/bigquery_agent_analytics and src/bigquery_ontology), so the #395 and #397 entries move from Added to their own repo-side section, matching the Deploy section this cut already uses for #472.
Implements #466 (parent #435, AgentForensics RFC Phase 2: span-level trace auditing).
Based on merged #464 / latest
main(squash04dcadb— nativeagent_eventswriter + pin identity + G1 v0.1.0 freeze files). This PR is no longer stacked on an unmerged #464 head; the branch was rebased onto the #464 squash, so the diff vsmainis exactly this slice's unique content. The unique commits remain the span G1 taxonomy slice (44d0499feature +0d37fcdreview fix, formerly35e40f2+a7fd389). This PR still MUST NOT include or merge #456–#465, #468, or #470 — in particular it does not include #465 (native freeze e2e demo, head2169889), #462, #468, or #470.What this adds
A small span-level G1 localization layer,
bigquery_agent_analytics/span_taxonomy.py:SpanFailureLabel— one G1-frozen category localized to one real native span;as_tuple()is the RFC shape(trace_id, span_id, failure_category, evidence, confidence). Extra fields keep the label joinable (session_id,eval_id) and inspectable (target_kind, Promote correction/anti-parroting trace analysis to core (turn tagging + sub_trajectories) #429turn_index).label_failed_session_spans(session_events, verdict, *, eval_id, gold_events)— given one failed session's raw nativeagent_events-shaped rows plus the landed three-flag verdict, emits one label per tripped frozen category on the span where the failure is observable: the first rawstatus=ERRORrow when one exists (target_kind="span", evidence carries itserror_message), otherwise the last existing span as the silence boundary (target_kind="gap_after_span").label_native_run(run, *, policy)— offline convenience over aNativeAgentEventsRun: computes the session-level denominator exactly as the landed contract does (classify_sessions+ deterministicgoal_completionfacts) and localizes each failed session; completed siblings in the run supply the missing-tool evidence pool.On the widget-stock silence session
7e352c34(full id7e352c34-4c1c-4395-acd5-fb3c8f215346): session-level G1 still yieldstask/planning,finalization,tool blockers(unchanged), and all three localize to the realAGENT_STARTINGspan — the last existing span — with evidence stating that no subsequentTOOL_STARTINGoccurred andcheck_inventorywas never called (the completed sibling called it), and that noAGENT_COMPLETEDfollowed. The AGENT_STARTING → silence punchline is now an inspectable localized row.Contracts honored
failed_sessions+ G1 remains the denominator; span labels localize, they never classify or replace it.classify_sessions/SessionVerdict/failure_taxonomy.categorize_failed_sessionare untouched.g1_frozen: true;SpanFailureLabelrejects any non-frozen category string at construction (test-pinned). No SANA fork, no new category names.span_idis drawn from the inputagent_eventsrows; the gap marker is evidence anchored to the real last span; rows without aspan_idfail closed withValueError(test-pinned).eval_id = session_id[:8], fullsession_idon first-8 collision (reuses_native_scenario_ids); span labels join the sameeval_idthefailed_sessions/ G1 contract uses (collision test included).sub_trajectoriesanchoring (USER_MESSAGE_RECEIVEDturns); no parallel span model — inputs are the sameagent_eventsrowstrace.Spanreads.evalbench-importadapter (Add EvalBench bridge: import EvalBench BigQuery runs into a BQAA-owned mirror table #97) is untouched; the native path remains source of truth. No CLI changes in this slice.agent_events: the module is pure/deterministic — no BigQuery client, no writes, no live/LLM judge, no--synth. Fixture-only offline tests (14 new; full suite 4524 passed).Human gate
Review: @haiyuan-eng-google. Do not merge without the human gate; do not merge #456–#465 through this PR.