Lightweight coding agent that runs in your terminal
Rust
fix: run standalone updates noninteractively (#24637)
efrazer-oai5314f55097c2
diff --git a/codex-rs/tui/src/history_cell/notices.rs b/codex-rs/tui/src/history_cell/notices.rsindex 3344dc45cd..7fb994442c 100644--- a/codex-rs/tui/src/history_cell/notices.rs+++ b/codex-rs/tui/src/history_cell/notices.rs@@ -52,7 +52,8 @@ impl HistoryCell for UpdateAvailableHistoryCell {.width().min(usize::from(width.saturating_sub(4))).max(1);- with_border_with_inner_width(content.lines, inner_width)+ let lines = adaptive_wrap_lines(content.lines, RtOptions::new(inner_width));+ with_border_with_inner_width(lines, inner_width)}fn raw_lines(&self) -> Vec<Line<'static>> {diff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__standalone_unix_update_available_history_cell_snapshot.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__standalone_unix_update_available_history_cell_snapshot.snapnew file mode 100644index 0000000000..c8f352dbb4--- /dev/null+++ b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__standalone_unix_update_available_history_cell_snapshot.snap@@ -0,0 +1,11 @@+---+source: tui/src/history_cell/tests.rs+expression: rendered+---+╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮+│ ✨ Update available! 0.0.0 -> 9.9.9 │+│ Run sh -c 'curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh' to update. │+│ │+│ See full release notes: │+│ https://github.com/openai/codex/releases/latest │+╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯diff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__standalone_windows_update_available_history_cell_snapshot.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__standalone_windows_update_available_history_cell_snapshot.snapnew file mode 100644index 0000000000..fb15a05775--- /dev/null+++ b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__standalone_windows_update_available_history_cell_snapshot.snap@@ -0,0 +1,12 @@+---+source: tui/src/history_cell/tests.rs+expression: rendered+---+╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮+│ ✨ Update available! 0.0.0 -> 9.9.9 │+│ Run powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm │+│ https://chatgpt.com/codex/install.ps1 | iex' to update. │+│ │+│ See full release notes: │+│ https://github.com/openai/codex/releases/latest │+╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯diff --git a/codex-rs/tui/src/history_cell/tests.rs b/codex-rs/tui/src/history_cell/tests.rsindex 7f846d39fb..8c48ced86a 100644--- a/codex-rs/tui/src/history_cell/tests.rs+++ b/codex-rs/tui/src/history_cell/tests.rs@@ -1027,6 +1027,24 @@ fn web_search_history_cell_snapshot() {insta::assert_snapshot!(rendered);}+#[test]+fn standalone_unix_update_available_history_cell_snapshot() {+ let cell =+ UpdateAvailableHistoryCell::new("9.9.9".to_string(), Some(UpdateAction::StandaloneUnix));+ let rendered = render_lines(&cell.display_lines(/*width*/ 110)).join("\n");++ insta::assert_snapshot!(rendered);+}++#[test]+fn standalone_windows_update_available_history_cell_snapshot() {+ let cell =+ UpdateAvailableHistoryCell::new("9.9.9".to_string(), Some(UpdateAction::StandaloneWindows));+ let rendered = render_lines(&cell.display_lines(/*width*/ 110)).join("\n");++ insta::assert_snapshot!(rendered);+}+#[test]fn web_search_history_cell_wraps_with_indented_continuation() {let query = "example search query with several generic words to exercise wrapping".to_string();diff --git a/codex-rs/tui/src/update_action.rs b/codex-rs/tui/src/update_action.rsindex 0dbb145390..420562f13b 100644--- a/codex-rs/tui/src/update_action.rs+++ b/codex-rs/tui/src/update_action.rs@@ -14,9 +14,9 @@ pub enum UpdateAction {BunGlobalLatest,/// Update via `brew upgrade codex`.BrewUpgrade,- /// Update via `curl -fsSL https://chatgpt.com/codex/install.sh | sh`.+ /// Update via `curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh`.StandaloneUnix,- /// Update via `irm https://chatgpt.com/codex/install.ps1|iex`.+ /// Update via `$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex`.StandaloneWindows,}@@ -43,7 +43,10 @@ impl UpdateAction {UpdateAction::BrewUpgrade => ("brew", &["upgrade", "--cask", "codex"]),UpdateAction::StandaloneUnix => ("sh",- &["-c", "curl -fsSL https://chatgpt.com/codex/install.sh | sh"],+ &[+ "-c",+ "curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh",+ ],),UpdateAction::StandaloneWindows => ("powershell",@@ -51,7 +54,7 @@ impl UpdateAction {"-ExecutionPolicy","Bypass","-c",- "irm https://chatgpt.com/codex/install.ps1 | iex",+ "$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex",],),}@@ -140,7 +143,10 @@ mod tests {UpdateAction::StandaloneUnix.command_args(),("sh",- &["-c", "curl -fsSL https://chatgpt.com/codex/install.sh | sh"][..],+ &[+ "-c",+ "curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh"+ ][..],));assert_eq!(@@ -151,7 +157,7 @@ mod tests {"-ExecutionPolicy","Bypass","-c",- "irm https://chatgpt.com/codex/install.ps1 | iex"+ "$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex"][..],));