Commit a5db346
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 #5841
Change-Id: I3278c205bba7c7e287308c2625112789593bb7ef1 parent 03ef3f6 commit a5db346
2 files changed
Lines changed: 10 additions & 0 deletions
File tree
- src/google/adk/integrations/firestore
- tests/unittests/integrations/firestore
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
| 554 | + | |
554 | 555 | | |
555 | 556 | | |
556 | 557 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
389 | 398 | | |
390 | 399 | | |
391 | 400 | | |
| |||
0 commit comments