Preserve restored input after resolved misalignment errors (#42399)

## Why

Replaying a thread after a later turn has continued can treat an earlier
misalignment policy violation as still active, clearing the restored draft and
queued follow-up input.

## What changed

- Track the latest turn independently of the bounded replay buffer.
- Omit misalignment errors from older turns during snapshot and stored-turn
  replay while preserving an error on the latest turn.
- Keep interrupted tool calls from the older turn visible in history.

## Testing

Added buffered replay coverage for restored drafts and queued messages, buffer
eviction, current-turn violations, and interrupted tool rendering.

GitOrigin-RevId: d6c223d9c5a1905fe1b48dc5f9514a7ccbf61d92
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-03 00:36:29 +00:00
1 parent e6a944ad75
commit 54a4077c8b
7 files changed
+266 -6

No files matched your search

+3 -3
View File
@@ -715,7 +715,7 @@ impl App {
self.thread_event_channels.get(&thread_id)
{
let mut store = channel.store.lock().await;
store.active_turn_id = Some(actual_turn_id.clone());
store.set_active_turn_id(actual_turn_id.clone());
}
steer_turn_id = actual_turn_id;
retried_after_turn_mismatch = true;
@@ -727,7 +727,7 @@ impl App {
self.thread_event_channels.get(&thread_id)
{
let mut store = channel.store.lock().await;
store.active_turn_id = Some(actual_turn_id);
store.set_active_turn_id(actual_turn_id);
}
return Err(error.into());
}
@@ -803,7 +803,7 @@ impl App {
.wrap_err("review/start returned invalid review thread id")?;
let store = Arc::clone(&self.ensure_thread_channel(review_thread_id).store);
let mut store = store.lock().await;
store.active_turn_id = Some(response.turn.id);
store.set_active_turn_id(response.turn.id);
Ok(true)
}
AppCommand::CleanBackgroundTerminals => {