fix(models): let a marked image row consume its replay slot

The row-id fast path for a marked native-image mirror row continued
without advancing state_replay_idx, unlike the ordinary and multimodal-
mirror replay paths. The edited checkpoint then never read as consumed,
so a rerun reply that exists only in state.db was truncated. Master (no
marker branch) keeps that reply.

Advance the replay index when the resolved sidecar row is the next
expected visible row, the same guard the mirror branch uses. Adds a
regression that fails without the fix: sidecar [u1,a1,img#42,a_img,uE],
state [.., marked img#42, a_img, u_old, a_old, uE, aE], watermark 900,
boundary 861 -> aE survives, u_old/a_old stay out.

Found by the release-manager advisor gate on #7754.
This commit is contained in:
nesquena-hermes committed 2026-09-24 10:47:47 +00:00
1 parent 089fb57d25
commit 315ea7d3a8
2 files changed
+75

No files matched your search

+10
View File
@@ -11727,6 +11727,16 @@ def _merge_session_messages_append_only_impl(
):
continue
if row_id_fast_path_allowed:
# This state row replays the sidecar row it resolved to, so it
# consumes that position in the replay sequence exactly like the
# ordinary and multimodal-mirror paths do. Without this the
# checkpoint never reads as consumed and a later state-only
# reply after an edited checkpoint is truncated.
if (
state_replay_idx < len(sidecar_visible_messages)
and sidecar_visible_messages[state_replay_idx] is existing
):
state_replay_idx += 1
existing_api_content = _session_message_api_content_key(existing)
incoming_api_content = _session_message_api_content_key(msg)
if (