Repository navigation
feat(examples): live ADK+BQAA observe trace → derived OKF adapter - #474
haiyuan-eng-google merged 5 commits into
Conversation
Observer-only adapter whose source of truth is a real ADK observe agent plus the committed BQAA agent_events export, not the synthetic germany fixture. Fail-closed lookup; germany hashing remains a labelled regression.
caohy1988
left a comment
There was a problem hiding this comment.
Kimi
HEAD SHA: c0806b52aded58f8eabc2176ffeb48ffe33b86cd
Verdict: COMMENT-NOT-LGTM (P0=0 P1=1)
P0
(none)
P1
- Demo gate not met — live export has 15 events, not >=100.
examples/okf_bqaa_adapter/fixtures/live_observe_agent_events.jsoncontains exactly 15 events (3 LLM_REQUEST, 3 LLM_RESPONSE, 2 TOOL_STARTING, 2 TOOL_COMPLETED, 1 USER_MESSAGE_RECEIVED, 1 AGENT_STARTING, 1 AGENT_COMPLETED, 1 INVOCATION_STARTING, 1 INVOCATION_COMPLETED), andfixtures/live.json:12pins"event_count": 15. The stated demo gate is n>=100; a single-turn run with two tool calls does not demonstrate the adapter against a non-trivial trace. This blocks LGTM until a >=100-event live export is committed (or the gate is explicitly renegotiated). Notelive.jsonis honest about the count — this is a scope gap, not a mislabel.
P2
fixtures/live.json:11—ran_at: 2026-09-03T03:49:30.956970+00:00(andexported_atin the events fixture) is ~1 day in the future relative to the review date (2026-09-02). Same clock-skew smell as the Week 0 sealing note. Doesn't invalidate the trace, but it weakens the "reviewers can re-query and compare" claim — worth normalizing before re-running for the 100-event gate.tests/examples/test_okf_bqaa_adapter.py:99-101— the_fixtureassertion is effectively tautological ("SYNTHETIC" not in ... or "LIVE" in ...): any string containing "LIVE" passes even if it also says SYNTHETIC. The next line'sstartswith("LIVE BQAA export")does the real work; consider dropping the weak clause.
Evidence (verified at c0806b5)
- Live, not germany, not consume stub: export
session_id = 1e6dfed7-27ce-4c4d-b2e7-c45de7c241d1,trace_id = e-51cdf04f-..., uniform across all 15 events. Neithersess-4c1f9a2e7b3d(germany) nor04fa3d56-f2f1-413e-8c2b-ec116835af84(consume stub) appears anywhere in the fixture. Livepublication_id sha256:bb95e037...andobserved_publication_id sha256:674153c5...are distinct from the germany pina25e1c0ccbca...;test_live_identities_are_not_germanyasserts this. - Retrieve/receipt shaped, live plugin shape: both OK TOOL_COMPLETED rows carry
content.result.kind=okf-context:retrieveandokf-context:attested-computation(kind oncontent.result, notattributes.tool.kind— asserted in the test). Receipt verdict isUNVERIFIABLEwithverdict_reason: "no-execution; observer-only demo, nothing attested"andreceipt_id: rcpt-observe-noexec— nothing ATTESTED; the only "ATTESTED" strings are the instruction text and the model correctly reporting the number is unproven. - Model: all 3 LLM_REQUEST rows carry
attributes.model = gemini-3.8-flash;observe_agent.pydefaultsDEMO_MODEL_ID=gemini-3.8-flashandcheck_modelfail-closes on2.5/3.5/flash-latestbefore agent construction. - Fail-closed lookup:
lookup(unknown)raisesUnknownContextRefError, CLI exits 2 (tested with the germany refokf:env-demo#a25e1c0ccbcaand""). Never-emit list matches spec §4 exactly (9 keys); deep scan of both TOOL_COMPLETED payloads is clean;lookup.NEVER_EMIT == adapter.NEVER_EMITpinned by test. - Consume-stub rejection:
require_retrieve_shapedrejects a stub-echo trace built from the live export (both retrieve-kind and receipt-kind absence tested). - Plugin/agent hygiene:
BigQueryLoggerConfig(batch_size=1, shutdown_timeout=20.0, max_content_length=64*1024);InMemoryRunnersession created beforerun_async; tools read only the in-processOBSERVED_CATALOG, nevercymbal-finance-core. - Synthetic labelling:
fixtures/synthetic/README.mdand the germany test are explicitly labelled SYNTHETIC hashing regression; live_fixturesays "LIVE BQAA export" and never claims SYNTHETIC. - Adapter purity / repo hygiene:
adapter.pyis stdlib-only (nogoogle.*imports; test greps source). Diff touches onlyexamples/okf_bqaa_adapter/+tests/examples/—.refs-okf/not in the PR,src/untouched, no secrets found. - Tests:
pytest tests/examples/test_okf_bqaa_adapter.py -q→ 15 passed (hermetic, no GCP).
|
Kimi HEAD: Verdict: CHANGES REQUESTED The adapter code, observe agent, fail-closed behavior, tests, and fixtures are all in good shape against P0None.
P1
P2
Evidence
|
caohy1988
left a comment
There was a problem hiding this comment.
Codex
HEAD SHA: c0806b52aded58f8eabc2176ffeb48ffe33b86cd
Verdict: COMMENT-NOT-LGTM (P0=0 P1=2)
P0
(none)
P1
examples/okf_bqaa_adapter/fixtures/live.json:12- The committed live export has exactly 15 events, below the requiredn >= 100demo gate. The live BigQuery session also currently returns 15 rows, and the test only asserts that the fixture length equals its own metadata. This blocks LGTM. Commit a genuine live export with at least 100 events, regeneratelive.jsonandlive_identities.jsonfrom that session, and add ann >= 100assertion; do not pad or synthesize events.examples/okf_bqaa_adapter/observe_agent.py:201(alsoobserve_agent.py:406andadapter.py:336-341) - Receipt binding is not fail-closed. Both producer/export checks usestartswith, whilerequire_retrieve_shaped()only requires that some receipt exists. I reproduced an unrelated receipt reference passing the gate and then being added bymapping_for()as a valid lookup key. Require non-empty exact equality between the retrieve and receiptcontext_refat all three boundaries, with negative tests for unrelated and suffix-appended references.
P2
(none)
Evidence
- Read-only BigQuery verification returned 15 rows for session
1e6dfed7-27ce-4c4d-b2e7-c45de7c241d1; all selected exported columns matched the 15 committed event rows after JSON normalization. The rows are for tracee-51cdf04f-7c34-48b7-8a3f-f2315073bfc1, agentokf_rfc_observe_agent, and modelgemini-3.8-flash. - The live session has OK
TOOL_COMPLETEDrows forokf-context:retrieveandokf-context:attested-computation, with kind undercontent.result.kind. Both useokf:env-observe#674153c572f6. The receipt verdict isUNVERIFIABLEwith reasonno-execution; observer-only demo, nothing attested; no receipt isATTESTED. - The consume-stub session
04fa3d56-f2f1-413e-8c2b-ec116835af84re-queries asokf_rfc_consume_agentwithlookup_okf_contextand no OKF completed kinds, so it fails the retrieve-shaped check and is not the committed live session. - The Germany fixture is explicitly labelled
SYNTHETIC, uses sessionsess-4c1f9a2e7b3d, and is only the hashing regression. The live derived publication ID issha256:bb95e037919afc71e38454b70cd67f118af3c9804b8d3e6596049d1fc1f823df, distinct from Germany'ssha256:a25e1c0ccbcad270bf9e3b7a8f792167795381b6880bdc8a1ccde8df40ea52c5. The live_fixturestarts withLIVE BQAA export, notSYNTHETIC. DEMO_MODEL_IDdefaults togemini-3.8-flash; isolated checks refused2.5,3.5, andflash-latest. The plugin usesbatch_size=1;create_sessionprecedesrun_async; the tools read only the in-process observed catalog and execute nothing.- The nine-key never-emit list matches
adapter.js,spec.md,adapter.py,lookup.py, and the live fixture; the committed tool payload scan found zero violations. Known lookup succeeds and unknown/empty refs fail closed.adapter.pyandlookup.pyimport neithergoogle.cloudnorgoogle.adk. pytest -p no:cacheprovider tests/examples/test_okf_bqaa_adapter.py -qpassed: 15 tests. The PR changes onlyexamples/andtests/;.refs-okf/andsrc/bigquery_agent_analytics/are absent from the diff, and the diff secret-pattern scan was empty.
The observe agent is multi-turn under one session_id; a 15-row smoke is not the demo. germany remains a labelled hashing regression.
Run 12 retrieve+receipt turns in one session_id, export 180 real agent_events, isolate the CLI test from a preloaded google.adk, and pin len(events) >= 100.
Prefix matches no longer bind. Producer, export, and require_retrieve_shaped require non-empty equality; unbound receipt refs are not lookup keys. SYNTHETIC germany keeps its GoogleCloudPlatform#2 hashing suffix.
caohy1988
left a comment
There was a problem hiding this comment.
Kimi
HEAD SHA: 476d37dc9d4210a335c2f77e78003f6a5ebe2878 (confirmed via git rev-parse HEAD)
Verdict: COMMENT-LGTM
Both P1s from my review of c0806b5 are fixed, and no new P0/P1 found.
P0
None.
- Observer-only holds: tools still read only the in-process
OBSERVED_CATALOG(examples/okf_bqaa_adapter/observe_agent.py:120-152); no authoredcymbal-finance-coreread, no SQL execution; the only writes are local fixture files inexport_session. No Catalog/Dataplex/kcmd writes. - Nothing ATTESTED: all 12 receipts in the live export carry verdict
UNVERIFIABLE/no-execution; observer-only demo, nothing attested;"verdict": "ATTESTED"occurs zero times in the fixture; "ATTESTED" appears only in the negated instruction text ("if the verdict is not ATTESTED, say plainly that the number is unproven"). - Model is
gemini-3.8-flashinlive.json, the fixture header, and all 36 LLM_REQUEST attribute rows;check_modelstill refuses2.5/3.5/flash-latest(observe_agent.py:167-175). - No secrets in committed fixtures.
- Germany still not the demo source of truth: default input is the live export; the germany fixture keeps its
#2hashing suffix and is exercised only via the SYNTHETIC branch ofadapt(adapter.py:562-573) in a skipif-marked hashing regression;test_live_identities_are_not_germanystill pins the live triple as distinct (live publication_idsha256:53bd1651…, germanysha256:a25e1c0c…). - Never-emit clean: deep-scan of every TOOL_STARTING/TOOL_COMPLETED
content.resultacross all 180 rows finds zero hits.
P1
None — both prior P1s resolved.
- n>=100 gate: FIXED.
fixtures/live.json:12pinsevent_count: 180, equal tolen(events)infixtures/live_observe_agent_events.json(36 LLM_REQUEST / 36 LLM_RESPONSE / 24 TOOL_STARTING / 24 TOOL_COMPLETED / 12× USER_MESSAGE_RECEIVED / INVOCATION_STARTING / AGENT_STARTING / AGENT_COMPLETED / INVOCATION_COMPLETED). Session is the new multi-turnf21ee192-d989-4c38-894f-66b6b82eaf18— not the 15-row1e6dfed7-…smoke, not germany, not consume04fa3d56-….export_sessionnow hard-gateslen(rows) < MIN_EVENTS (100)withSystemExit("15-row smokes are not the demo";observe_agent.py:451-455), and the multi-turn loop keeps asking in the same session until >=100 rows (observe_agent.py:321-343). Tests now assertlen(events) >= 100and>= 10USER_MESSAGE_RECEIVED turns (tests/examples/test_okf_bqaa_adapter.py:104-110) — my prior P2 about the unpinned count is also addressed. - Receipt binding: FIXED.
refs_boundis non-empty exact equality (adapter.py:327-334); the oldstartswith(ENVELOPE_REF)is gone from the producer (observe_agent.py:225), the export gate (observe_agent.py:471),require_retrieve_shaped(adapter.py:351), andmapping_for(adapter.py:706), which now never indexes an unbound receipt ref. Negative tests cover suffix-appended (ref + "/extra"), unrelated (okf:env-other#deadbeef), and empty refs at both therefs_boundunit level and therequire_retrieve_shapedlevel, plus amapping_forexclusion test (test_okf_bqaa_adapter.py:330-362). - Lookup fail-closed: unchanged (
UnknownContextRefError, CLI exit 2), still tested with known/unknown/empty refs. - Consume session
04fa3d56-…still only the reject case; the stub-echo shape is still rejected byrequire_retrieve_shaped.
P2
observe()picks the first retrieve envelope and the last receipt (adapter.py:292, 295). With 12 turns this works because every turn emits the same ref, but a mixed-ref trace would silently bind last-receipt to first-retrieve. Consider asserting all retrieve/receipt refs are uniform, or pairing per-invocation. Advisory only —require_retrieve_shapedalready fails closed on any mismatch between the pair it picks.fetch_session_rowstreats a stable row count as "done" (observe_agent.py:425-436); two consecutive equal polls during a long model call could truncate an export. TheMIN_EVENTSgate catches the small-export case, so advisory only.
Evidence
- event_count: 180 (==
live.json.event_count, >= 100; all rows status OK, single uniform session) - session_id:
f21ee192-d989-4c38-894f-66b6b82eaf18; trace_ide-c7214361-4017-43d7-af4e-cddfe51b09a4; agentokf_rfc_observe_agent; tabletest-project-0728-467323.okf_rfc_demo.agent_events - model:
gemini-3.8-flash(36/36 LLM_REQUEST rows) - kinds:
okf-context:retrieve+okf-context:attested-computationpresent on OK TOOL_COMPLETED rows (12 each); all receipt context_refs exactly equal the retrieve refokf:env-observe#674153c572f6 - refs_bound exact: yes —
==with non-empty check; nostartswithremains on the bind path - negative tests present: suffix-appended, unrelated, and empty receipt refs all fail closed; mapping never indexes an unbound ref
- live identities re-pinned for the new session (
live_identities.jsoninputs.session_id matches; distinct from germany) - hermetic tests: 18 passed at this SHA (
tests/examples/test_okf_bqaa_adapter.py), including the SYNTHETIC germany hashing regression against the pinned JS triple
caohy1988
left a comment
There was a problem hiding this comment.
Codex
HEAD SHA: 476d37dc9d4210a335c2f77e78003f6a5ebe2878
Verdict: COMMENT-LGTM (P0=0 P1=0)
P0
(none)
P1
(none)
P2
(none)
Evidence
- The committed live fixture has 180 events, exactly matching
fixtures/live.json.event_count, in sessionf21ee192-d989-4c38-894f-66b6b82eaf18. It is neither the prior 15-row smoke session, Germanysess-4c1f9a2e7b3d, nor consume stub04fa3d56-f2f1-413e-8c2b-ec116835af84. - A read-only BigQuery check independently returned 180 rows, 12 invocations, 12 retrieve completions, and 12 attested-computation receipt completions for that session. The committed timestamps match the table span.
- All LLM request rows use
gemini-3.8-flash. The live tool rows contain bothokf-context:retrieveandokf-context:attested-computationundercontent.result.kind. - Retrieve and receipt refs are the same non-empty value,
okf:env-observe#674153c572f6.refs_bound()uses exact equality;startswith(ENVELOPE_REF)is absent from producer/export code. Tests reject suffix-appended, unrelated, empty, and null refs. - All 12 receipts are
UNVERIFIABLEwithno-execution; zero areATTESTED. The example remains observer-only and the tool payload never-emit scan is empty. - Unknown lookup refs fail closed. The recomputed live publication ID is
sha256:53bd1651c43f69d53f591e4f91e3ccdda4640d8b36cb1dce1ac97328ffa39a77, distinct from the SYNTHETIC Germany hashing pinsha256:a25e1c0ccbca.... - Germany remains explicitly labelled SYNTHETIC hashing-only and is not the default/demo path. No
.refs-okf/orsrc/files are in the PR, and the reviewed example diff contains no detected secrets. - Hermetic verification passed:
18 passedfortests/examples/test_okf_bqaa_adapter.pywithout runningobserve_agent.pyor creating a live ADK session.
caohy1988
left a comment
There was a problem hiding this comment.
Codex
HEAD SHA: 476d37dc9d4210a335c2f77e78003f6a5ebe2878
Verdict: COMMENT-LGTM
P0
(none)
P1
(none)
P2
(none)
Evidence
fixtures/live.jsonreportsevent_count=180;len(events)inlive_observe_agent_events.jsonis also 180. All events use sessionf21ee192-d989-4c38-894f-66b6b82eaf18(not the prior 15-row, synthetic Germany, or consume sessions), with 12 user turns.- Model:
gemini-3.8-flash. Tool kinds present:okf-context:retrieveandokf-context:attested-computation(12 completed rows each). refs_bound()is fail-closed non-empty exact equality (retrieve_ref == receipt_ref). It gatesokf_run_attested_computation,export_session,require_retrieve_shaped, andmapping_for; producer/export contain nostartswith(ENVELOPE_REF)binding.- Negative coverage is present for suffix-appended, unrelated, empty, and null receipt refs; unbound receipt refs are not indexed by
mapping_for. - Unknown lookups fail closed. Tool-payload never-emit checks are empty, the reviewed example files contain no detected credential patterns, and all 12 receipt verdicts are
UNVERIFIABLEwith nothing attested. - The committed input is labelled
LIVE BQAA export; Germany remains explicitlySYNTHETIChashing-only and is not the demo/default path. - Hermetic verification:
pytest -q tests/examples/test_okf_bqaa_adapter.py→18 passed in 0.06s. No ADK or live GCP run was performed.
…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.
Summary
examples/okf_bqaa_adapter/: a real ADK observe agent (okf_rfc_observe_agent,gemini-3.8-flash, Vertexglobal) writes retrieve/receipt-shaped rows throughBigQueryAgentAnalyticsPluginintotest-project-0728-467323.okf_rfc_demo.agent_events.fixtures/live_observe_agent_events.json+fixtures/live.jsonare the adapter input and the demo proof (not the synthetic germany fixture).okf-bqaa-adapter:v0). Live identities are new and correct. germany hashing, if present, is labelled synthetic.lookup(context_ref)viamapping.json. never-emit scan empty.--sessionrejects non-retrieve traces (consume session04fa3d56-…fails closed).cymbal-finance-coreread/write. Not RFC: AgentForensics collaboration — automated failure taxonomy and span-level trace auditing over BQAA traces #435. derived/demo. Do not merge.Live run:
1e6dfed7-27ce-4c4d-b2e7-c45de7c241d1e-51cdf04f-7c34-48b7-8a3f-f2315073bfc1test-project-0728-467323.okf_rfc_demo.agent_eventsgemini-3.8-flashglobal2026-09-03T03:49:30.956970+00:00(2026-09-02 8:49 PM PT)c0806b52aded58f8eabc2176ffeb48ffe33b86cdArtifacts: intent.md, spec.md, plan.md.
Test plan
pytest tests/examples/test_okf_bqaa_adapter.py(hermetic, no GCP) — 15 passedbash autoformat.shcleanderived/demo, observer-only, not #435, do not merge.