Repository navigation
Description
OpenCodeReview Version
open-code-review dev linux/amd64 https://github.com/alibaba/open-code-review
Operating System
Linux (x86_64)
Installation Method
Build from source
LLM Provider
Other OpenAI-compatible endpoint
Bug Description
Several zero-argument CLI commands silently accept unexpected positional arguments instead of returning an error.
For example:
ocr version unexpected
prints the version and exits with status 0. Similarly, ocr llm providers unexpected still lists providers and exits successfully.
These commands do not define positional arguments, so unexpected values should be rejected. This behavior can hide scripting mistakes, and ocr llm test unexpected could proceed to an unintended provider request.
The issue reproduces on the latest upstream build, commit 533b526. It is independent of the configured LLM provider because argument validation should happen before any LLM request.
Steps to Reproduce
-
Check out OpenCodeReview commit
533b526and build it:git clone https://github.com/alibaba/open-code-review.git cd open-code-review git checkout 533b526 go build -o /tmp/ocr-cli ./cmd/opencodereview -
Run the
versioncommand with an unexpected positional argument:/tmp/ocr-cli version unexpected echo "exit=$?"
-
Observe that the version is printed and the command exits successfully with status
0. -
Repeat with another zero-argument command:
/tmp/ocr-cli llm providers unexpected echo "exit=$?"
-
Observe that the provider list is displayed and the command still exits with status
0.
This reproduction does not require an API key or an LLM request.
### Expected Behavior
Commands that do not accept positional arguments should reject unexpected arguments with a clear error and non-zero exit status.
For example:
```text
Error: unknown command "unexpected" for "ocr version"
The same validation should apply to:
ocr llm testocr llm providersocr session listocr delegate preview
The command handler should not run after invalid arguments are supplied. In particular, ocr llm test unexpected must fail before loading or contacting the configured LLM provider.
Normal invocations without positional arguments should continue working unchanged.
Logs / Error Output
No error is reported. The invalid argument is silently ignored.
$ /tmp/ocr-cli version unexpected
open-code-review dev linux/amd64
https://github.com/alibaba/open-code-review
$ echo $?
0
The expected behavior would be a non-zero exit status and an error such as:
Error: unknown command "unexpected" for "ocr version"Additional Context
No response
Activity
bailu-ZZ commentedon Aug 6, 2026
Hi, I’d like to work on this issue.
The root cause appears to be that several leaf Cobra commands do not define positional-argument validation. I plan to:
Args: cobra.NoArgstoversion,llm test,llm providers,session list, anddelegate preview;This should be a small, focused fix using Cobra’s built-in validation. Please assign this issue to me.
amh1k commentedon Aug 6, 2026
Maintainers can assign the issue to you