From 8cd7f20b482a14c18e0db86ed3cb5c6d105e4dbb Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Thu, 2 Apr 2026 22:43:53 -0700 Subject: [PATCH] Fix deprecated login --api-key parsing (#16658) Addresses #16655 Problem: `codex login --api-key` failed in Clap before Codex could show the deprecation guidance. Solution: Allow the hidden `--api-key` flag to parse with zero or one values so both forms reach the `--with-api-key` message. --- codex-rs/cli/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codex-rs/cli/src/main.rs b/codex-rs/cli/src/main.rs index 082965b3d..f889e2256 100644 --- a/codex-rs/cli/src/main.rs +++ b/codex-rs/cli/src/main.rs @@ -287,6 +287,8 @@ struct LoginCommand { #[arg( long = "api-key", + num_args = 0..=1, + default_missing_value = "", value_name = "API_KEY", help = "(deprecated) Previously accepted the API key directly; now exits with guidance to use --with-api-key", hide = true