diff --git a/codex-rs/core/src/config.rs b/codex-rs/core/src/config.rs index 6a613abb..c84d84e0 100644 --- a/codex-rs/core/src/config.rs +++ b/codex-rs/core/src/config.rs @@ -1163,6 +1163,7 @@ pub fn log_dir(cfg: &Config) -> std::io::Result { #[cfg(test)] mod tests { use crate::config_types::HistoryPersistence; + use crate::config_types::Notifications; use super::*; use pretty_assertions::assert_eq; @@ -1201,6 +1202,19 @@ persistence = "none" ); } + #[test] + fn tui_config_missing_notifications_field_defaults_to_disabled() { + let cfg = r#" +[tui] +"#; + + let parsed = toml::from_str::(cfg) + .expect("TUI config without notifications should succeed"); + let tui = parsed.tui.expect("config should include tui section"); + + assert_eq!(tui.notifications, Notifications::Enabled(false)); + } + #[test] fn test_sandbox_config_parsing() { let sandbox_full_access = r#" diff --git a/codex-rs/core/src/config_types.rs b/codex-rs/core/src/config_types.rs index ec8e8e67..37376498 100644 --- a/codex-rs/core/src/config_types.rs +++ b/codex-rs/core/src/config_types.rs @@ -94,6 +94,7 @@ impl Default for Notifications { pub struct Tui { /// Enable desktop notifications from the TUI when the terminal is unfocused. /// Defaults to `false`. + #[serde(default)] pub notifications: Notifications, }