Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(firestore): populate last_update_time in list_sessions from Fires…
…tore 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
  • Loading branch information
nileshpatil6 committed May 8, 2026
commit f8b3623fbf4605f68a74d33e6686be5fb55aad2d
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,26 @@ 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"],
app_name=data["appName"],
user_id=data["userId"],
state=merged,
events=[],
last_update_time=0.0,
last_update_time=last_update_time,
)
)

Expand Down
Loading