Lightweight coding agent that runs in your terminal
Rust
chore: dedup review result duplication (#8057)
jif-oai2041b72da767
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rsindex 37cd004a15..ca9e0525dd 100644--- a/codex-rs/tui/src/chatwidget.rs+++ b/codex-rs/tui/src/chatwidget.rs@@ -1952,15 +1952,8 @@ impl ChatWidget {self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(body_cell)));}- } else {- let message_text =- codex_core::review_format::format_review_findings_block(&output.findings, None);- let mut message_lines: Vec<ratatui::text::Line<'static>> = Vec::new();- append_markdown(&message_text, None, &mut message_lines);- let body_cell = AgentMessageCell::new(message_lines, true);- self.app_event_tx- .send(AppEvent::InsertHistoryCell(Box::new(body_cell)));}+ // Final message is rendered as part of the AgentMessage.}self.is_review_mode = false;diff --git a/codex-rs/tui/src/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rsindex 362b1678f4..35771301d7 100644--- a/codex-rs/tui/src/chatwidget/tests.rs+++ b/codex-rs/tui/src/chatwidget/tests.rs@@ -33,10 +33,6 @@ use codex_core::protocol::Op;use codex_core::protocol::PatchApplyBeginEvent;use codex_core::protocol::PatchApplyEndEvent;use codex_core::protocol::RateLimitWindow;-use codex_core::protocol::ReviewCodeLocation;-use codex_core::protocol::ReviewFinding;-use codex_core::protocol::ReviewLineRange;-use codex_core::protocol::ReviewOutputEvent;use codex_core::protocol::ReviewRequest;use codex_core::protocol::ReviewTarget;use codex_core::protocol::StreamErrorEvent;@@ -195,41 +191,6 @@ fn entered_review_mode_defaults_to_current_changes_banner() {assert!(chat.is_review_mode);}-/// Completing review with findings shows the selection popup and finishes with-/// the closing banner while clearing review mode state.-#[test]-fn exited_review_mode_emits_results_and_finishes() {- let (mut chat, mut rx, _ops) = make_chatwidget_manual(None);-- let review = ReviewOutputEvent {- findings: vec![ReviewFinding {- title: "[P1] Fix bug".to_string(),- body: "Something went wrong".to_string(),- confidence_score: 0.9,- priority: 1,- code_location: ReviewCodeLocation {- absolute_file_path: PathBuf::from("src/lib.rs"),- line_range: ReviewLineRange { start: 10, end: 12 },- },- }],- overall_correctness: "needs work".to_string(),- overall_explanation: "Investigate the failure".to_string(),- overall_confidence_score: 0.5,- };-- chat.handle_codex_event(Event {- id: "review-end".into(),- msg: EventMsg::ExitedReviewMode(ExitedReviewModeEvent {- review_output: Some(review),- }),- });-- let cells = drain_insert_history(&mut rx);- let banner = lines_to_single_string(cells.last().expect("finished banner"));- assert_eq!(banner, "\n<< Code review finished >>\n");- assert!(!chat.is_review_mode);-}-/// Exiting review restores the pre-review context window indicator.#[test]fn review_restores_context_window_indicator() {diff --git a/codex-rs/tui2/src/chatwidget.rs b/codex-rs/tui2/src/chatwidget.rsindex 5461bea729..20ecb8bacd 100644--- a/codex-rs/tui2/src/chatwidget.rs+++ b/codex-rs/tui2/src/chatwidget.rs@@ -1952,15 +1952,8 @@ impl ChatWidget {self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(body_cell)));}- } else {- let message_text =- codex_core::review_format::format_review_findings_block(&output.findings, None);- let mut message_lines: Vec<ratatui::text::Line<'static>> = Vec::new();- append_markdown(&message_text, None, &mut message_lines);- let body_cell = AgentMessageCell::new(message_lines, true);- self.app_event_tx- .send(AppEvent::InsertHistoryCell(Box::new(body_cell)));}+ // Final message is rendered as part of the AgentMessage.}self.is_review_mode = false;diff --git a/codex-rs/tui2/src/chatwidget/tests.rs b/codex-rs/tui2/src/chatwidget/tests.rsindex 362b1678f4..35771301d7 100644--- a/codex-rs/tui2/src/chatwidget/tests.rs+++ b/codex-rs/tui2/src/chatwidget/tests.rs@@ -33,10 +33,6 @@ use codex_core::protocol::Op;use codex_core::protocol::PatchApplyBeginEvent;use codex_core::protocol::PatchApplyEndEvent;use codex_core::protocol::RateLimitWindow;-use codex_core::protocol::ReviewCodeLocation;-use codex_core::protocol::ReviewFinding;-use codex_core::protocol::ReviewLineRange;-use codex_core::protocol::ReviewOutputEvent;use codex_core::protocol::ReviewRequest;use codex_core::protocol::ReviewTarget;use codex_core::protocol::StreamErrorEvent;@@ -195,41 +191,6 @@ fn entered_review_mode_defaults_to_current_changes_banner() {assert!(chat.is_review_mode);}-/// Completing review with findings shows the selection popup and finishes with-/// the closing banner while clearing review mode state.-#[test]-fn exited_review_mode_emits_results_and_finishes() {- let (mut chat, mut rx, _ops) = make_chatwidget_manual(None);-- let review = ReviewOutputEvent {- findings: vec![ReviewFinding {- title: "[P1] Fix bug".to_string(),- body: "Something went wrong".to_string(),- confidence_score: 0.9,- priority: 1,- code_location: ReviewCodeLocation {- absolute_file_path: PathBuf::from("src/lib.rs"),- line_range: ReviewLineRange { start: 10, end: 12 },- },- }],- overall_correctness: "needs work".to_string(),- overall_explanation: "Investigate the failure".to_string(),- overall_confidence_score: 0.5,- };-- chat.handle_codex_event(Event {- id: "review-end".into(),- msg: EventMsg::ExitedReviewMode(ExitedReviewModeEvent {- review_output: Some(review),- }),- });-- let cells = drain_insert_history(&mut rx);- let banner = lines_to_single_string(cells.last().expect("finished banner"));- assert_eq!(banner, "\n<< Code review finished >>\n");- assert!(!chat.is_review_mode);-}-/// Exiting review restores the pre-review context window indicator.#[test]fn review_restores_context_window_indicator() {