From f8ba48d995e346c8e7abbd109a74429f2efeaee9 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 18 Dec 2025 18:32:41 -0800 Subject: [PATCH] progress --- codex-rs/core/src/api_bridge.rs | 5 +++++ codex-rs/core/src/error.rs | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/codex-rs/core/src/api_bridge.rs b/codex-rs/core/src/api_bridge.rs index 79fd67d650..c7da55da85 100644 --- a/codex-rs/core/src/api_bridge.rs +++ b/codex-rs/core/src/api_bridge.rs @@ -67,6 +67,11 @@ pub(crate) fn map_api_error(err: ApiError) -> CodexErr { status, request_id: extract_request_id(headers.as_ref()), }) + } else if status == http::StatusCode::PRECONDITION_FAILED + && body_text + .contains("Models catalog has changed. Please refresh your models list.") + { + CodexErr::OutdatedModels } else { CodexErr::UnexpectedStatus(UnexpectedResponseError { status, diff --git a/codex-rs/core/src/error.rs b/codex-rs/core/src/error.rs index e8fa91d26e..e85eaf0dbf 100644 --- a/codex-rs/core/src/error.rs +++ b/codex-rs/core/src/error.rs @@ -90,6 +90,10 @@ pub enum CodexErr { #[error("spawn failed: child stdout/stderr not captured")] Spawn, + /// Returned when the models list is outdated and needs to be refreshed. + #[error("remote models list is outdated")] + OutdatedModels, + /// Returned by run_command_stream when the user pressed Ctrl‑C (SIGINT). Session uses this to /// surface a polite FunctionCallOutput back to the model instead of crashing the CLI. #[error("interrupted (Ctrl-C). Something went wrong? Hit `/feedback` to report the issue.")]