Joseph Doherty
c06a32767b
perf: read_recent_dialogue pushes chat-id filter into SQL (T90.1)
...
The previous implementation pulled the last N rows in SQL across all
chats and dropped foreign-chat rows in Python. With LIMIT N this could
return far fewer than N relevant rows when other chats had recent
activity. Push the chat_id filter into SQL via json_extract so LIMIT N
always returns N rows scoped to the requested chat.
Test: seeds two chats with 60 turns each interleaved; queries chat_a
with limit=50; asserts exactly 50 chat_a rows returned (was 0 prior to
the fix because chat_b's rows dominated the global tail).
2026-04-27 02:23:15 -04:00
..
2026-04-26 11:23:38 -04:00
2026-04-26 21:40:47 -04:00
2026-04-26 14:18:57 -04:00
2026-04-26 12:17:06 -04:00
2026-04-26 14:33:28 -04:00
2026-04-26 12:39:15 -04:00
2026-04-26 15:03:13 -04:00
2026-04-26 11:28:40 -04:00
2026-04-26 17:28:25 -04:00
2026-04-26 13:40:40 -04:00
2026-04-26 21:55:53 -04:00
2026-04-26 17:26:31 -04:00
2026-04-26 13:35:47 -04:00
2026-04-26 11:51:15 -04:00
2026-04-26 11:46:19 -04:00
2026-04-26 14:33:28 -04:00
2026-04-26 20:09:13 -04:00
2026-04-26 20:15:51 -04:00
2026-04-26 11:42:49 -04:00
2026-04-26 20:04:36 -04:00
2026-04-26 14:33:28 -04:00
2026-04-26 15:46:16 -04:00
2026-04-26 15:46:09 -04:00
2026-04-26 11:23:38 -04:00
2026-04-26 15:51:29 -04:00
2026-04-26 12:28:05 -04:00
2026-04-26 15:03:13 -04:00
2026-04-26 11:35:57 -04:00
2026-04-26 20:52:45 -04:00
2026-04-26 22:33:52 -04:00
2026-04-26 20:15:19 -04:00
2026-04-26 22:24:57 -04:00
2026-04-26 12:03:26 -04:00
2026-04-26 11:32:32 -04:00
2026-04-26 15:51:58 -04:00
2026-04-26 17:05:29 -04:00
2026-04-26 21:50:55 -04:00
2026-04-26 22:02:25 -04:00
2026-04-26 21:41:15 -04:00
2026-04-26 22:18:23 -04:00
2026-04-26 15:47:12 -04:00
2026-04-26 22:41:35 -04:00
2026-04-26 17:06:21 -04:00
2026-04-26 13:58:20 -04:00
2026-04-26 15:03:13 -04:00
2026-04-26 12:22:00 -04:00
2026-04-26 15:03:13 -04:00
2026-04-26 21:40:29 -04:00
2026-04-26 14:15:17 -04:00
2026-04-26 12:49:41 -04:00
2026-04-26 15:03:13 -04:00
2026-04-26 22:41:35 -04:00
2026-04-26 20:10:05 -04:00
2026-04-26 20:10:36 -04:00
2026-04-26 20:05:09 -04:00
2026-04-26 20:04:46 -04:00
2026-04-27 02:23:15 -04:00
2026-04-26 22:06:24 -04:00
2026-04-26 15:03:13 -04:00
2026-04-26 16:25:03 -04:00
2026-04-26 20:52:45 -04:00