joaomarcos
ecdbcef7af
fix(compression): roll the live transcript back when an in-place compaction commit fails ( #99477 )
...
`archive_and_compact()` is atomic: when it raises, every pre-compaction row is
still `active = 1` and the compacted set was never inserted. The rotation branch
already rolled the live transcript back to `messages_before_compression` in that
case, but the in-place branch — the default (`compression_in_place` defaults to
True) — did not, so `compress_context()` handed the caller the uncommitted
compacted list.
That list is marker-swept by `_strip_persistence_markers` (#57491 ) and the
post-commit `stamp_db_persisted_markers` (#98450 ) never ran, so the next
append-only flush treated the whole compacted transcript as new and INSERTed it
on top of the rows it was supposed to replace. The active set then held the
summary AND the turns it summarized: the next resume reloaded both, the token
count went up, preflight fired again, and every failed attempt appended another
copy of the protected head plus tail.
The in-place rollback mirrors the rotation branch and is gated on
`split_status != "in_place_committed"`, which is assigned on the statement
immediately after the atomic commit returns, so a committed compaction can never
be rolled back into a mismatch of the opposite sign.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01EKrRS7LVgyHf2WQkEahSwu
2026-09-01 09:28:31 -07:00
..
2026-08-25 01:48:43 +05:30
2026-08-25 14:02:40 -07:00
2026-08-28 23:38:59 -05:00
2026-07-24 11:45:57 -07:00
2026-08-15 13:28:14 -07:00
2026-09-01 08:30:26 -07:00
2026-08-07 10:11:05 -07:00
2026-07-22 10:58:22 -07:00
2026-08-26 10:10:11 -07:00
2026-09-01 02:00:05 -07:00
2026-09-01 14:56:30 +05:30
2026-09-01 16:27:20 +05:30
2026-08-29 18:34:35 -07:00
2026-08-29 18:34:35 -07:00
2026-08-29 18:34:35 -07:00
2026-07-18 20:01:55 +05:30
2026-07-16 04:23:12 -07:00
2026-09-01 07:00:38 -07:00
2026-08-02 10:02:33 -07:00
2026-07-26 23:41:54 -07:00
2026-09-01 16:27:13 +05:30
2026-07-21 13:54:11 -05:00
2026-09-01 08:30:26 -07:00
2026-07-22 18:08:59 -05:00
2026-07-29 11:53:39 -07:00
2026-07-29 11:53:39 -07:00
2026-07-05 14:00:20 -07:00
2026-08-10 10:45:44 -07:00
2026-08-12 19:13:32 -07:00
2026-09-01 08:30:45 -07:00
2026-08-31 09:58:51 -07:00
2026-08-28 04:58:14 -07:00
2026-08-28 07:51:31 -07:00
2026-08-24 20:25:10 -07:00
2026-08-15 03:16:21 -07:00
2026-08-21 21:53:11 +05:30
2026-08-28 07:51:31 -07:00
2026-09-01 14:33:23 +05:30
2026-08-08 23:09:45 +05:30
2026-08-12 18:41:59 -07:00
2026-09-01 09:28:31 -07:00
2026-09-01 08:30:45 -07:00
2026-08-26 10:10:11 -07:00
2026-08-29 18:34:35 -07:00
2026-09-01 07:00:38 -07:00
2026-08-08 12:32:23 -07:00
2026-08-22 04:20:48 +05:30
2026-08-16 22:06:41 -07:00
2026-08-31 10:08:13 -07:00
2026-08-31 10:42:39 -07:00
2026-08-06 03:16:26 +05:30
2026-08-13 09:34:36 -07:00
2026-08-16 22:06:08 -07:00
2026-08-28 04:58:06 -07:00
2026-08-21 15:24:03 -07:00
2026-07-17 13:49:12 -07:00
2026-09-01 00:35:29 +05:30
2026-08-28 06:36:22 -07:00
2026-08-27 21:07:21 +05:30
2026-07-26 20:59:16 -07:00
2026-07-29 15:28:15 -07:00
2026-08-08 14:49:28 -07:00
2026-08-19 16:10:01 -07:00
2026-08-28 12:15:24 -07:00
2026-08-14 02:04:24 +05:30
2026-08-23 18:25:19 -07:00
2026-07-26 12:54:45 -07:00
2026-07-14 16:47:33 +05:30
2026-08-08 05:09:43 -07:00
2026-07-29 11:53:39 -07:00
2026-07-01 16:25:48 -05:00
2026-06-30 15:16:21 -05:00
2026-07-16 07:57:51 -07:00
2026-08-19 22:41:05 -07:00
2026-08-31 09:57:22 -07:00
2026-08-25 03:55:55 -07:00
2026-06-19 15:23:41 +08:00
2026-08-15 01:04:19 -07:00
2026-08-30 20:40:43 -07:00
2026-08-29 12:06:48 +05:30
2026-08-13 23:10:16 +05:30
2026-08-31 12:20:02 -07:00
2026-08-14 03:31:22 +05:30
2026-07-20 11:05:52 -07:00
2026-08-30 05:16:10 -07:00
2026-07-24 17:10:39 -07:00
2026-07-22 12:10:58 -05:00
2026-06-23 08:01:50 +00:00
2026-08-02 15:01:11 -07:00
2026-08-29 19:14:15 -07:00
2026-08-12 16:25:20 -07:00
2026-08-12 18:38:25 -07:00
2026-09-01 02:14:35 -07:00
2026-08-24 21:46:05 -07:00
2026-09-01 07:32:45 -07:00
2026-08-29 11:33:05 +05:30
2026-09-01 02:14:35 -07:00
2026-08-29 12:23:41 +05:30
2026-08-26 10:10:11 -07:00
2026-07-10 05:41:59 -05:00
2026-08-29 20:39:44 +05:30
2026-08-06 22:02:37 -05:00
2026-08-27 03:24:20 -07:00
2026-09-01 00:25:45 +05:30
2026-08-19 08:52:01 -07:00
2026-08-19 08:52:03 -07:00
2026-08-08 23:46:17 -07:00
2026-08-16 01:55:51 -07:00
2026-07-19 08:25:35 +05:30
2026-07-29 10:13:50 -07:00
2026-08-23 19:04:37 -07:00
2026-07-16 04:32:23 -07:00
2026-08-21 13:21:46 +10:00
2026-08-29 13:02:13 +05:30
2026-08-15 23:03:52 -07:00
2026-08-29 08:23:47 -07:00
2026-07-29 12:20:34 -07:00
2026-08-30 01:24:14 -07:00
2026-07-29 15:28:15 -07:00
2026-09-01 07:32:45 -07:00
2026-08-08 15:10:24 +05:30
2026-07-02 04:51:56 +05:30
2026-07-17 18:31:09 +00:00
2026-08-23 18:25:19 -07:00
2026-08-28 05:45:00 -07:00
2026-07-22 08:11:09 +05:30
2026-08-31 10:10:25 -07:00
2026-08-24 20:10:44 -07:00
2026-08-24 20:10:44 -07:00
2026-07-16 01:07:29 +05:30
2026-06-25 19:00:48 -07:00
2026-08-15 00:33:01 -07:00
2026-08-16 22:10:02 -07:00
2026-08-25 15:24:15 -07:00
2026-08-28 23:10:01 -07:00
2026-08-25 02:45:10 -07:00
2026-07-11 05:41:58 -07:00
2026-08-14 21:41:26 -07:00
2026-08-29 11:33:05 +05:30
2026-08-12 19:01:30 -07:00
2026-08-12 19:13:32 -07:00
2026-08-12 19:13:32 -07:00
2026-09-01 14:33:23 +05:30
2026-08-31 14:02:55 -07:00
2026-09-01 03:19:59 +05:30
2026-08-28 03:46:24 -07:00
2026-07-26 17:47:51 -07:00
2026-08-24 03:23:07 -07:00
2026-08-16 00:14:58 -07:00
2026-08-12 01:15:25 -07:00
2026-06-30 00:59:29 -05:00
2026-08-29 12:33:44 +05:30
2026-08-28 05:10:33 -07:00
2026-08-19 16:10:01 -07:00
2026-08-31 00:56:41 -07:00
2026-08-31 00:56:41 -07:00