Skip to content

fix(sessions): honor zero recent events in database service#5965

Open
White-Mouse wants to merge 1 commit into
google:mainfrom
White-Mouse:codex/adk-session-zero-events
Open

fix(sessions): honor zero recent events in database service#5965
White-Mouse wants to merge 1 commit into
google:mainfrom
White-Mouse:codex/adk-session-zero-events

Conversation

@White-Mouse
Copy link
Copy Markdown
Contributor

Summary

  • honor GetSessionConfig(num_recent_events=0) in DatabaseSessionService
  • add cross-backend regression coverage for zero recent events in test_get_session_with_config
  • keep existing positive-limit and no-config behavior unchanged

Motivation

GetSessionConfig documents num_recent_events=0 as returning no events. InMemory and Sqlite already preserve that behavior, and ADK call sites use num_recent_events=0 when they only need to check whether a session exists. DatabaseSessionService used a truthy check, so 0 skipped the SQL LIMIT and returned the full event history.

Testing

  • uv run --extra test pytest tests/unittests/sessions/test_session_service.py::test_get_session_with_config -q
  • uv run --extra test pytest tests/unittests/sessions -q
  • uvx pyink --check src/google/adk/sessions/database_session_service.py tests/unittests/sessions/test_session_service.py
  • uv run python -m py_compile src/google/adk/sessions/database_session_service.py tests/unittests/sessions/test_session_service.py
  • git diff --check

@adk-bot adk-bot added the services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc label Jun 4, 2026
@White-Mouse White-Mouse marked this pull request as ready for review June 4, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants