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

+2
View File
@@ -12,6 +12,8 @@ mod backend_banner_recovery_tests;
mod backend_banner_startup_tests;
#[path = "tests/background_exit_tests.rs"]
mod background_exit_tests;
#[path = "tests/buffered_replay.rs"]
mod buffered_replay;
#[path = "tests/connector_policy.rs"]
mod connector_policy;
#[path = "tests/disconnect_tests.rs"]