Skip to content

Firestore Session Service does not handle timestamp correctly #5632

Closed

Description

@Dumeng

🔴 Required Information

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:

  1. Use google.adk.integrations.firestore.firestore_session_service.FirestoreSessionService as sessions service.
  2. 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.

firestore_session_service.py

Regression:
Did this work in a previous version of ADK? If so, which one?

Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.

// Paste logs here

Screenshots / Video:
If applicable, add screenshots or screen recordings to help explain
your problem.

Additional Context:
Add any other context about the problem here.

Minimal Reproduction Code:
Please provide a code snippet or a link to a Gist/repo that isolates the issue.

// Code snippet here

How often has this issue occurred?:

  • Always (100%)

Activity

  1. added
    services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc
    on May 7, 2026
  2. added theissue type on May 7, 2026
  3. surajksharma07 commented on May 7, 2026

    @surajksharma07
    Collaborator

    @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()?

  4. added
    request clarification[Status] The maintainer need clarification or more information from the author
    on May 7, 2026
  5. Dumeng commented on May 11, 2026

    @Dumeng
    ContributorAuthor

    Yes, it works. And I saw a related PR #5640 has been opened for this

  6. surajksharma07 commented on May 18, 2026

    @surajksharma07
    Collaborator

    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!

  7. added
    needs review[Status] The PR/issue is awaiting review from the maintainer
    and removed
    request clarification[Status] The maintainer need clarification or more information from the author
    on May 18, 2026
  8. added a commit that references this issue on Jul 1, 2026
    99ba8ce
  9. added a commit that references this issue on Aug 11, 2026
    9c92318
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

needs review[Status] The PR/issue is awaiting review from the maintainerservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions