Repository navigation
fix(session/vertexai): drop temp: keys from the initial state on Create - #2100
Conversation
CreateRequest.State was sent to Agent Engine as given, so temp: keys were stored with the session and came back on the created session and every later Get. AppendEvent already trims them from state deltas, and adk-python's VertexAiSessionService.create_session drops them too.
|
Hi @adityasingh2400 Thank you for addressing this issue and providing the fix!I reviewed the changes and verified the implementation against the expected behaviour. The temporary state keys are correctly filtered out, while regular session state is preserved.
|
, #1919, #2189, #2285) (#2346) * fix(session/vertexai): drop temp: keys from the initial state on Create (#2100) (cherry picked from commit 0c109f7) * fix(session): keep in-memory Get from returning events before After (#2089) (cherry picked from commit 10395f0) * fix(session/database): lock app and user state rows in Create (#1930) (cherry picked from commit 2f3b2c2) * fix(session/database): delete a session's events explicitly in Delete (#1774) (cherry picked from commit 7af0f5f) * fix(session): define List order as last update time ascending (#1919) (cherry picked from commit 8be7e25) * fix(session): skip nil parts in IsFinalResponse classification (#2189) (cherry picked from commit 75ae920) * fix(session): count a final error event as a final response (#2285) (cherry picked from commit d9ecb34)
Linked issue
Problem:
Createon the Vertex AI session service sendstemp:keys from the initial state to Agent Engine, so they're stored with the session and returned by every laterGet.Solution:
Drop
temp:keys from a copy of the initial state before building the RPC, the same wayAppendEventtrims them from deltas. This matches adk-python'screate_session(src/google/adk/sessions/vertex_ai_session_service.py:243-250). The caller's map isn't modified.Behavior change
temp:keys passed toCreateon the Vertex AI service are no longer stored or returned. Other keys are unchanged.Testing Plan
Unit Tests:
Added
TestCreate_dropsTempKeysFromInitialState, which runs against an in-process fake gRPC server. No replay files are touched.With your source change reverted and your tests kept, which test fails?
With the change,
go test -race -count=1 ./session/vertexai/...passes,go build ./...succeeds, andgolangci-lint runreports 0 issues, withgolangci-lint fmt --diffandgo mod tidy -diffboth empty.Manual End-to-End (E2E) Tests:
N/A, covered by the fake-server test. I didn't run it against a live Agent Engine.
Checklist