fix(adk-middleware): emit REASONING_ENCRYPTED_VALUE for function_call thought signatures#2073
Open
ferponse wants to merge 6 commits into
Open
fix(adk-middleware): emit REASONING_ENCRYPTED_VALUE for function_call thought signatures#2073ferponse wants to merge 6 commits into
ferponse wants to merge 6 commits into
Conversation
… thought signatures Gemini attaches thought_signature (the encrypted chain-of-thought that led to a tool call) to the function_call part rather than the thought-text part. The reasoning path in _translate_reasoning_content only reads signatures from thought-text parts, so REASONING_ENCRYPTED_VALUE was never emitted for tool calls and the encrypted reasoning was silently dropped. Add _translate_function_call_signatures() to read thought_signature from function_call parts and emit ReasoningEncryptedValueEvent(subtype="tool-call", entity_id=<toolCallId>), mirroring the existing subtype="message" emission for thought-text parts. Deduplicated per tool call id so partial/non-partial replays don't emit it twice. Adds two focused tests covering the tool-call signature and no-signature cases. Fixes ag-ui-protocol#2072
|
Someone is attempting to deploy a commit to the CopilotKit Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
@contextablemark could you sanity-check this fix — emitting REASONING_ENCRYPTED_VALUE for thought signatures that live on function_call parts (issue #2072)? Want to confirm it matches your understanding. |
9 tasks
Without this, the set grew unbounded across sequential runs sharing one translator, and after reset() a reused tool-call id could have its REASONING_ENCRYPTED_VALUE emission wrongly suppressed. Addresses review comment from contextablemark on PR ag-ui-protocol#2073. Co-authored-by: Atenea Agent <svc_atenea_gitlab@ofidona.net>
Author
|
Thanks @contextablemark! Added |
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.
What & why
Fixes #2072.
The ADK middleware never emits
REASONING_ENCRYPTED_VALUE, even with Gemini thinking enabled, because it only readsthought_signaturefrom thought-text parts. In practice Gemini attaches the signature to thefunction_callpart (the encrypted chain-of-thought that led to the tool call), so the encrypted reasoning was silently dropped.Verified against Gemini 2.5 Flash on Vertex AI (
ag-ui-adk0.7.0 /google-adk2.3.0), inspecting every part of a run with two tool calls:REASONING_ENCRYPTED_VALUEcount across 3 runs before this change: 0.Change
EventTranslator._translate_function_call_signatures(): readsthought_signaturefromfunction_callparts and emitsReasoningEncryptedValueEvent(subtype="tool-call", entity_id=<toolCallId>, encrypted_value=base64(sig)), mirroring the existingsubtype="message"path for thought-text parts.translate(), covering both LRO and non-LRO calls in the event._emitted_signature_tool_call_ids) so partial/non-partial replays of the same call don't emit it twice.The AG-UI spec already defines
ReasoningEncryptedValueEventwithsubtype: "tool-call"for exactly this case.Tests
test_event_translator_comprehensive.py:function_callpart with athought_signature→ oneREASONING_ENCRYPTED_VALUEwithsubtype="tool-call", correctentity_idand base64 payload;function_callpart without a signature → none emitted.integrations/adk-middleware/python): 920 passed, 0 failed.