Repository navigation
Conversation
Merge standalone Live usage into compatible model events during evaluation conversion, retaining unmatched reports without mutating session events. Fixes google#7321
4 of 6 tasks
Replace the implementation-specific tag with a TODO describing the existing quadratic scan and indexing boundary. No counting or usage behavior changes.
Keep both the Live usage regressions and the upstream model/tool duration test. The PR still changes only the evaluation converter and its existing test module. NO_UNIT_GUIDE=Merge-only sync; flagged modules are unchanged upstream additions, and this PR introduces no Python modules.
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 31, 2026
Merge #7323 Gemini Live may send token usage separately from response content, and evaluation conversion dropped those reports. Preserve usage-bearing events, including empty and non-text content, and merge standalone usage into a compatible model event (same author, model and Live connection) without mutating input events or adding inference calls. A report with no compatible model event is kept and counts as the one model call it represents. Fixes #7321 Co-authored-by: Yi Liu <yiliuly@google.com> COPYBARA_INTEGRATE_REVIEW=#7323 from yang0228:codex/7321-live-eval-usage 2d2d71d PiperOrigin-RevId: 1011019927
Collaborator
yang0228
added a commit
to yang0228/adk-python
that referenced
this pull request
Nov 8, 2026
Merge upstream main 1cb926d after the prerequisite google#7323 landed via Copybara. Keep its standalone-usage matching and all upstream regressions, track surviving source events for logical Live counts, and adapt the receiver test helper to the current Live module. Refs google#7351 NO_UNIT_GUIDE=Merge imports already-published upstream modules; this PR adds no source modules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Closes #7321. Related: #7351; dependent PR #7427.
Problem: Gemini Live may send token usage separately from response content. Evaluation conversion drops these reports. Retaining each report as another model event would also inflate the existing inference count.
Solution: Preserve usage-bearing events, including empty and nontext content, and merge standalone usage into a compatible model event without changing input events or overwriting existing usage. Match author, model, and Live connection identity; retain unmatched usage independently. This PR preserves the existing per-event/chunk inference count. #7427 changes logical-request counting separately.
2026-10-19 refresh: merged main
04b8b6011ed6335febeef77631f137613d471348at2b2f249c2b33953fe1020c79cde05ed8a98b8c64, preserving published history. Resolved the test import and end-of-file conflicts by retaining both this PR's Live usage regressions and upstream's model/tool-duration integration test. The original PR delta remains two files, 324 insertions / 3 deletions; the refresh adds no new product behavior.Testing Plan
Fresh checks at
2b2f249c2with the repository's Python 3.12 constraints (google-genai2.30.0):NO_UNIT_GUIDEreason records that flagged new modules belong to upstream main; this PR adds no Python modules.evaluation_generator.pywith the constrained Python 3.12 environment: success, no issues. Unchanged main passes the same command.site-packages.04b8b6011: 16 failed / 2 passed, confirming that the reported bug remains reproducible. The two passing cases are the no-usage controls.The real
GeminiLlmConnection.receive()adapter, conversion, and efficiency evaluators run with deterministic transport. Before/after/combined/absent usage is covered for one and two chunks. Reported usage remains 15 tokens, final text remainsHello, and the inference count remains the chunk count. Nontext content, separate model calls/invocations, author/model/connection mismatches, and input immutability are covered.Full-suite verification and limits
The repository's
tox.iniconfigures Python 3.11–3.14. Three full suites completed with the committed per-version constraints:Each completed full suite additionally reported 19 xfailed, 2 xpassed, and 42 passed subtests. All 54 failure IDs were individually rerun on unchanged main
04b8b6011in each corresponding environment, and all 54 failed there too. None is in the changed evaluation modules. These are not all-green full suites.The full environments use
google-genai2.30.0, bothgoogle-cloud-agentplatformandgoogle-cloud-aiplatform2.3.0, and Pydantic 2.13.4, as pinned by the repository.Python 3.14: the pinned
litellm==1.95.0needs a source build on this host. Its Rust toolchain bootstrap did not complete; the stalled setup was stopped. A separate focused installation of the base wheel and the dependencies used by these tests, excluding optional GEPA/LiteLLM, passed 216 related source tests / 29 warnings and 19 installed-wheel tests / 4 warnings on Python 3.14.6 withgoogle-genai2.30.0. This verifies the affected paths, not the full[test]or[eval]environment on 3.14.No
uv.lockis present, so the following temporary overrides were used without changing repository configuration:Initial concurrent installs hit a 300-second shared-cache lock timeout; the failed environments were retried with a longer lock timeout and reduced download concurrency. The completed results above are retained, including their baseline failures.
The common 54 failures are distributed as follows:
tests/unittests/integrations/vmaas/test_agent_engine_environment.pylabs/antigravity/test_antigravity_agent.pylabs/antigravity/test_event_converter.pytest_release_dependencies.pytools/mcp_tool/test_mcp_session_manager.pytools/test_load_web_page.pyExact failure IDs reproduced on unchanged main for Python 3.11, 3.12, and 3.13
Checklist
Landing order
Please land this usage-only fix before #7427. That dependent PR changes
== len(chunks)to== 1when logical-request grouping is introduced. #7427 was not changed during this refresh; it will need synchronization and removal of the inherited diff after this prerequisite lands.The refreshed head is conflict-free on GitHub. Maintainer review and approval of the external-contributor workflow runs remain pending. The deterministic checks do not establish remote Gemini ordering, billing semantics, or release integration.