Add a TUI setting to disable automatic recaps (#42101)

## What changed

- Add the `tui.auto_recap` configuration option, enabled by default.
- When disabled, cancel scheduled automatic recap checks, reject automatic
  requests, and discard pending automatic results without retrying.
- Keep manual `/recap` requests available regardless of the setting.

## Testing

- Cover configuration defaults and command-line overrides.
- Cover scheduling cancellation, pending request cleanup, discarded results,
  and manual recaps while automatic recaps are disabled.

GitOrigin-RevId: 7d5323f58a2c84e60683a25a8c77653097efe6e2
This commit is contained in:
Felipe Coury
2026-09-01 17:09:13 +00:00
committed by copyberry
parent b6ab99ed87
commit 8ea297ff60
14 changed files with 229 additions and 47 deletions
+5
View File
@@ -3810,6 +3810,11 @@
"description": "Enable animations (welcome screen, shimmer effects, spinners). Defaults to `true`.",
"type": "boolean"
},
"auto_recap": {
"default": true,
"description": "Generate automatic conversation recaps when the terminal is unfocused. Defaults to `true`. Disabling this leaves `/recap` available on demand.",
"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"
+34
View File
@@ -1210,6 +1210,7 @@ fn config_toml_deserializes_model_availability_nux() {
notification_settings: TuiNotificationSettings::default(),
animations: true,
show_tooltips: true,
auto_recap: true,
disable_paste_burst: None,
vim_mode_default: false,
raw_output_mode: false,
@@ -1316,6 +1317,38 @@ async fn runtime_config_uses_tui_raw_output_mode() {
assert!(cfg.tui_raw_output_mode);
}
#[tokio::test]
async fn tui_auto_recap_defaults_and_cli_overrides() -> anyhow::Result<()> {
for (toml, override_value, expected) in [
("", None, true),
("[tui]", None, true),
("[tui]\nauto_recap = true", None, true),
("[tui]\nauto_recap = false", None, false),
("[tui]\nauto_recap = true", Some(false), false),
("[tui]\nauto_recap = false", Some(true), true),
] {
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(
override_value
.into_iter()
.map(|enabled| ("tui.auto_recap".to_string(), TomlValue::Boolean(enabled)))
.collect(),
)
.build()
.await?;
assert_eq!(
config.tui_auto_recap, expected,
"config: {toml}, override: {override_value:?}"
);
}
Ok(())
}
#[test]
fn config_toml_deserializes_permission_profiles() {
let toml = r#"
@@ -4190,6 +4223,7 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() {
notification_settings: TuiNotificationSettings::default(),
animations: true,
show_tooltips: true,
auto_recap: true,
disable_paste_burst: None,
vim_mode_default: false,
raw_output_mode: false,
+4
View File
@@ -742,6 +742,9 @@ pub struct Config {
/// Show startup tooltips in the TUI welcome screen.
pub show_tooltips: bool,
/// Generate automatic TUI recaps. Manual `/recap` remains available when disabled.
pub tui_auto_recap: bool,
/// Persisted startup availability NUX state for model tooltips.
pub model_availability_nux: ModelAvailabilityNuxConfig,
@@ -4322,6 +4325,7 @@ impl Config {
.unwrap_or_default(),
animations: cfg.tui.as_ref().map(|t| t.animations).unwrap_or(true),
show_tooltips: cfg.tui.as_ref().map(|t| t.show_tooltips).unwrap_or(true),
tui_auto_recap: cfg.tui.as_ref().map(|t| t.auto_recap).unwrap_or(/*default*/ true),
model_availability_nux: cfg
.tui
.as_ref()