Skip to content

codex completion without any arguments always returns the bash completion #3009

@varenc

Description

@varenc

What version of Codex is running?

codex-cli 0.27.0

Which model were you using?

gpt-5 (medium)

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

  • Start a fish shell or zsh session.
  • Run codex completion without any arguments
  • Observe that it returns the bash shell completion script to STDOUT. This is very likely to be useless and not what the user wanted.

IMHO this is the wrong behavior. completion should either require an argument and error out if none is provided, or it should try to be smart, figure out what the current shell is, and then return the completion for the current shell. But I think the first approach is more correct and less magical.

As a simple example with Tailscale, their tailscale completion command just requires an argument be provided.

What is the expected behavior?

When codex completion is ran without arguments it either errors out, or it returns the equivalent of codex completion <MY_CURRENT_SHELL>

What do you see instead?

codex completion without any arguments always returns the bash completion. This is quite silly when I'm not running in bash.

Additional information

I can cite more examples of other popular tools that follow the behavior I've described, but have hopefully made my point.

Also I do really appreciate that codex has built in support to generate completions. I'm a huge fan of this approach to completion distribution!

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't working

    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