From f8b3623fbf4605f68a74d33e6686be5fb55aad2d Mon Sep 17 00:00:00 2001 From: Nilesh Patil <128893479+nileshpatil6@users.noreply.github.com> Date: Fri, 8 May 2026 15:53:46 +0530 Subject: [PATCH] fix(firestore): populate last_update_time in list_sessions from Firestore updateTime list_sessions() was hardcoding last_update_time=0.0 in every returned Session, ignoring the updateTime field stored in the Firestore document. get_session() already handles this correctly with an isinstance(datetime) check and a float() fallback. This commit applies the same conversion block to list_sessions(). Fixes #5632 --- .../firestore/firestore_session_service.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/google/adk/integrations/firestore/firestore_session_service.py b/src/google/adk/integrations/firestore/firestore_session_service.py index 83b97c33c2..ced2459c5d 100644 --- a/src/google/adk/integrations/firestore/firestore_session_service.py +++ b/src/google/adk/integrations/firestore/firestore_session_service.py @@ -411,6 +411,18 @@ async def list_sessions( u_state = user_states_map.get(u_id, {}) merged = self._merge_state(app_state, u_state, s_state) + # Convert timestamp (mirrors the logic in get_session). + update_time = data.get("updateTime") + last_update_time = 0.0 + if update_time: + if isinstance(update_time, datetime): + last_update_time = update_time.timestamp() + else: + try: + last_update_time = float(update_time) + except (ValueError, TypeError): + pass + sessions.append( Session( id=data["id"], @@ -418,7 +430,7 @@ async def list_sessions( user_id=data["userId"], state=merged, events=[], - last_update_time=0.0, + last_update_time=last_update_time, ) )