mirror of
https://github.com/openai/codex.git
synced 2026-11-10 08:43:33 +00:00
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:
1 parent
b6ab99ed87
commit
8ea297ff60
14 files changed
+229
-47
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user