Skip to content

Commit 8e8b736

Browse files
committed
fix(ai): preserve empty compaction replay checkpoints
1 parent 89ab190 commit 8e8b736

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎packages/ai/src/transports/provider-compaction-replay.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@ export function replaceCompactionReplayOwnerContent(
4444
// This checkpoint is anchored to retained user turns, not assistant content indexes.
4545
return next;
4646
}
47+
const replayIndex = replay.replayIndex ?? 0;
4748
if (
48-
content.length === message.content.length &&
49-
content.every((block, index) => block === message.content[index])
49+
(content.length === 0 && message.content.length > 0) ||
50+
replayIndex > message.content.length
5051
) {
51-
return next;
52-
}
53-
const replayIndex = replay.replayIndex ?? 0;
54-
if (content.length === 0 || replayIndex > message.content.length) {
5552
return stripCompactionReplayCheckpoint(next);
5653
}
5754
let sourceIndex = 0;

0 commit comments

Comments
 (0)