mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
f8b6b1db81
Previously, if the first user message was sent with the command invocation, e.g.: ``` $ cargo run --bin codex 'hello' ``` Then the user message was added as the first entry in the history and then `is_first_event` would be `false` here: https://github.com/openai/codex/blob/031df77dfb9248fe47b40ec52bf8b05052231722/codex-rs/tui/src/conversation_history_widget.rs#L178-L179 which would prevent the "welcome" message with things like the the model version from displaying. The fix in this PR is twofold: * Reorganize the logic so the `ChatWidget` constructor stores `initial_user_message` rather than sending it right away. Now inside `handle_codex_event()`, it waits for the `SessionConfigured` event and sends the `initial_user_message`, if it exists. * In `conversation_history_widget.rs`, `add_session_info()` checks to see whether a `WelcomeMessage` exists in the history when determining the value of `has_welcome_message`. By construction, we expect that `WelcomeMessage` is always the first message (in which case the existing `let is_first_event = self.entries.is_empty();` logic would be sound), but we decide to be extra defensive in case an `EventMsg::Error` is processed before `EventMsg::SessionConfigured`.
f8b6b1db81
ยท
2025-05-17 09:00:23 -07:00
History