From 20690336276f47c20fcee47e9dee6faf3d38d4f7 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Sat, 31 Jan 2026 18:19:27 -0800 Subject: [PATCH] Inline request_user_input history cell --- .../src/bottom_pane/request_user_input/mod.rs | 21 +++++++++---------- codex-rs/tui/src/history_cell.rs | 19 +++-------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs b/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs index 42e92ae0ee..5e824dc07d 100644 --- a/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs +++ b/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs @@ -727,11 +727,11 @@ impl RequestUserInputOverlay { }, })); self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new( - history_cell::new_request_user_input_result( - self.request.questions.clone(), - history_answers, + history_cell::RequestUserInputResultCell { + questions: self.request.questions.clone(), + answers: history_answers, interrupted, - ), + }, ))); } @@ -795,11 +795,11 @@ impl RequestUserInputOverlay { }, })); self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new( - history_cell::new_request_user_input_result( - self.request.questions.clone(), - history_answers, - false, - ), + history_cell::RequestUserInputResultCell { + questions: self.request.questions.clone(), + answers: history_answers, + interrupted: false, + }, ))); if let Some(next) = self.queue.pop_front() { self.request = next; @@ -1856,8 +1856,7 @@ mod tests { panic!("expected UserInputAnswer"); }; assert!(response.interrupted, "expected interrupted flag"); - let answer = response.answers.get("q1").expect("answer missing"); - assert_eq!(answer.answers, vec!["Option 1".to_string()]); + assert!(response.answers.is_empty(), "expected no committed answers"); let event = rx.try_recv().expect("expected history cell"); assert!(matches!(event, AppEvent::InsertHistoryCell(_))); diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 25e49c0c23..f141f616a4 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -1761,25 +1761,12 @@ pub(crate) fn new_error_event(message: String) -> PlainHistoryCell { PlainHistoryCell { lines } } -/// Build a history cell that renders request_user_input questions and answers. -pub(crate) fn new_request_user_input_result( - questions: Vec, - answers: HashMap, - interrupted: bool, -) -> RequestUserInputResultCell { - RequestUserInputResultCell { - questions, - answers, - interrupted, - } -} - /// Renders a completed (or interrupted) request_user_input exchange in history. #[derive(Debug)] pub(crate) struct RequestUserInputResultCell { - questions: Vec, - answers: HashMap, - interrupted: bool, + pub(crate) questions: Vec, + pub(crate) answers: HashMap, + pub(crate) interrupted: bool, } impl HistoryCell for RequestUserInputResultCell {