Keep the TUI open when starting a turn fails (#34636)

## What changed

- Handle app-server `turn/start` rejections for pending user turns as turn
  errors instead of exiting the TUI.
- Finalize the pending turn, display the failure in the transcript, and resume
  queued input handling.
- Add coverage that submits a turn to a missing thread and verifies that the
  error is shown while the app continues running.

GitOrigin-RevId: 6d291ba62b9e50d49dd4e3d7c429e98c1f754680
This commit is contained in:
Eric Traut authored and copyberry committed 2026-07-21 23:13:12 +00:00
1 parent 1b77da35cc
commit 0a39ff138e
5 files changed
+92 -4

No files matched your search

+9 -1
View File
@@ -366,7 +366,7 @@ impl ChatWidget {
self.maybe_send_next_queued_input();
}
pub(super) fn on_error(&mut self, message: String) {
fn on_error(&mut self, message: String) {
self.input_queue.submit_pending_steers_after_interrupt = false;
self.flush_answer_stream_with_separator();
self.finalize_turn();
@@ -381,6 +381,14 @@ impl ChatWidget {
self.maybe_send_next_queued_input();
}
pub(crate) fn handle_turn_start_rejection(&mut self, message: String) -> bool {
if !self.input_queue.user_turn_pending_start {
return false;
}
self.on_error(message);
true
}
pub(super) fn on_cyber_policy_error(&mut self) {
self.input_queue.submit_pending_steers_after_interrupt = false;
self.finalize_turn();