Commit 931d75c
Rishab Motgi
fix: guard non-positive session limit in AdvancedSQLiteSession.get_items
AdvancedSQLiteSession.get_items() passed the resolved session_limit
directly to SQL LIMIT without checking whether the value is non-positive.
MongoDBSession, RedisSession, DaprSession, AsyncSQLiteSession, and
SQLAlchemySession all guard this with:
if session_limit is not None and session_limit <= 0:
return []
AdvancedSQLiteSession was the only SQLite-backed implementation missing
the guard. SQLite treats LIMIT -1 as 'no limit', so passing limit=-1
would return the full conversation history instead of an empty list,
diverging from every other backend.
Adds limit=0 and limit=-1 assertions to the existing explicit-limit
override test so the behaviour is pinned.1 parent 656baf8 commit 931d75c
2 files changed
Lines changed: 9 additions & 0 deletions
File tree
- src/agents/extensions/memory
- tests/extensions/memory
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1288 | 1288 | | |
1289 | 1289 | | |
1290 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
1291 | 1297 | | |
1292 | 1298 | | |
1293 | 1299 | | |
| |||
0 commit comments