From da973317bb86ced249eebd16b40b7427767c2cba Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Wed, 25 Nov 2026 00:09:06 +0000 Subject: [PATCH] Collapse turn details by default in the full-screen transcript (#63788) ## What changed Summarize tool calls and collapse completed turns when `tui.collapse_turn_details` is unset, including when the entire `[tui]` table is absent. Set `tui.collapse_turn_details = false` to opt out. Keep patches out of tool-call summaries so their inline diffs stay available for review during approval. Record the configured setting at startup with the `codex.tui.collapse_turn_details` counter. ## Testing Update configuration tests to cover the new default and an explicit opt-out. GitOrigin-RevId: 8a1de12bd2a26f445bbc1eee68f31fe93fe4925a --- codex-rs/config/src/types.rs | 4 ++-- codex-rs/core/config.schema.json | 4 ++-- codex-rs/core/src/config/config_tests.rs | 4 ++-- codex-rs/core/src/config/mod.rs | 2 +- codex-rs/tui/src/app/owned_transcript_follow_tests.rs | 1 - codex-rs/tui/src/app/owned_transcript_tests.rs | 2 +- codex-rs/tui/src/lib.rs | 5 +++++ codex-rs/tui/src/local_settings_tests.rs | 2 ++ codex-rs/tui/src/transcript_view/turn_details.rs | 3 ++- 9 files changed, 17 insertions(+), 10 deletions(-) diff --git a/codex-rs/config/src/types.rs b/codex-rs/config/src/types.rs index 9ddac6f433..377a88dfd2 100644 --- a/codex-rs/config/src/types.rs +++ b/codex-rs/config/src/types.rs @@ -995,8 +995,8 @@ pub struct Tui { #[serde(default = "default_true")] pub fullscreen_transcript: bool, - /// Summarize tool calls and collapse completed turns in the full-screen transcript. Defaults to `false`. - #[serde(default)] + /// Summarize tool calls and collapse completed turns in the full-screen transcript. Defaults to `true`. + #[serde(default = "default_true")] pub collapse_turn_details: bool, /// Preferred docked sidebar width as a percentage of the terminal. Defaults to one third. diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.json index 2acf872193..511aaaaead 100644 --- a/codex-rs/core/config.schema.json +++ b/codex-rs/core/config.schema.json @@ -5555,8 +5555,8 @@ "type": "boolean" }, "collapse_turn_details": { - "default": false, - "description": "Summarize tool calls and collapse completed turns in the full-screen transcript. Defaults to `false`.", + "default": true, + "description": "Summarize tool calls and collapse completed turns in the full-screen transcript. Defaults to `true`.", "type": "boolean" }, "copy_on_select": { diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index 81c194b418..59bf1289d3 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -1476,7 +1476,7 @@ fn config_toml_deserializes_model_availability_nux() { question_esc_back: true, raw_output_mode: false, fullscreen_transcript: true, - collapse_turn_details: false, + collapse_turn_details: true, sidebar_width_percent: None, mouse_scroll_speed: None, copy_on_select: Default::default(), @@ -4823,7 +4823,7 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() { question_esc_back: true, raw_output_mode: false, fullscreen_transcript: true, - collapse_turn_details: false, + collapse_turn_details: true, sidebar_width_percent: None, mouse_scroll_speed: None, copy_on_select: Default::default(), diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index ff21272645..312967a286 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -5035,7 +5035,7 @@ impl Config { .as_ref() .map(|t| t.raw_output_mode) .unwrap_or(false), - tui_collapse_turn_details: cfg.tui.as_ref().is_some_and(|tui| tui.collapse_turn_details), + tui_collapse_turn_details: cfg.tui.as_ref().is_none_or(|tui| tui.collapse_turn_details), tui_fullscreen_transcript: cfg .tui .as_ref() diff --git a/codex-rs/tui/src/app/owned_transcript_follow_tests.rs b/codex-rs/tui/src/app/owned_transcript_follow_tests.rs index cf24e67446..ccf3e416fc 100644 --- a/codex-rs/tui/src/app/owned_transcript_follow_tests.rs +++ b/codex-rs/tui/src/app/owned_transcript_follow_tests.rs @@ -190,7 +190,6 @@ async fn follow_control_click_preserves_draft_caret_and_composer_geometry() -> R )); } - app.local_settings.tui.collapse_turn_details = true; for id in 1..=6 { app.transcript_cells .push(Arc::new(crate::history_cell::new_web_search_call( diff --git a/codex-rs/tui/src/app/owned_transcript_tests.rs b/codex-rs/tui/src/app/owned_transcript_tests.rs index f15eff2bb6..395fe1aa85 100644 --- a/codex-rs/tui/src/app/owned_transcript_tests.rs +++ b/codex-rs/tui/src/app/owned_transcript_tests.rs @@ -1802,6 +1802,7 @@ mod browsing; #[tokio::test] async fn find_refreshes_live_details_before_searching_the_first_query() -> Result<()> { let mut app = crate::app::test_support::make_test_app().await; + app.local_settings.tui.collapse_turn_details = false; crate::chatwidget::tests::helpers::set_active_cell( &mut app.chat_widget, Box::new(crate::exec_cell::new_active_exec_command( @@ -2401,7 +2402,6 @@ async fn clickable_transcript_foreground_follows_mouse_motion() -> Result<()> { let mut tui = crate::tui::test_support::make_test_tui()?; tui.set_owned_screen(/*owned*/ true)?; let size = tui.terminal.size()?; - app.local_settings.tui.collapse_turn_details = true; app.transcript_cells = vec![ user_cell("See https://prompt.example/ for context."), Arc::new(history_cell::AgentMarkdownCell::new( diff --git a/codex-rs/tui/src/lib.rs b/codex-rs/tui/src/lib.rs index b7b3f5ead9..4f6894667e 100644 --- a/codex-rs/tui/src/lib.rs +++ b/codex-rs/tui/src/lib.rs @@ -2121,6 +2121,11 @@ async fn run_ratatui_app( /*inc*/ 1, &[("enabled", &config.tui_fullscreen_transcript.to_string())], ); + let _ = metrics.counter( + "codex.tui.collapse_turn_details", + /*inc*/ 1, + &[("enabled", &config.tui_collapse_turn_details.to_string())], + ); } // Cloud configuration and session selection can change screen policy after first paint. diff --git a/codex-rs/tui/src/local_settings_tests.rs b/codex-rs/tui/src/local_settings_tests.rs index 9c9aa640f8..003a2260d0 100644 --- a/codex-rs/tui/src/local_settings_tests.rs +++ b/codex-rs/tui/src/local_settings_tests.rs @@ -131,6 +131,7 @@ show_tooltips = false show_server_version_notice = false auto_recap = false fullscreen_transcript = true +collapse_turn_details = false mouse_scroll_speed = 0.5 copy_on_select = "never" copy_on_select_clear_selection = true @@ -193,6 +194,7 @@ fast_default_opt_out = true assert_eq!(config.startup_warnings, Vec::::new()); assert_eq!(config.tui_mouse_scroll_speed, Some(1.5)); assert!(config.tui_fullscreen_transcript); + assert_eq!(config.tui_collapse_turn_details, config_text.is_empty()); let bootstrap = crate::legacy_core::config::load_config_toml_with_layer_stack( home.path(), Some(&project_cwd), diff --git a/codex-rs/tui/src/transcript_view/turn_details.rs b/codex-rs/tui/src/transcript_view/turn_details.rs index a7136378fb..a6445dc34b 100644 --- a/codex-rs/tui/src/transcript_view/turn_details.rs +++ b/codex-rs/tui/src/transcript_view/turn_details.rs @@ -255,7 +255,8 @@ impl TurnDetails { { self.pending.push((start + index, tool.clone())); } - if calls.is_empty() { + // Keep the patch's inline diff disclosure available for approval. + if calls.is_empty() || any.is::() { group.finish(rows, cells); } else { if let Some(exec) = any.downcast_ref::()