Skip to content

codex exec --help advertises a second positional [COMMAND] but parser rejects it #15535

@aquiles-ai123

Description

@aquiles-ai123

codex exec --help advertises a second positional [COMMAND], but the parser rejects it

Summary

codex exec --help currently shows this usage line:

Usage: codex exec [OPTIONS] [PROMPT] [COMMAND]

That suggests exec accepts two positionals: a prompt and then a command.

In practice, providing a second positional fails immediately in argument parsing with:

error: unexpected argument 'false' found

So the help output and the actual parser behavior disagree.

Repro

Check the help text:

codex exec --help | sed -n '1,20p'

Observed excerpt:

Run Codex non-interactively

Usage: codex exec [OPTIONS] [PROMPT] [COMMAND]

Now try to use stdin for the prompt and pass false as the advertised second positional:

printf '' | codex exec --ephemeral --skip-git-repo-check --color never -C /home/cryptotrading74 - false
printf "outer_exit=%s\n" "$?"

Observed output:

error: unexpected argument 'false' found

Usage: codex exec [OPTIONS] [PROMPT] [COMMAND]

For more information, try '--help'.
outer_exit=2

Expected behavior

One of these should be true:

  • codex exec should actually accept the advertised second positional [COMMAND]
  • or the help text should stop advertising [COMMAND]

Actual behavior

The help text advertises [COMMAND], but the parser rejects any second positional as unexpected.

Why this matters

This is misleading for automation and scripting, because the CLI help describes an invocation form that cannot be used.

Additional information

This looks related in spirit to other exec --help mismatches such as #13614, but this report is specifically about the phantom [COMMAND] positional shown in usage.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingexecIssues related to the `codex exec` subcommand

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions