Stop TUI chats on misalignment policy violations (#39261)

## Why

When the app server reports a misalignment policy violation, the TUI must stop the affected chat rather than allow more work to continue in it.

## What changed

- Finalize the active turn, clear queued and draft input, disable the composer, and reject further operations and interactive requests for the stopped chat.
- Interrupt an active side conversation when its parent reports the violation, and prevent queued turns, forks, approvals, or goal resumption from restarting work.
- Show a non-dismissible precaution view that directs users to start a new chat or resume another one, with agent command center navigation for remote sessions.

## Testing

Added coverage for stopped-chat behavior, parent/side-thread handling, blocked goal resumption, navigation actions, and narrow and remote-session rendering.

GitOrigin-RevId: 0268c46a19294a17765ea4099f389f15ffaaf030
This commit is contained in:
Eric Traut authored and copyberry committed 2026-08-18 18:50:58 +00:00
1 parent 3006151ad4
commit 785ecd7452
16 files changed
+452 -3

No files matched your search

+5 -2
View File
@@ -110,6 +110,9 @@ impl ChatWidget {
action: QueuedInputAction,
pending_pastes: Vec<(String, String)>,
) {
if self.misalignment_policy_violation {
return;
}
let should_run_now = self.is_session_configured()
&& !self.is_user_turn_pending_or_running()
&& !self.input_queue.suppress_queue_autosend;
@@ -135,7 +138,7 @@ impl ChatWidget {
/// If idle and there are queued inputs, submit exactly one to start the next turn.
pub(crate) fn maybe_send_next_queued_input(&mut self) -> bool {
if self.input_queue.suppress_queue_autosend {
if self.misalignment_policy_violation || self.input_queue.suppress_queue_autosend {
return false;
}
if self.blocks_direct_input {
@@ -178,7 +181,7 @@ impl ChatWidget {
submitted_follow_up
}
pub(super) fn is_user_turn_pending_or_running(&self) -> bool {
pub(crate) fn is_user_turn_pending_or_running(&self) -> bool {
self.input_queue.user_turn_pending_start
|| self.turn_lifecycle.agent_turn_running
|| self.review.is_review_mode