diff --git a/codex-rs/cli/src/main.rs b/codex-rs/cli/src/main.rs index b178941b1c..4753b84d01 100644 --- a/codex-rs/cli/src/main.rs +++ b/codex-rs/cli/src/main.rs @@ -69,6 +69,8 @@ use codex_terminal_detection::TerminalName; version, // If a sub‑command is given, ignore requirements of the default args. subcommand_negates_reqs = true, + // Prefer a recognized subcommand over the default interactive prompt positional. + subcommand_precedence_over_arg = true, // The executable is sometimes invoked via a platform‑specific name like // `codex-x86_64-unknown-linux-musl`, but the help output should always use // the generic `codex` command name that users run. diff --git a/codex-rs/cli/src/queue_cmd.rs b/codex-rs/cli/src/queue_cmd.rs index 4661d7b996..75d50d235f 100644 --- a/codex-rs/cli/src/queue_cmd.rs +++ b/codex-rs/cli/src/queue_cmd.rs @@ -191,6 +191,13 @@ mod tests { assert_eq!(cmd.at, None); } + #[test] + fn queue_without_required_args_is_subcommand_error() { + let err = MultitoolCli::try_parse_from(["codex", "queue"]) + .expect_err("queue should be parsed as a subcommand, not as an interactive prompt"); + assert_eq!(err.kind(), clap::error::ErrorKind::MissingRequiredArgument); + } + #[test] fn queue_rejects_legacy_content_flag() { assert!(