Clarify rollback mode flow

This commit is contained in:
Charles Cunningham
2026-01-31 15:56:49 -08:00
parent 603ed41d28
commit edbe47e434
2 changed files with 4 additions and 1 deletions

View File

@@ -3193,7 +3193,7 @@ mod handlers {
&& let Some(collaboration_mode) = state
.turn_context_history
.last()
.and_then(|turn_context| turn_context.as_ref())
.and_then(Option::as_ref)
.and_then(|turn_context| turn_context.collaboration_mode.clone())
{
state.session_configuration.collaboration_mode = collaboration_mode;

View File

@@ -207,6 +207,8 @@ impl App {
return;
}
// Optimistically apply the target mode for the rollback preview, but remember the
// prior mode so we can restore it if core rejects the rollback.
let previous_collaboration_mask = self
.chat_widget
.replace_collaboration_mask(selection.collaboration_mode.clone());
@@ -472,6 +474,7 @@ impl App {
if pending.thread_id != self.chat_widget.thread_id() {
return;
}
// Rollback failed: revert the optimistic mode switch to the pre-rollback mask.
self.chat_widget
.replace_collaboration_mask(pending.previous_collaboration_mask);
}