Propagate installer download failures in standalone Unix updates (#57208)

## Why

The standalone Unix update pipeline could return success when `curl` failed because the shell consuming its output exited successfully.

## What changed

Download the installer into a shell variable and evaluate it only after a successful download, preserving `CODEX_NON_INTERACTIVE=1`. Update the displayed update command to match.

## Testing

Add a Unix regression test that forces an installer download failure and asserts a nonzero exit status. Update the update-available snapshot for the new command.

GitOrigin-RevId: cf6ce0dae483203e3609bb35f35eb04bb3096c28
This commit is contained in:
Eric Traut
2026-10-26 19:29:16 +00:00
committed by copyberry
parent 7c997fe2de
commit 57b4c60463
2 changed files with 28 additions and 20 deletions
@@ -2,10 +2,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 │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✨ Update available! 0.0.0 -> 9.9.9 │
│ Run sh -c 's=$(curl -fsSL https://chatgpt.com/codex/install.sh) && CODEX_NON_INTERACTIVE=1 eval "$s"' to │
│ update. │
│ │
│ See full release notes: │
│ https://github.com/openai/codex/releases/latest │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
+20 -13
View File
@@ -20,7 +20,7 @@ pub enum UpdateAction {
PnpmGlobalLatest,
/// Update via `brew upgrade codex`.
BrewUpgrade,
/// Update via `curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh`.
/// Update via the standalone Unix installer.
StandaloneUnix,
/// Update via `$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex`.
StandaloneWindows,
@@ -56,7 +56,7 @@ impl UpdateAction {
"sh",
&[
"-c",
"curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh",
r#"s=$(curl -fsSL https://chatgpt.com/codex/install.sh) && CODEX_NON_INTERACTIVE=1 eval "$s""#,
],
),
UpdateAction::StandaloneWindows => (
@@ -156,17 +156,7 @@ mod tests {
}
#[test]
fn standalone_update_commands_rerun_latest_installer() {
assert_eq!(
UpdateAction::StandaloneUnix.command_args(),
(
"sh",
&[
"-c",
"curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh"
][..],
)
);
fn standalone_windows_update_command_reruns_latest_installer() {
assert_eq!(
UpdateAction::StandaloneWindows.command_args(),
(
@@ -180,6 +170,23 @@ mod tests {
)
);
}
#[cfg(unix)]
#[test]
fn standalone_unix_update_fails_when_installer_download_fails() {
let (command, args) = UpdateAction::StandaloneUnix.command_args();
let offline_command = args[1].replace("https://chatgpt.com", "file:///dev/null");
assert_ne!(offline_command, args[1], "installer URL must be replaced");
let output = std::process::Command::new(command)
.args([args[0], &offline_command])
.env_clear()
.env("HOME", "/dev/null")
.env("PATH", "/usr/bin:/bin")
.output()
.expect("run standalone Unix update command");
assert!(!output.status.success(), "{output:?}");
}
}
/// Package source explicitly selected by the user in the daemon menu.