Skip to content

fix(weave): support google-adk 2.3.0+ trace_inference_result signature#7560

Merged
neutralino1 merged 2 commits into
masterfrom
fixit/adk-trace-inference-result-3arg
Jul 11, 2026
Merged

fix(weave): support google-adk 2.3.0+ trace_inference_result signature#7560
neutralino1 merged 2 commits into
masterfrom
fixit/adk-trace-inference-result-3arg

Conversation

@fixit-agent

@fixit-agent fixit-agent Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Weave's Google ADK integration is incompatible with google-adk >= 2.3.0 (including 2.4.0). ADK prepended a leading invocation_context argument to trace_inference_result in 2.3.0:

ADK version Signature
≤ 2.2.0 trace_inference_result(span, llm_response)
≥ 2.3.0 trace_inference_result(invocation_context, span, llm_response)

_wrap_trace_inference_result still declared and called the original with the old 2-arg form (original(span, llm_response)), so once Weave's patch is applied on ADK ≥ 2.3.0, every ADK inference raises TypeError. The test shard installs google-adk>=2.2.0, which now resolves to 2.4.0.

Fix

weave/integrations/google_adk/google_adk_sdk.py:

  • The wrapper now accepts *args and forwards them verbatim to the same-version original — so it calls ADK with exactly the arguments ADK handed it, regardless of shape.
  • It then reads the span and response off the tail two positions (args[-2], args[-1]). ADK kept span and llm_response in the same relative order and only prepended invocation_context, so tail-based extraction is correct for both the 2-arg and 3-arg forms. ADK always calls this function positionally, so *args captures every case.
  • _TraceInferenceResult is broadened to the open Callable[..., None], matching the existing _TraceToolCall pattern already used in this file for ADK's cross-release signature churn.

This keeps compatibility with ADK >= 1.36 — no version sniffing required.

Testing

  • Added test_trace_inference_result_supports_3arg_signature — drives the wrapper with the new 3-arg shape, asserts the leading arg is forwarded to the original and the span is still enriched from the trailing response.
  • The existing 2-arg partial-chunk test still passes, confirming backward compatibility.
  • End-to-end proof: the google_adk shard installs google-adk 2.4.0 (the exact 3-arg version from the report), and TestAdkRunnerE2E::test_emits_all_otel_attributes — which drives a real ADK InMemoryRunner through a full inference loop — passes. On the old code this test raised TypeError on every inference.
15 passed in 20.19s   # nox tests-3.12(shard='google_adk')

Lint (ruff check) passes on both changed files.


🤖 Opened by Fixit
Requested by: Emmanuel Turlay
Slack thread: https://weightsandbiases.slack.com/archives/C0APFJB2H5E/p1783722806526949
View session: https://fixit.withwandb.com/session/fix-6a51734a-f9df9fc3

ADK prepended a leading invocation_context argument to
trace_inference_result in 2.3.0, turning (span, llm_response) into
(invocation_context, span, llm_response). The wrapper still called the
original with the old 2-arg form, so every inference against google-adk
>=2.3.0 (e.g. 2.4.0) raised TypeError.

Forward *args verbatim to the same-version original and read the span and
response off the tail two positions, whose relative order is stable across
both shapes. Works for ADK >=1.36 without a signature mismatch.
@fixit-agent fixit-agent Bot requested a review from a team as a code owner July 10, 2026 22:40
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
weave/integrations/google_adk/google_adk_sdk.py 33.33% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

The *args-based wrapper lost the concrete types of span and llm_response,
so mypy flagged .partial access and the _unwrap_inference_span /
set_llm_response_attributes calls as object-typed. Cast the tail two
positional args to their known types (ADK only prepended
invocation_context; span/llm_response keep their relative order).
@neutralino1 neutralino1 merged commit 2ecc82b into master Jul 11, 2026
106 of 107 checks passed
@neutralino1 neutralino1 deleted the fixit/adk-trace-inference-result-3arg branch July 11, 2026 00:07
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants