From 483532f28df4a3c60d1ab47108952ac67b9afee6 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 15 Dec 2025 11:02:24 -0800 Subject: [PATCH] nudge-update --- codex-rs/core/src/error.rs | 11 +++++++---- codex-rs/core/src/lib.rs | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/src/error.rs b/codex-rs/core/src/error.rs index b621393c15..04bc90b199 100644 --- a/codex-rs/core/src/error.rs +++ b/codex-rs/core/src/error.rs @@ -3,6 +3,7 @@ use crate::token_data::KnownPlan; use crate::token_data::PlanType; use crate::truncate::TruncationPolicy; use crate::truncate::truncate_text; +use crate::update_nudge::update_available_nudge; use chrono::DateTime; use chrono::Datelike; use chrono::Local; @@ -24,7 +25,6 @@ pub type Result = std::result::Result; /// Limit UI error messages to a reasonable size while keeping useful context. const ERROR_MESSAGE_UI_MAX_BYTES: usize = 2 * 1024; // 4 KiB -const UPDATE_AVAILABLE_NUDGE: &str = "Update available. Run `codex update`."; pub(crate) fn error_event_with_update_nudge( message: String, @@ -50,13 +50,16 @@ pub(crate) fn stream_error_event_with_update_nudge( } fn maybe_append_update_nudge(message: String, is_up_to_date: bool) -> String { - if is_up_to_date { + // skip if version is 0.0.0 + let is_dev = env!("CARGO_PKG_VERSION") == "0.0.0"; + if is_up_to_date || is_dev { return message; } + let nudge = update_available_nudge(); if message.is_empty() { - UPDATE_AVAILABLE_NUDGE.to_string() + nudge } else { - format!("{message}\n{UPDATE_AVAILABLE_NUDGE}") + format!("{message}\n{nudge}") } } diff --git a/codex-rs/core/src/lib.rs b/codex-rs/core/src/lib.rs index a4a7a9ecd7..da66ded50d 100644 --- a/codex-rs/core/src/lib.rs +++ b/codex-rs/core/src/lib.rs @@ -95,6 +95,7 @@ pub use rollout::list::read_head_for_summary; mod function_tool; mod state; mod tasks; +mod update_nudge; mod user_notification; mod user_shell_command; pub mod util;