From d8ec270183ffb341fb0211c5ee8335419ea67cc7 Mon Sep 17 00:00:00 2001 From: pmccrary-oai Date: Fri, 21 Aug 2026 01:40:10 +0000 Subject: [PATCH] Rename the history notes extension config option (#39830) ## What changed Rename the token-budget configuration key and its Rust field from `use_history_notes_history` to `use_history_notes_extension`. Update the config schema, extension gating, explicit-setting detection, and tests to use the new name consistently. GitOrigin-RevId: b6a514e23f02095fcd1d35dc42eeb7394b800c77 --- .../tests/suite/v2/history_notes_extension.rs | 2 +- codex-rs/core/config.schema.json | 2 +- codex-rs/core/src/config/config_tests.rs | 4 ++-- codex-rs/core/src/config/mod.rs | 10 +++++----- codex-rs/core/src/session/token_budget.rs | 8 ++++---- codex-rs/core/tests/suite/token_budget.rs | 2 +- codex-rs/ext/history-notes/src/extension.rs | 2 +- .../ext/history-notes/tests/history_notes_extension.rs | 4 ++-- codex-rs/features/src/feature_configs.rs | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/codex-rs/app-server/tests/suite/v2/history_notes_extension.rs b/codex-rs/app-server/tests/suite/v2/history_notes_extension.rs index b0a0fb1da0..5fb505b563 100644 --- a/codex-rs/app-server/tests/suite/v2/history_notes_extension.rs +++ b/codex-rs/app-server/tests/suite/v2/history_notes_extension.rs @@ -33,7 +33,7 @@ async fn app_server_registers_history_and_notes_tools_for_token_budget_threads() .with_provider_base_url(&format!("{}/backend-api/codex", server.uri())) .with_provider_config("supports_websockets = false\nrequires_openai_auth = true") .with_extra_config( - "[features.token_budget]\nenabled = true\nuse_history_notes_history = true", + "[features.token_budget]\nenabled = true\nuse_history_notes_extension = true", ) .write(codex_home.path())?; write_chatgpt_auth( diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.json index c7126cde14..723cb827cf 100644 --- a/codex-rs/core/config.schema.json +++ b/codex-rs/core/config.schema.json @@ -3378,7 +3378,7 @@ "minimum": 1.0, "type": "integer" }, - "use_history_notes_history": { + "use_history_notes_extension": { "description": "Whether to expose the built-in history and notes extension.", "type": "boolean" } diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index fc4f5f82cb..b00e1ee1d4 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -654,7 +654,7 @@ async fn load_config_resolves_token_budget_config() -> std::io::Result<()> { r#" [features.token_budget] enabled = true -use_history_notes_history = true +use_history_notes_extension = true reminder_threshold_tokens = 16000 reminder_message_template = "Custom reminder: {n_remaining} tokens." guidance_message = "Preserve important state before compaction." @@ -662,7 +662,7 @@ auto_compact_fallback_prompt = " Write notes immediately. " auto_compact_fallback_buffer_tokens = 8000 "#, TokenBudgetConfig { - use_history_notes_history: true, + use_history_notes_extension: true, reminder_threshold_tokens: Some(16_000), reminder_message_template: "Custom reminder: {n_remaining} tokens.".to_string(), guidance_message: Some("Preserve important state before compaction.".to_string()), diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index 70ccc98baa..78d92c9b89 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -1087,7 +1087,7 @@ const AUTO_COMPACT_FALLBACK_PROMPT_MAX_BYTES: usize = 2000; #[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct TokenBudgetConfig { - pub use_history_notes_history: bool, + pub use_history_notes_extension: bool, pub reminder_threshold_tokens: Option, pub reminder_message_template: String, pub guidance_message: Option, @@ -1180,7 +1180,7 @@ impl TokenBudgetConfig { impl Default for TokenBudgetConfig { fn default() -> Self { Self { - use_history_notes_history: false, + use_history_notes_extension: false, reminder_threshold_tokens: None, reminder_message_template: DEFAULT_TOKEN_BUDGET_REMINDER_MESSAGE_TEMPLATE.to_string(), guidance_message: None, @@ -2720,8 +2720,8 @@ fn resolve_token_budget_config( } let token_budget_config = token_budget_toml_config(config_toml.features.as_ref()); - let use_history_notes_history = token_budget_config - .and_then(|config| config.use_history_notes_history) + let use_history_notes_extension = token_budget_config + .and_then(|config| config.use_history_notes_extension) .unwrap_or_default(); let reminder_threshold_tokens = token_budget_config.and_then(|config| config.reminder_threshold_tokens); @@ -2740,7 +2740,7 @@ fn resolve_token_budget_config( token_budget_config.and_then(|config| config.auto_compact_fallback_buffer_tokens); let token_budget = TokenBudgetConfig { - use_history_notes_history, + use_history_notes_extension, reminder_threshold_tokens, reminder_message_template, guidance_message, diff --git a/codex-rs/core/src/session/token_budget.rs b/codex-rs/core/src/session/token_budget.rs index 60d3b54e93..747d8cf5bc 100644 --- a/codex-rs/core/src/session/token_budget.rs +++ b/codex-rs/core/src/session/token_budget.rs @@ -16,11 +16,11 @@ pub(super) fn has_explicit_settings(config: &Config) -> bool { .is_some_and(|settings| { settings .keys() - .any(|key| !matches!(key.as_str(), "enabled" | "use_history_notes_history")) + .any(|key| !matches!(key.as_str(), "enabled" | "use_history_notes_extension")) }) || config.token_budget.as_ref().is_some_and(|token_budget| { let mut settings = token_budget.clone(); - settings.use_history_notes_history = false; + settings.use_history_notes_extension = false; settings != TokenBudgetConfig::default() }) } @@ -39,10 +39,10 @@ pub(super) fn apply_model_defaults(config: &mut Config, model_info: &ModelInfo) }; let token_budget = TokenBudgetConfig { - use_history_notes_history: config + use_history_notes_extension: config .token_budget .as_ref() - .is_some_and(|token_budget| token_budget.use_history_notes_history), + .is_some_and(|token_budget| token_budget.use_history_notes_extension), reminder_threshold_tokens: Some(model_defaults.reminder_threshold_tokens), reminder_message_template: model_defaults.reminder_message_template.clone(), guidance_message: Some(model_defaults.guidance_message.clone()), diff --git a/codex-rs/core/tests/suite/token_budget.rs b/codex-rs/core/tests/suite/token_budget.rs index 8e35e7a49d..55c06944a0 100644 --- a/codex-rs/core/tests/suite/token_budget.rs +++ b/codex-rs/core/tests/suite/token_budget.rs @@ -294,7 +294,7 @@ async fn token_budget_uses_model_message_defaults() -> Result<()> { .with_pre_build_hook(|home| { std::fs::write( home.join("config.toml"), - "[features.token_budget]\nenabled = true\nuse_history_notes_history = true\n", + "[features.token_budget]\nenabled = true\nuse_history_notes_extension = true\n", ) .expect("write token-budget configuration"); }) diff --git a/codex-rs/ext/history-notes/src/extension.rs b/codex-rs/ext/history-notes/src/extension.rs index 058db0baea..19083ed255 100644 --- a/codex-rs/ext/history-notes/src/extension.rs +++ b/codex-rs/ext/history-notes/src/extension.rs @@ -35,7 +35,7 @@ impl HistoryNotesExtension { if config .token_budget .as_ref() - .is_some_and(|token_budget| token_budget.use_history_notes_history) + .is_some_and(|token_budget| token_budget.use_history_notes_extension) && config.model_provider.is_openai() && self.auth_manager.current_auth_uses_codex_backend() { diff --git a/codex-rs/ext/history-notes/tests/history_notes_extension.rs b/codex-rs/ext/history-notes/tests/history_notes_extension.rs index bff3b20c26..d5675410e3 100644 --- a/codex-rs/ext/history-notes/tests/history_notes_extension.rs +++ b/codex-rs/ext/history-notes/tests/history_notes_extension.rs @@ -59,7 +59,7 @@ async fn installed_extension_exposes_and_invokes_history_notes_tools() -> TestRe .await?; config.model_provider.base_url = Some(format!("{}/backend-api/codex", server.uri())); config.token_budget = Some(TokenBudgetConfig { - use_history_notes_history: true, + use_history_notes_extension: true, ..TokenBudgetConfig::default() }); @@ -173,7 +173,7 @@ async fn history_notes_require_an_openai_provider_and_codex_backend_auth() -> Te .build() .await?; config.token_budget = Some(TokenBudgetConfig { - use_history_notes_history: true, + use_history_notes_extension: true, ..TokenBudgetConfig::default() }); diff --git a/codex-rs/features/src/feature_configs.rs b/codex-rs/features/src/feature_configs.rs index 34e98ee0c8..988dd8a865 100644 --- a/codex-rs/features/src/feature_configs.rs +++ b/codex-rs/features/src/feature_configs.rs @@ -291,7 +291,7 @@ pub struct TokenBudgetConfigToml { pub enabled: Option, /// Whether to expose the built-in history and notes extension. #[serde(skip_serializing_if = "Option::is_none")] - pub use_history_notes_history: Option, + pub use_history_notes_extension: Option, /// Number of tokens remaining before auto-compaction when the wrap-up reminder is emitted. #[serde(skip_serializing_if = "Option::is_none")] #[schemars(range(min = 1))]