fix: filter adk_request_confirmation events from LLM history#683
Open
odsod wants to merge 1 commit intogoogle:mainfrom
Open
fix: filter adk_request_confirmation events from LLM history#683odsod wants to merge 1 commit intogoogle:mainfrom
odsod wants to merge 1 commit intogoogle:mainfrom
Conversation
w1t
reviewed
Mar 26, 2026
5123c11 to
db18fed
Compare
When the tool confirmation (HITL) flow injects adk_request_confirmation FunctionCall/FunctionResponse parts into the session history, these must not be sent back to the LLM — the model never declared this function and will reject or misinterpret it. Add isConfirmationEvent to the contents processor to strip these events during history construction, mirroring the existing isAuthEvent filter for adk_request_credential.
db18fed to
f3152cb
Compare
Author
|
@w1t hi! anything more I can do on this one, or do you think we can get this included in the next release? |
|
want to confirm this filtering only happens during message creation and that confirmations are persisted to the session store for compliance |
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.
Description
buildContentsDefaultincontents_processor.gofiltersadk_request_credentialevents from LLM history viaisAuthEvent(), but has no equivalent foradk_request_confirmationevents.When using a persistent session store (anything other than
InMemorySessionService), confirmation events are replayed into the Gemini context on the next turn, causing a 400 error — Gemini sees FunctionCall/FunctionResponse parts foradk_request_confirmation, a function it never declared.Changes
isConfirmationEvent()function incontents_processor.go, mirroringisAuthEvent()buildContentsDefaultto skip confirmation eventsTesting
All existing tests pass. New tests:
ConfirmationFunctionCallEvent— verifies FunctionCall withadk_request_confirmationis filteredConfirmationFunctionResponseEvent— verifies FunctionResponse withadk_request_confirmationis filteredConfirmationEventsFilteredFromHistory— verifies confirmation events are stripped while regular tool call events are preservedFixes #682