Preserve rejected review draft attachments

This commit is contained in:
Charlie Marsh
2026-06-29 09:39:14 -04:00
parent 4d13a6c70a
commit fcda7ed4ee
2 changed files with 12 additions and 3 deletions
@@ -168,7 +168,7 @@ impl ChatWidget {
cmd.command()
);
self.add_to_history(history_cell::new_error_event(message));
self.bottom_pane.drain_pending_submission_state();
self.handle_rejected_slash_command_state(cmd);
self.request_redraw();
return;
}
@@ -1148,7 +1148,7 @@ impl ChatWidget {
"'/{}' is unavailable in side conversations. {SIDE_SLASH_COMMAND_UNAVAILABLE_HINT}",
cmd.command()
));
self.bottom_pane.drain_pending_submission_state();
self.handle_rejected_slash_command_state(cmd);
false
}
@@ -1161,7 +1161,13 @@ impl ChatWidget {
self.add_error_message(format!(
"'/{command}' is unavailable while code review is running."
));
self.bottom_pane.drain_pending_submission_state();
self.handle_rejected_slash_command_state(cmd);
false
}
fn handle_rejected_slash_command_state(&mut self, cmd: SlashCommand) {
if !cmd.available_during_background_task_only() {
self.bottom_pane.drain_pending_submission_state();
}
}
}
@@ -333,12 +333,15 @@ async fn queued_prompt_blocks_review_during_mcp_startup() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
notify_mcp_status(&mut chat, "alpha", McpServerStartupState::Starting);
chat.queue_user_message("queued prompt".into());
let attachment = "https://example.com/review-context.png".to_string();
chat.set_remote_image_urls(vec![attachment.clone()]);
assert_bare_review_rejected(
&mut chat,
&mut rx,
"'/review' is disabled while a task is in progress.",
);
assert_eq!(chat.remote_image_urls(), vec![attachment]);
}
#[tokio::test]