SIGN IN SIGN UP

fix: exclude temp: state keys from Firestore session writes

FirestoreSessionService.append_event() writes the full session.state
dict to Firestore, filtering app: and user: prefixed keys but not
temp: prefixed keys. This causes crashes when temp state contains
non-serializable objects (e.g. GroundingMetadata from GoogleSearchTool
via AgentTool's propagate_grounding_metadata).

The DatabaseSessionService and SqliteSessionService don't have this
issue because they only persist state_deltas extracted via
extract_state_delta(), which already filters temp: keys.

Fix: add State.TEMP_PREFIX to the exclusion filter in session_only_state.
Test: extend existing test_append_event_with_temp_state to assert temp
keys are absent from the persisted session state dict.

Merge https://github.com/google/adk-python/pull/5841

Change-Id: I3278c205bba7c7e287308c2625112789593bb7ef
K
Kjell Reidar Jøssang committed
a5db3467c8d556f60150bbf913770df36c38fe89
Parent: 03ef3f6
Committed by Bo Yang <ybo@google.com> on 5/29/2026, 10:43:44 PM