Render completed assistant messages directly during replay (#42325)

## Why

Buffered thread snapshots can contain both streaming deltas and the completed
assistant item. Replaying both reconstructs an already-finished stream instead
of restoring its finalized transcript entry.

## What changed

- Omit superseded assistant deltas from replay snapshots when a matching
  completed item follows them.
- Preserve unfinished or unrelated deltas and treat other events as replay
  barriers so text needed before tools or prompts is not dropped.
- Render completed replay items directly as formatted history cells while
  preserving message order, separators, and composer drafts.

## Testing

Added replay tests covering completed, unfinished, unrelated, and
barrier-separated deltas, plus deterministic Markdown rendering and draft
preservation.

GitOrigin-RevId: 2870b09a04b32c0a4c0e9ab76970a8ebc3f5a7d4
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-02 18:36:53 +00:00
1 parent 637c3227b3
commit e6ff749506
8 files changed
+246 -15

No files matched your search

+1
View File
@@ -1555,6 +1555,7 @@ impl App {
mut snapshot: ThreadEventSnapshot,
resume_restored_queue: bool,
) {
replay_filter::omit_completed_agent_deltas(&mut snapshot.events);
let request_changes = snapshot
.events
.iter()