From 917e29803b367e8276501be2b7ad910ad4ca125e Mon Sep 17 00:00:00 2001 From: Jeremy Rose <172423086+nornagon-openai@users.noreply.github.com> Date: Fri, 15 Aug 2025 01:06:42 -0400 Subject: [PATCH] tui: include optional full command line in history display (#2334) Add env var to show the raw, unparsed command line under parsed commands. When we have transcript mode we should show the full command there, but this is useful for debugging. --- codex-rs/tui/src/history_cell.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 2a17ff16..36d412ce 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -31,6 +31,7 @@ use ratatui::style::Style; use ratatui::widgets::Paragraph; use ratatui::widgets::WidgetRef; use ratatui::widgets::Wrap; +use shlex::try_join as shlex_try_join; use std::collections::HashMap; use std::io::Cursor; use std::path::PathBuf; @@ -232,10 +233,11 @@ fn exec_command_lines( ) -> Vec> { match parsed.is_empty() { true => new_exec_command_generic(command, output, start_time), - false => new_parsed_command(parsed, output, start_time), + false => new_parsed_command(command, parsed, output, start_time), } } fn new_parsed_command( + command: &[String], parsed_commands: &[ParsedCommand], output: Option<&CommandOutput>, start_time: Option, @@ -260,6 +262,24 @@ fn new_parsed_command( } }; + // Optionally include the complete, unaltered command from the model. + if std::env::var("SHOW_FULL_COMMANDS") + .map(|v| !v.is_empty()) + .unwrap_or(false) + { + let full_cmd = shlex_try_join(command.iter().map(|s| s.as_str())) + .unwrap_or_else(|_| command.join(" ")); + lines.push(Line::from(vec![ + Span::styled(" └ ", Style::default().add_modifier(Modifier::DIM)), + Span::styled( + full_cmd, + Style::default() + .add_modifier(Modifier::DIM) + .add_modifier(Modifier::ITALIC), + ), + ])); + } + for (i, parsed) in parsed_commands.iter().enumerate() { let text = match parsed { ParsedCommand::Read { name, .. } => format!("📖 {name}"),