Repository navigation
Conversation
POST /apps/{app}/users/{user}/sessions appended client-supplied events
verbatim. A client could seed an agent-authored adk_request_confirmation
call and approve it on the next /run, running a confirmation-gated tool
with arguments the user never saw, or write "app:" and "user:" state
through an event's Actions.StateDelta.
Port adk-python's _validate_session_initialization_events: reject any
initialization event that carries event actions, long-running tool IDs,
or an adk_request_confirmation, adk_request_credential or
adk_request_input call or response, before the session is created.
Adapted for 1.x: tool/toolauth and workflow do not exist here, so the
credential and input call names are spelled out; the REST event has no
routes or requestedInput, so those checks and their tests are dropped;
the server has no authn, so the shared-state test uses one server; and
internal/llminternal/auth_preprocessor.go, whose doc comment google#1995
updated, does not exist here.
(cherry picked from commit 57c6bd8)
karolpiotrowicz
approved these changes
Nov 23, 2026
This branch has not been deployed
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.
Summary
Backports #1995 to the 1.x line.
POST /apps/{app}/users/{user}/sessionsappends the client'seventsverbatim. On v1 a client can seed an agent-authoredadk_request_confirmationcall and approve it on the next/run, which runs a confirmation-gated tool with arguments the user never saw. It can also writeapp:anduser:state through an event'sactions.stateDelta.This ports adk-python's
_validate_session_initialization_events(src/google/adk/cli/api_server.py:811-828). Any initialization event that carries event actions, long-running tool IDs, or anadk_request_confirmation,adk_request_credentialoradk_request_inputcall or response is rejected with 400 before the session is created.Adapted for 1.x
tool/toolauthandworkflowdo not exist on v1, so the credential and input call names are spelled out. They match adk-python'sCLIENT_FUNCTION_CALL_NAMESand v1'srequestEUCFunctionCallName.routesorrequestedInput, so those checks and their tests are dropped. The same goes for therequestedToolConfirmations,compactionandrequestedAuthConfigsaction cases, because v1'sEventActionshas only five fields.hasEventActionschecks every field by reflection, so it covers all five.authn, so the shared-state integration test uses one server.internal/llminternal/auth_preprocessor.gois dropped because that file does not exist on v1.What changes for existing users
A create-session request whose
eventsinclude any of the following now gets a 400, and no session is created:actionslongRunningToolIdsOrdinary messages, tool calls and tool responses are still accepted, so importing a conversation that used tools keeps working. Empty
stateDelta/artifactDeltamaps, which every runtime event reads back with, are still accepted.Testing Plan
TestCreateSessionValidatesInitializationEventsandTestCreateSessionRejectsEveryEventActionsField, and the integration testTestCreateSessionKeepsSeededStateDeltaOutOfSharedState.sessions.gorestored to v1, 16 reject cases, all 5 action-field cases and both shared-state subtests fail.RequireConfirmation: true.go build,go test -race ./...,go mod tidy -diffandgolangci-lintv2.3.1 (the CI pin, under Go 1.26.10) are clean on the root module.