Revert the current thread when editing an earlier TUI prompt (#45845)

## What changed

Use `thread/revert` to remove the selected turn and subsequent history, then restore the selected prompt in the composer. Keep the thread identity, settings, goal, and unrelated thread channels intact. Show a notice that conversation history was reverted and file changes are unchanged.

Resolve selections against persisted history, accounting for partially loaded transcripts and hidden review prompts. Reject stale selections and mid-turn steers. Refresh replay state and pagination after a revert, clear queued input and obsolete actions, and require a session reload when the revert cannot be confirmed.

## Testing

Add regression coverage for reverting earlier and first visible prompts in place, preserving unloaded history and thread state, rejecting steers in clipped history, and clearing streaming output, queued input, and stale approval actions.

GitOrigin-RevId: d3f0342539392bdbfec925d0c3d6f67369937f1b
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-16 02:57:38 +00:00
1 parent 8ece31a7bf
commit ffae979216
16 files changed
+659 -409

No files matched your search

-6
View File
@@ -1542,9 +1542,6 @@ impl App {
ThreadAttachPresentation::SessionLineage => {
self.chat_widget.handle_thread_session(session);
}
ThreadAttachPresentation::PromptEdit => {
self.chat_widget.handle_prompt_edit_thread_session(session);
}
}
let should_buffer_initial_replay = !turns.is_empty();
let replayed_final_items = realtime_delivery::completed_agent_items_from_turns(&turns);
@@ -1570,9 +1567,6 @@ impl App {
&replayed_final_items,
retained_assistant_captions,
);
if matches!(presentation, ThreadAttachPresentation::PromptEdit) {
self.chat_widget.emit_prompt_edit_thread_event();
}
let pending = std::mem::take(&mut self.pending_primary_events);
for pending_event in pending {
match pending_event {