Skip to content

Commit 862f171

Browse files
committed
Fix: RedisSessionService.list_sessions() state loss bug
## Problem RedisSessionService.list_sessions() was clearing session state by setting `session.state = {}` at line 178, causing loss of app-level and user-level state data when listing sessions. This differed from InMemorySessionService.list_sessions() which correctly preserves state by calling `self._merge_state()`. ## Impact - Session state (including custom fields like 'title', '_ag_ui_thread_id') was lost when listing sessions via the API - Frontend applications couldn't display session metadata in session lists - State was only available when fetching individual sessions via get_session() ## Root Cause The list_sessions() method was directly clearing state instead of merging app/user state from Redis hashes, breaking the state management contract. ## Solution Replace `session.state = {}` with `session = await self._merge_state(app_name, user_id, session)` to match the behavior of InMemorySessionService.list_sessions()
1 parent cc56a5e commit 862f171

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/google/adk_community/sessions/redis_session_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ async def list_sessions(
175175
for session_data in sessions.values():
176176
session = Session.model_validate(session_data)
177177
session.events = []
178-
session.state = {}
178+
session = await self._merge_state(app_name, user_id, session)
179179
sessions_without_events.append(session)
180180

181181
return ListSessionsResponse(sessions=sessions_without_events)

0 commit comments

Comments
 (0)