Restore MCP updates after review setup errors

This commit is contained in:
Charlie Marsh
2026-06-29 09:39:13 -04:00
parent 928b4481cd
commit 2ed06e03d3
2 changed files with 30 additions and 0 deletions
@@ -150,6 +150,31 @@ async fn review_before_first_mcp_update_suppresses_startup_round() {
assert_eq!(chat.status_state.current_status.header, "Working");
}
#[tokio::test]
async fn failed_review_setup_reenables_mcp_startup_updates() {
let (mut chat, _rx, mut op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.set_mcp_startup_expected_servers(["alpha".to_string()]);
notify_mcp_status(&mut chat, "alpha", McpServerStartupState::Starting);
chat.dispatch_command_with_args(
SlashCommand::Review,
"review unrelated branch".to_string(),
Vec::new(),
);
assert_matches!(op_rx.try_recv(), Ok(Op::Review { .. }));
assert!(chat.mcp_startup_status.is_none());
handle_error(
&mut chat,
"failed to resolve merge base",
Some(CodexErrorInfo::Other),
);
notify_mcp_status(&mut chat, "alpha", McpServerStartupState::Starting);
assert!(chat.mcp_startup_status.is_some());
assert!(chat.bottom_pane.is_task_running());
}
#[tokio::test]
async fn review_command_remains_blocked_during_agent_turn() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
@@ -350,6 +350,11 @@ impl ChatWidget {
pub(super) fn on_error(&mut self, message: String) {
self.input_queue.submit_pending_steers_after_interrupt = false;
if !self.review.is_review_mode {
// Review setup errors do not emit ExitedReviewMode, so release any MCP startup
// suppression armed when the request was submitted.
self.mcp_startup_updates_suppressed_for_review = false;
}
self.flush_answer_stream_with_separator();
self.finalize_turn();
self.add_to_history(history_cell::new_error_event(message));