From 9dce0d78825e0ecf7fe397e79014fc4bbedfa45e Mon Sep 17 00:00:00 2001 From: pap Date: Wed, 30 Jul 2025 20:32:01 +0100 Subject: [PATCH] don't show session information at each reconfiguration --- codex-rs/tui/src/chatwidget.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 2368ebbfa8..63d9aedd41 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -57,6 +57,7 @@ pub(crate) struct ChatWidget<'a> { // We wait for the final AgentMessage event and then emit the full text // at once into scrollback so the history contains a single message. answer_buffer: String, + new_session: bool, } struct UserMessage { @@ -141,6 +142,7 @@ impl ChatWidget<'_> { token_usage: TokenUsage::default(), reasoning_buffer: String::new(), answer_buffer: String::new(), + new_session: true, } } @@ -207,8 +209,12 @@ impl ChatWidget<'_> { EventMsg::SessionConfigured(event) => { self.bottom_pane .set_history_metadata(event.history_log_id, event.history_entry_count); + // Record session information at the top of the conversation. - self.add_to_history(HistoryCell::new_session_info(&self.config, event, true)); + if self.new_session { + self.add_to_history(HistoryCell::new_session_info(&self.config, event, true)); + self.new_session = false; + } if let Some(user_message) = self.initial_user_message.take() { // If the user provided an initial message, add it to the