feat(cmd): add no-review cmd - #835
Conversation
|
🔍 OpenCodeReview found 2 issue(s) in this PR.
[bug · low] 📄
|
| addBackgroundFlags(cmd, &opts.background, &opts.backgroundFile) | ||
| addProviderFlag(cmd, &opts.provider) | ||
| addModelFlag(cmd, &opts.model) | ||
| cmd.Flags().BoolVar(&opts.noReviewFilter, "no-review-filter", false, "skip the per-file REVIEW_FILTER_TASK") |
There was a problem hiding this comment.
[maintainability · low]
The skip check happens before validating whether a review filter task actually exists. This means users will see "Review filter skipped for " messages for every file even when REVIEW_FILTER_TASK is not configured in the template. Consider moving the SkipReviewFilter check after the ft == nil || len(ft.Messages) == 0 validation to avoid spamming users with misleading skip messages when there was nothing to skip.
5541457 to
240f450
Compare
wu21-web
left a comment
There was a problem hiding this comment.
Great job there, no issues!
lizhengfeng101
left a comment
There was a problem hiding this comment.
Hey, nice PR! One small naming suggestion:
The existing skip flags follow a pattern of --no- + the core keyword from the task name:
PLAN_TASK→--no-plan/SkipPlanDEDUP_TASK→--no-dedup/SkipDedupPROJECT_SUMMARY_TASK→--no-summary/SkipSummary
For REVIEW_FILTER_TASK, following the same convention would give us --no-filter / noFilter / SkipFilter rather than --no-review-filter / noReviewFilter / SkipReviewFilter.
The review- prefix feels redundant here since this flag only exists on the ocr review subcommand anyway — there's no ambiguity about which filter we're skipping. Shorter is also easier to type :)
Would you mind renaming to --no-filter for consistency with the rest of the family?
240f450 to
4c9f335
Compare
|
Hi @lizhengfeng101, thanks for the review and the great naming suggestion! 🙏 That makes total sense — keeping the skip flags consistent with the existing --no-* convention keeps things cleaner and easier to remember. I've renamed --no-review-filter to --no-filter across the flag name, variable name, and the corresponding SkipFilter helper. Please take another look when you have a moment. |
lizhengfeng101
left a comment
There was a problem hiding this comment.
@Syt3s CI / test (pull_request)Failing
4c9f335 to
3b15f07
Compare
fixed |
lizhengfeng101
left a comment
There was a problem hiding this comment.
Hey @Syt3s, nice work addressing the earlier feedback — the check ordering and naming are both solid now. A few things I'd like cleaned up before we merge:
1. PR description is stale
The body still references --no-review-filter and SkipReviewFilter in several places (the design section, the files-changed table, etc.), but the code now uses --no-filter / SkipFilter. Would you mind updating the description to match? Once this merges, the PR becomes the historical record — future readers shouldn't have to diff the description against the code to figure out what actually landed.
2. AC-4 test name contradicts the implementation
t.Run("AC-4: Skip takes priority over nil ReviewFilterTask", ...)After you moved the SkipFilter check below the nil-template guard (the right call per the bot's feedback), it's actually the nil check that returns first — SkipFilter is never even evaluated in this path. The test still passes, but the name claims the opposite causality. Something like "AC-4: No LLM call when SkipFilter=true and ReviewFilterTask is nil" would accurately describe what's being asserted.
3. AC-4 doesn't exercise the SkipFilter path
Related to the above — because ReviewFilterTask is nil, the function bails out before reaching the SkipFilter branch. You could set SkipFilter to false and the test would still pass identically. So this sub-test isn't really adding coverage for the skip logic; it's a duplicate of the existing TestExecuteReviewFilter_NoFilterTask. Consider either removing it or giving it a non-nil ReviewFilterTask (so the skip check is actually reached and meaningfully tested).
Everything else looks good. Thanks for iterating on this!
3b15f07 to
41c4eeb
Compare
lizhengfeng101
left a comment
There was a problem hiding this comment.
All three issues addressed — description is accurate, AC-4 now exercises the actual SkipFilter branch with a meaningful assertion, and the naming is consistent throughout. LGTM, thanks for the quick turnaround!
commit 140871d Author: Syt3s <lkxyout@gmail.com> Date: Wed Aug 12 18:03:34 2026 +0800 feat(cmd): add SARIF output format (alibaba#820) commit 552dc95 Author: Syt3s <lkxyout@gmail.com> Date: Wed Aug 12 16:44:35 2026 +0800 feat(cmd): add no-review cmd (alibaba#835) * feat(cmd): add no-review cmd * docs(flags): improve --no-filter help text for clarity --------- Co-authored-by: kite <lizhengfeng.lzf@alibaba-inc.com> commit 980f21d Author: kite <254839944+lizhengfeng101@users.noreply.github.com> Date: Wed Aug 12 15:58:23 2026 +0800 chore: remove leftover Chinese from the Go core, CI examples and pages comments (alibaba#861) * docs(comments): translate Chinese comments to English Rewrite the remaining Chinese code comments outside the VSCode extension in English, so the Go core and the pages site read consistently. - allowed_ext.go: translate the default_exclude_patterns.json package doc. Quote the wildcards ("*", "**", "{a,b,c}") so gofmt stops reflowing the leading "*" as a markdown bullet, which had swallowed the first entry's wildcard and broken the list alignment in godoc. - HighlightsSection.tsx: translate three comments in parseStatValue and CountUpValue. * docs(examples): use "Chinese" instead of "中文" in OCR_LANGUAGE examples The language config value is fed to the LLM, which understands "Chinese" just as well, and "Chinese" is what the rest of the project already uses (skills/open-code-review/SKILL.md, config_cmd_test.go, ApplyLanguage). Keeps the GitLab CI example's inline docs fully English. * fix(agent): drop the unreachable Chinese branch from planBlockPattern task_template.json ships a single English template ("### Review Plan (Optional)") and is embedded via go:embed with no override path, so the "审查计划" alternative could never match anything. It came from the pre-open-source template and survived the alibaba#33 fix as dead defensive code. Drops the two test cases that only exercised that alternative.
Description
Adds
--no-filterflag toocr review, allowing users to skip theREVIEW_FILTER_TASKpost-processing phase — eliminating one LLM call per reviewed file and reducing token consumption.The
REVIEW_FILTER_TASKruns after each file's main review loop to filter out false-positive comments. Every reviewed file triggers exactly one additional LLM call for this phase. While effective for trimming low-quality comments, this per-file call adds up quickly — a 20-file PR costs 20 extra LLM round-trips even when the filter produces no actionable removals.ocr scanalready provides--no-plan,--no-dedup, and--no-summaryflags to skip optional LLM stages, butocr reviewhad no equivalent. This PR closes the gap by following the same established pattern.Design: mirrors the existing
--no-deduppattern frominternal/scan/agent.go. The skip check lives insideexecuteReviewFilter, placed after theReviewFilterTask == nilguard (so users aren't spammed with misleading skip messages when the template doesn't configure a filter task) and after the telemetry span is created (so the skip is still observable in traces via theskipped=truespan attribute). When the flag is set, a log line[ocr] Review filter skipped for <file> (--no-filter)is emitted and the function returns immediately.Files changed (4 files, 6 code locations):
internal/agent/agent.goSkipFilter booltoArgsstruct with doc commentinternal/agent/agent.go(executeReviewFilter)skipped=truespan attrcmd/opencodereview/review_cmd.gonoFilter booltoreviewOptions; wired toArgs.SkipFiltercmd/opencodereview/shared_flags.go--no-filterbool flag (defaultfalse) inregisterReviewFlagsinternal/agent/coverage_test.goTestExecuteReviewFilter_SkipFilterwith 5 sub-testsNo changes to
internal/scan/,internal/llmloop/,internal/tool/,internal/diff/, orinternal/config/. Zero new third-party Go dependencies.Type of Change
How Has This Been Tested?
All tests use
fakeAgentClient(an in-package mock with acallscounter) — no real LLM configuration needed. The counter-argument test (AC-3, no flag) proves the mock is correctly invoked when the filter runs, so the zero-call assertions in AC-1/2/4/5 are meaningful.New tests (5 sub-tests in
TestExecuteReviewFilter_SkipFilter):AC-1: SkipFilter disables the filterSkipFilter=true+ReviewFilterTaskpresent + comments exist →client.calls == 0, comments untouchedAC-2: All comments preserved when skippedAC-3: Default (no SkipFilter) still runs filterSkipFilterzero-value (false) →client.calls > 0, comments filtered normally (backward compat)AC-4: SkipFilter is reached when ReviewFilterTask is non-nilSkipFilter=true+ non-nilReviewFilterTask+ 1 comment →client.calls == 0, comment preserved (exercises the skip branch, not the nil-template guard)AC-5: Skip takes priority over no commentsSkipFilter=true+ zero comments →client.calls == 0Regression: all 6 existing
TestExecuteReviewFilter_*tests pass unchanged (NoFilterTask,NoComments,RemovesComments,LLMError,WithTimeout, plus the existing timeout variant).make testpasses locallyChecklist
go fmt,go vet)Related Issues
closes #833