You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Firestore Session Service does not handle timestamp correctly #5632
Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected / deprioritized.
If an item is not applicable to you - please mark it as N/A
Describe the Bug:
A clear and concise description of what the bug is.
Steps to Reproduce:
Use google.adk.integrations.firestore.firestore_session_service.FirestoreSessionService as sessions service.
Call session_service.list_sessions
Expected Behavior:
The returned session's last_update_time should match the Firestore record
Observed Behavior:
The returned session's last_update_time is always 0.
Environment Details:
ADK Library Version (pip show google-adk): 1.20
Desktop OS:** [e.g., macOS, Linux, Windows]: Linux
Python Version (python -V): 3.14
Model Information:
Are you using LiteLLM: No
Which model is being used: gemini
🟡 Optional Information
Providing this information greatly speeds up the resolution process.
The issue is the code does not handle the attribute.
@Dumeng list_sessions() hardcodes last_update_time=0.0 in the Session constructor and never reads data.get("updateTime") from the Firestore document, while get_session() already handles this correctly with an isinstance(update_time, datetime) check (lines 337-346 of firestore_session_service.py).
A workaround worth trying: copy that same timestamp conversion block from get_session() into the for doc in docs: loop in list_sessions(), replacing the hardcoded 0.0 with the extracted value before constructing the Session.
Could you apply that locally and verify last_update_time now reflects the actual Firestore updateTime after calling list_sessions()?
PR #5640 (@kkj333) is the right one to track — it applies the exact data.get("updateTime") → isinstance(update_time, datetime) → .timestamp() conversion from get_session() into the list_sessions() loop (+11 −1 in firestore_session_service.py).
PR #5642 was closed in its favour since #5640 already had test coverage first.
Worth flagging for the reviewer though: both test cases mock updateTime as a raw float (which exercises the fallback path), while real Firestore .to_dict() returns a DatetimeWithNanoseconds.
Adding a datetime mock would cover that primary branch and give fuller confidence before merge.
Once #5640 lands, last_update_time will populate correctly for all FirestoreSessionService users without needing the local patch!
Activity
surajksharma07 commentedon May 7, 2026
@Dumeng list_sessions() hardcodes last_update_time=0.0 in the Session constructor and never reads data.get("updateTime") from the Firestore document, while get_session() already handles this correctly with an isinstance(update_time, datetime) check (lines 337-346 of firestore_session_service.py).
A workaround worth trying: copy that same timestamp conversion block from get_session() into the for doc in docs: loop in list_sessions(), replacing the hardcoded 0.0 with the extracted value before constructing the Session.
Could you apply that locally and verify last_update_time now reflects the actual Firestore updateTime after calling list_sessions()?
Dumeng commentedon May 11, 2026
Yes, it works. And I saw a related PR #5640 has been opened for this
surajksharma07 commentedon May 18, 2026
Thanks for confirming, @Dumeng.
PR #5640 (@kkj333) is the right one to track — it applies the exact data.get("updateTime") → isinstance(update_time, datetime) → .timestamp() conversion from get_session() into the list_sessions() loop (+11 −1 in firestore_session_service.py).
PR #5642 was closed in its favour since #5640 already had test coverage first.
Worth flagging for the reviewer though: both test cases mock updateTime as a raw float (which exercises the fallback path), while real Firestore .to_dict() returns a DatetimeWithNanoseconds.
Adding a datetime mock would cover that primary branch and give fuller confidence before merge.
Once #5640 lands, last_update_time will populate correctly for all FirestoreSessionService users without needing the local patch!
fix(firestore): preserve update timestamps in list_sessions
fix(firestore): preserve update timestamps in list_sessions