Commit f8dff86
committed
fix(sessions): respect num_recent_events=0 in DatabaseSessionService
`DatabaseSessionService.get_session` used a truthy check
(`if config and config.num_recent_events:`) which treated `0` as
"no limit" and returned all events, contradicting the documented
behavior in `GetSessionConfig` ("if 0, no events are returned").
Switch to `is not None` so that `LIMIT 0` is appended for the zero
case. Add a boundary assertion to `test_get_session_with_config`,
which is parametrized over all four session backends (InMemory,
InMemory-light-copy, Database, Sqlite).
Closes #57301 parent bd062ec commit f8dff86
2 files changed
Lines changed: 8 additions & 1 deletion
File tree
- src/google/adk/sessions
- tests/unittests/sessions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1067 | 1067 | | |
1068 | 1068 | | |
1069 | 1069 | | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1070 | 1077 | | |
1071 | 1078 | | |
1072 | 1079 | | |
| |||
0 commit comments