Skip to content

fix(autocomplete): omit hidden flags from suggestions - #122

Open
sylvesterkaczmarek wants to merge 1 commit into
openai:mainfrom
sylvesterkaczmarek:fix/autocomplete-hidden-flags
Open

fix(autocomplete): omit hidden flags from suggestions#122
sylvesterkaczmarek wants to merge 1 commit into
openai:mainfrom
sylvesterkaczmarek:fix/autocomplete-hidden-flags

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

Keep hidden/internal CLI flags out of shell-completion suggestions.

Problem

The autocomplete code already respects cli.VisibleFlag when resolving an entered flag through findFlag, but the flag-name completion path loops over every flag in cmd.Flags without applying the same visibility check.

That means flags deliberately marked hidden can still be surfaced by Bash/Zsh/Fish/PowerShell completion when the user starts typing - or --.

This is separate from the existing hidden-command work: command suggestions already have their own child.Hidden handling, while this PR fixes flag visibility.

Fix

Apply the same cli.VisibleFlag / IsVisible() guard used by findFlag before generating flag-name completions.

Visible flags and aliases keep their existing completion behavior. Flags that do not implement cli.VisibleFlag are also unchanged.

Regression coverage

Added a focused synthetic-command regression with one visible and one hidden flag, each with a short alias. The test verifies both long and short visible names remain suggested while both hidden names are omitted.

Validation

The branch is based directly on current upstream main (a7719136b8ed401b0c51a05553a5e4f720150307) and contains one DCO-signed commit. The production change is 3 lines in handwritten internal/autocomplete/autocomplete.go, plus focused regression coverage. Full repository test execution is left to CI.

Risk

Low. The change only removes completion candidates for flags the CLI already marks as not visible; parsing and command execution are unchanged.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@sylvesterkaczmarek
sylvesterkaczmarek requested a review from a team as a code owner August 20, 2026 21:30
@markstuart-oai

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T01:31:55.546309Z 7aba6a2 Manual request
🔒 Security Review Completed 2026-09-06T01:33:55.063606Z 7aba6a2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 7aba6a28ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 7aba6a28ee

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants