From d038f3448f2eb9b48614f6359a3b21113d7d42ae Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Tue, 1 Sep 2026 04:16:25 +0000 Subject: [PATCH] Move `disable_paste_burst` under `[tui]` (#41976) ## What changed - Add `tui.disable_paste_burst` as the preferred configuration key. - Keep the top-level `disable_paste_burst` key as a legacy fallback. - Give the `[tui]` setting precedence when both keys are present, while preserving configuration-layer precedence. ## Testing Add configuration tests covering defaults, both key locations, precedence between the keys, and command-line overrides. GitOrigin-RevId: e7fc9337d5b19d2fd9407e08b8301cee77a11779 --- codex-rs/config/src/config_toml.rs | 4 +- codex-rs/config/src/types.rs | 6 ++ codex-rs/core/config.schema.json | 6 +- codex-rs/core/src/config/config_tests.rs | 81 ++++++++++++++++++++++++ codex-rs/core/src/config/mod.rs | 7 +- 5 files changed, 99 insertions(+), 5 deletions(-) diff --git a/codex-rs/config/src/config_toml.rs b/codex-rs/config/src/config_toml.rs index e7c4525ea7..5f0cc99a47 100644 --- a/codex-rs/config/src/config_toml.rs +++ b/codex-rs/config/src/config_toml.rs @@ -487,9 +487,7 @@ pub struct ConfigToml { /// Defaults to `true`. pub check_for_update_on_startup: Option, - /// When true, disables burst-paste detection for typed input entirely. - /// All characters are inserted as they are received, and no buffering - /// or placeholder replacement will occur for fast keypress bursts. + /// Legacy fallback for `tui.disable_paste_burst`. Prefer the setting under `[tui]`. pub disable_paste_burst: Option, /// When `false`, disables analytics across Codex product surfaces in this machine. diff --git a/codex-rs/config/src/types.rs b/codex-rs/config/src/types.rs index ed956cbf89..8dbe34df76 100644 --- a/codex-rs/config/src/types.rs +++ b/codex-rs/config/src/types.rs @@ -710,6 +710,12 @@ pub struct Tui { #[serde(default = "default_true")] pub show_tooltips: bool, + /// When true, disables burst-paste detection for typed input entirely. + /// All characters are inserted as they are received, and no buffering + /// or placeholder replacement will occur for fast keypress bursts. + /// Overrides the legacy top-level `disable_paste_burst` setting. Defaults to `false`. + pub disable_paste_burst: Option, + /// Start the composer in Vim mode (`Normal`) by default. /// Defaults to `false`. #[serde(default)] diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.json index 11e20bd67e..c43aa5315e 100644 --- a/codex-rs/core/config.schema.json +++ b/codex-rs/core/config.schema.json @@ -3772,6 +3772,10 @@ "description": "Enable animations (welcome screen, shimmer effects, spinners). Defaults to `true`.", "type": "boolean" }, + "disable_paste_burst": { + "description": "When true, disables burst-paste detection for typed input entirely. All characters are inserted as they are received, and no buffering or placeholder replacement will occur for fast keypress bursts. Overrides the legacy top-level `disable_paste_burst` setting. Defaults to `false`.", + "type": "boolean" + }, "keymap": { "allOf": [ { @@ -5798,7 +5802,7 @@ "type": "string" }, "disable_paste_burst": { - "description": "When true, disables burst-paste detection for typed input entirely. All characters are inserted as they are received, and no buffering or placeholder replacement will occur for fast keypress bursts.", + "description": "Legacy fallback for `tui.disable_paste_burst`. Prefer the setting under `[tui]`.", "type": "boolean" }, "experimental_compact_prompt_file": { diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index 8f5a3fc2e2..dcc504c87c 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -1210,6 +1210,7 @@ fn config_toml_deserializes_model_availability_nux() { notification_settings: TuiNotificationSettings::default(), animations: true, show_tooltips: true, + disable_paste_burst: None, vim_mode_default: false, raw_output_mode: false, alternate_screen: AltScreenMode::default(), @@ -4289,6 +4290,7 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() { notification_settings: TuiNotificationSettings::default(), animations: true, show_tooltips: true, + disable_paste_burst: None, vim_mode_default: false, raw_output_mode: false, alternate_screen: AltScreenMode::Auto, @@ -4307,6 +4309,85 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() { ); } +#[tokio::test] +async fn runtime_config_resolves_disable_paste_burst() -> anyhow::Result<()> { + for (toml, expected) in [ + ("", false), + ("disable_paste_burst = true", true), + ("disable_paste_burst = true\n[tui]", true), + ("[tui]\ndisable_paste_burst = true", true), + ( + "disable_paste_burst = true\n[tui]\ndisable_paste_burst = false", + false, + ), + ( + "disable_paste_burst = false\n[tui]\ndisable_paste_burst = true", + true, + ), + ] { + let config = Config::load_from_base_config_with_overrides( + toml::from_str(toml)?, + ConfigOverrides::default(), + tempdir()?.abs(), + ) + .await?; + + assert_eq!(config.disable_paste_burst, expected, "config: {toml}"); + } + Ok(()) +} + +#[tokio::test] +async fn disable_paste_burst_preserves_layering_and_new_key_precedence() -> anyhow::Result<()> { + for (toml, key, value, expected) in [ + ( + "disable_paste_burst = true", + "disable_paste_burst", + false, + false, + ), + ( + "disable_paste_burst = true", + "tui.disable_paste_burst", + false, + false, + ), + ( + "[tui]\ndisable_paste_burst = true", + "tui.disable_paste_burst", + false, + false, + ), + ( + "[tui]\ndisable_paste_burst = true", + "disable_paste_burst", + false, + true, + ), + ( + "[tui]\ndisable_paste_burst = false", + "disable_paste_burst", + true, + false, + ), + ] { + let codex_home = TempDir::new()?; + std::fs::write(codex_home.path().join(CONFIG_TOML_FILE), toml)?; + let config = ConfigBuilder::without_managed_config_for_tests() + .codex_home(codex_home.path().to_path_buf()) + .fallback_cwd(Some(codex_home.path().to_path_buf())) + .cli_overrides(vec![(key.to_string(), TomlValue::Boolean(value))]) + .build() + .await?; + + assert_eq!( + config.disable_paste_burst, expected, + "config: {toml}, override: {key}={value}" + ); + } + Ok(()) +} + #[tokio::test] async fn runtime_config_resolves_terminal_resize_reflow_defaults_and_overrides() { let cfg = Config::load_from_base_config_with_overrides( diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index 44a0411504..b8ef3d319d 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -4302,7 +4302,12 @@ impl Config { active_project, notices, check_for_update_on_startup, - disable_paste_burst: cfg.disable_paste_burst.unwrap_or(false), + disable_paste_burst: cfg + .tui + .as_ref() + .and_then(|tui| tui.disable_paste_burst) + .or(cfg.disable_paste_burst) + .unwrap_or(false), analytics_enabled: cfg.analytics.as_ref().and_then(|a| a.enabled), feedback_enabled: cfg .feedback