Patrick Buckley
0c58910c4b
fix(session): preserve _source/_reminders on fork + cap persisted reminder text
...
Closes round-1 review findings bug-2 (major), perf-1 (minor), perf-6 (nit).
* **bug-2:** ``ChatSession.resume(..., fork=True)``'s bulk-row builder
silently dropped the ``_source`` and ``_reminders`` side-channel
data the source workstream had persisted via ``_append_user_turn``.
Both backends' ``save_messages_bulk`` already accept these keys
(the columns exist post-migration 050) — the bulk builder just
didn't supply them. The fork's resumed transcript would then look
like the assistant turn answered out of nowhere: every wake marker
and every reminder bubble that survived to disk on the source got
dropped on the fork. New regression test
``test_fork_preserves_source_and_reminders`` pins the contract.
* **perf-6:** Extracts ``_encode_reminders(reminders) -> str | None``
near ``_apply_reminders_for_provider`` so the user-turn save path,
the tool-turn save path, and the new fork bulk builder share one
encoder. Eliminates the drift risk between three near-identical
``json.dumps(..., separators=(",", ":")) if X else None`` patterns.
* **perf-1:** The new helper clamps each entry's ``text`` field at
``REMINDER_TEXT_STORAGE_CAP = 8192`` characters before encoding so
a single rogue producer (a watch streaming unbounded shell output,
a corruption-class steering payload) can't blow the conversations
row width or the FTS5 index. The in-memory side-channel keeps the
full body — only the persisted JSON is clamped. Mirrors
``TOOL_RESULT_STORAGE_CAP`` on tool result rows.
5734 non-live tests pass; ruff + mypy clean.
(cherry picked from commit 91e7f2daca )
2026-05-07 17:35:22 -07:00
..
2026-03-02 00:33:37 -08:00
2026-04-30 23:48:53 -07:00
2026-05-07 17:35:22 -07:00
2026-04-28 10:27:26 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:22 -07:00
2026-04-26 22:14:22 -07:00
2026-05-01 14:06:08 -07:00
2026-04-27 22:51:31 -07:00
2026-04-26 22:14:22 -07:00
2026-05-07 17:35:20 -07:00
2026-03-13 21:21:09 -07:00
2026-04-04 12:26:10 -07:00
2026-05-07 17:35:22 -07:00
2026-04-28 12:52:36 -07:00
2026-04-18 05:49:54 -07:00
2026-04-18 05:49:54 -07:00
2026-03-30 20:30:05 -07:00
2026-04-18 05:49:54 -07:00
2026-04-18 05:49:54 -07:00
2026-03-23 11:11:40 -07:00
2026-04-30 23:48:53 -07:00
2026-04-30 23:48:53 -07:00
2026-05-03 13:40:29 -07:00
2026-04-16 11:08:26 -07:00
2026-04-06 14:18:02 -07:00
2026-04-30 13:34:15 -07:00
2026-04-27 21:52:57 -07:00
2026-04-16 13:30:25 -07:00
2026-04-18 19:02:52 -07:00
2026-04-26 22:14:22 -07:00
2026-05-04 02:59:35 -07:00
2026-04-26 17:32:44 -07:00
2026-04-30 23:48:53 -07:00
2026-04-30 23:48:53 -07:00
2026-05-03 13:40:29 -07:00
2026-04-24 16:56:06 -07:00
2026-04-27 11:41:14 -07:00
2026-04-28 10:27:26 -07:00
2026-04-24 16:56:06 -07:00
2026-05-07 17:35:21 -07:00
2026-05-03 13:40:29 -07:00
2026-04-16 21:40:50 -07:00
2026-04-28 14:23:32 -07:00
2026-03-13 21:21:09 -07:00
2026-04-04 17:53:20 -07:00
2026-03-02 00:33:37 -08:00
2026-05-04 02:59:35 -07:00
2026-03-03 22:57:34 -08:00
2026-04-04 22:19:03 -07:00
2026-03-23 11:11:40 -07:00
2026-04-04 23:44:29 -07:00
2026-05-01 14:06:08 -07:00
2026-04-03 15:36:20 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:21 -07:00
2026-04-25 22:52:39 -07:00
2026-04-05 01:53:33 -07:00
2026-04-05 01:53:33 -07:00
2026-04-27 21:52:57 -07:00
2026-04-17 23:56:10 -07:00
2026-05-07 17:35:21 -07:00
2026-03-04 06:47:30 -08:00
2026-03-02 16:55:12 -08:00
2026-05-07 17:35:21 -07:00
2026-05-07 17:35:21 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:21 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:21 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:21 -07:00
2026-05-07 17:35:21 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:22 -07:00
2026-03-12 16:57:31 -07:00
2026-03-21 16:12:50 -07:00
2026-03-20 20:01:26 -07:00
2026-03-23 11:11:40 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:22 -07:00
2026-03-15 14:28:03 -07:00
2026-05-03 13:40:30 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:20 -07:00
2026-04-13 17:14:58 -07:00
2026-03-30 04:19:24 -07:00
2026-05-03 13:40:30 -07:00
2026-05-03 13:40:29 -07:00
2026-04-28 13:49:31 -07:00
2026-04-06 03:08:19 -07:00
2026-04-06 09:54:03 -07:00
2026-04-05 17:18:26 -07:00
2026-03-07 12:49:07 -08:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-05-07 17:35:20 -07:00
2026-04-26 22:14:22 -07:00
2026-03-23 11:11:40 -07:00
2026-04-05 01:53:33 -07:00
2026-04-27 11:41:14 -07:00
2026-04-25 22:52:39 -07:00
2026-04-28 19:51:00 -07:00
2026-04-15 13:30:22 -07:00
2026-05-03 13:40:30 -07:00
2026-04-26 22:14:22 -07:00
2026-05-07 17:35:22 -07:00
2026-04-27 12:47:21 -07:00
2026-04-18 19:02:52 -07:00
2026-03-30 20:30:05 -07:00
2026-03-29 14:18:39 -07:00
2026-04-26 22:14:22 -07:00
2026-04-05 01:53:33 -07:00
2026-03-02 00:33:37 -08:00
2026-03-02 16:55:12 -08:00
2026-03-10 19:32:37 -07:00
2026-03-23 11:11:40 -07:00
2026-03-30 20:30:05 -07:00
2026-03-02 16:55:12 -08:00
2026-04-26 22:14:22 -07:00
2026-04-16 09:56:17 -07:00
2026-04-04 22:19:03 -07:00
2026-04-16 13:30:25 -07:00
2026-04-26 22:14:22 -07:00
2026-04-26 22:14:22 -07:00
2026-04-26 13:11:07 -07:00
2026-05-04 02:59:35 -07:00
2026-04-26 04:07:39 -07:00
2026-04-28 10:27:26 -07:00
2026-05-03 13:40:30 -07:00
2026-05-07 17:35:20 -07:00
2026-04-24 14:28:51 -07:00
2026-05-03 13:40:29 -07:00
2026-04-26 20:00:45 -07:00
2026-03-30 20:30:05 -07:00
2026-05-04 02:59:35 -07:00
2026-05-07 17:35:21 -07:00
2026-04-26 22:14:22 -07:00
2026-04-27 15:51:01 -07:00
2026-04-26 22:14:22 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:22 -07:00
2026-04-05 13:09:36 -07:00
2026-04-16 11:08:26 -07:00
2026-03-17 01:26:44 -07:00
2026-05-07 17:35:20 -07:00
2026-03-17 16:09:06 -07:00
2026-03-31 22:34:24 -07:00
2026-03-17 01:26:44 -07:00
2026-03-23 11:11:40 -07:00
2026-03-16 15:45:21 -07:00
2026-03-17 01:26:44 -07:00
2026-04-26 04:07:39 -07:00
2026-04-25 20:11:47 -07:00
2026-04-16 13:39:32 -07:00
2026-04-04 17:53:20 -07:00
2026-04-18 10:20:19 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:20 -07:00
2026-05-03 13:40:30 -07:00
2026-05-03 13:40:30 -07:00
2026-04-01 19:38:24 -07:00
2026-03-31 11:28:39 -07:00
2026-04-01 19:38:24 -07:00
2026-03-25 16:07:05 -07:00
2026-04-28 19:51:00 -07:00
2026-03-30 20:30:05 -07:00
2026-03-12 14:49:58 -07:00
2026-03-17 17:02:25 -07:00
2026-04-04 19:11:07 -07:00
2026-04-28 12:19:34 -07:00
2026-03-23 11:11:40 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:22 -07:00
2026-05-07 17:35:22 -07:00
2026-04-05 16:25:53 -07:00
2026-05-07 17:35:21 -07:00
2026-04-27 15:51:01 -07:00
2026-04-30 23:48:53 -07:00
2026-04-30 03:15:22 -07:00
2026-04-28 12:19:34 -07:00