mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Restore MCP updates after review setup errors
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user