Fix unknown command suggestions - #28
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b1ed626de
ℹ️ 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".
| // suggestCommand takes a list of commands and a provided string to suggest a | ||
| // command name | ||
| func suggestCommand(commands []*cli.Command, provided string) string { | ||
| const minSuggestionDistance = 0.75 |
There was a problem hiding this comment.
Handle single-edit typos for short commands
For the real run subcommand declared with suggestions enabled in pkg/cmd/finetuningalphagrader.go:17-20, omitting the middle character produces jaroWinkler("run", "rn") == 0.611, so this fixed threshold returns no suggestion even though the input is only one deletion away. The new filter therefore suppresses a close typo that the change is intended to preserve; the cutoff should account for short command lengths or use an edit-distance fallback.
Useful? React with 👍 / 👎.
| if distance < minSuggestionDistance || len(lineage) == 0 { | ||
| return "" |
There was a problem hiding this comment.
Reject unrelated short inputs before suggesting
With the actual root command list, an unrelated invocation such as openai bar still passes this check because jaroWinkler("beta:threads", "bar") == 0.775: the short input's three characters match widely separated characters in the longer command, and the common b prefix boosts the score over the cutoff. As a result, the CLI still suggests beta:threads for clearly unrelated input, so the new regression test's two-command fixture does not establish that the production command set avoids the original false-positive behavior.
Useful? React with 👍 / 👎.
Summary:
Testing:
go test ./pkg/cmd -run TestSuggestCommandbecausegois not installed in this local environment.Fixes #16
AI assistance: This bug fix was prepared with AI assistance and reviewed before submission.