diff --git a/codex-rs/config/src/hook_config.rs b/codex-rs/config/src/hook_config.rs index a7ee820e6..8e18cb935 100644 --- a/codex-rs/config/src/hook_config.rs +++ b/codex-rs/config/src/hook_config.rs @@ -10,6 +10,8 @@ use serde::Serialize; #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] #[serde(deny_unknown_fields)] pub struct HooksFile { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, #[serde(default)] pub hooks: HookEventsToml, } diff --git a/codex-rs/config/src/hooks_tests.rs b/codex-rs/config/src/hooks_tests.rs index a2eb2d232..3d51840fc 100644 --- a/codex-rs/config/src/hooks_tests.rs +++ b/codex-rs/config/src/hooks_tests.rs @@ -13,6 +13,7 @@ use super::MatcherGroup; fn hooks_file_deserializes_existing_json_shape() { let parsed: HooksFile = serde_json::from_str( r#"{ + "description": "Optional stop-time review gate for Codex Companion.", "hooks": { "PreToolUse": [ { @@ -35,6 +36,7 @@ fn hooks_file_deserializes_existing_json_shape() { assert_eq!( parsed, HooksFile { + description: Some("Optional stop-time review gate for Codex Companion.".to_string()), hooks: HookEventsToml { pre_tool_use: vec![MatcherGroup { matcher: Some("^Bash$".to_string()),