Preserve in-flight state when restoring thread input (#33203)

## What changed

- Add an explicit restore mode for thread input snapshots and use it when replaying thread snapshots.
- Preserve the pending-steer interrupt flag alongside running-turn and queued-input state when restoring an in-flight turn.
- When in-flight state is not preserved, clear stale running flags and move pending steers ahead of already queued follow-ups while retaining their history records.

## Testing

- Expand TUI tests to cover both restoration modes, including sleep-inhibitor state, pending-steer ordering, history records, and queued submission.

GitOrigin-RevId: f4e8b2bdf065ef6c6644b7f0ea9cf32c8a9af619
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-07-15 01:47:39 +00:00
1 parent 469ce0db51
commit 77a3f4e80f
7 files changed
+184 -58

No files matched your search

+7 -2
View File
@@ -6,6 +6,7 @@
use super::session_lifecycle::ThreadAttachPresentation;
use super::*;
use crate::chatwidget::ThreadInputStateRestoreMode;
use crate::session_resume::read_session_model;
impl App {
@@ -1344,8 +1345,12 @@ impl App {
}
self.chat_widget
.set_queue_autosend_suppressed(/*suppressed*/ true);
self.chat_widget
.restore_thread_input_state(snapshot.input_state);
self.chat_widget.restore_thread_input_state(
snapshot.input_state,
ThreadInputStateRestoreMode {
preserve_in_flight_turn: true,
},
);
if !snapshot.turns.is_empty() {
self.chat_widget
.replay_thread_turns(snapshot.turns, ReplayKind::ThreadSnapshot);