Commit 8acf77c
fix: DbSessionAdapter.clear_session must purge persisted messages (#1737)
clear_session only cleared the in-memory cache while BotSessionManager
and managed agents rewrite history via clear_session + add_message.
Stale DB rows were reloaded on the next on_agent_start, resurrecting
trimmed or cleared chat history.
- Call conversation.delete_messages when available
- Reset session tracking and skip stale on_agent_start hydration
- Add regression test for bot history trim roundtrip
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>1 parent 5ff79d3 commit 8acf77c
2 files changed
Lines changed: 83 additions & 2 deletions
File tree
- src
- praisonai-agents/tests/managed
- praisonai/praisonai/integrations
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
352 | 396 | | |
353 | 397 | | |
354 | 398 | | |
| |||
Lines changed: 39 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
40 | 62 | | |
41 | 63 | | |
42 | 64 | | |
43 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
44 | 69 | | |
45 | 70 | | |
46 | | - | |
| 71 | + | |
47 | 72 | | |
48 | 73 | | |
49 | 74 | | |
| 75 | + | |
| 76 | + | |
50 | 77 | | |
51 | 78 | | |
52 | 79 | | |
| |||
99 | 126 | | |
100 | 127 | | |
101 | 128 | | |
102 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
103 | 138 | | |
104 | 139 | | |
105 | 140 | | |
106 | 141 | | |
| 142 | + | |
107 | 143 | | |
108 | 144 | | |
109 | 145 | | |
| 146 | + | |
110 | 147 | | |
111 | 148 | | |
112 | 149 | | |
| |||
0 commit comments