Skip to content

fix(review): align code-reviewer Duplicated Code severity with code-design - #8395

Merged
kyle-sexton merged 17 commits into
mainfrom
fix/8330-code-reviewer-duplicated-code-severity
Oct 19, 2026
Merged

kyle-sexton merged 17 commits into
mainfrom
fix/8330-code-reviewer-duplicated-code-severity

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #8330

Summary

The code-reviewer agent rated Duplicated Code as an advisory SUGGESTION, while /review:quality-gate code-design rates an introduced, unsynced copy CRITICAL under its cascade rule. The two reviewers disagreed on the same diff. This aligns code-reviewer with the code-design criteria for Duplicated Code only.

Fix

  • plugins/review/agents/code-reviewer.md: a "Repetition severity" paragraph points at the bundled code-design criteria (skills/quality-gate/context/code-design.md, "Bundled criteria", "The cascade rule", "Exempt from CRITICAL") and rates introduced Duplicated Code CRITICAL when the cascade rule holds. Shotgun Surgery and other repetition stay SUGGESTION, as do Markdown and a prototype quality bar. With no Quality bar: line in the brief it rates as production and says so. A Duplicated Code finding that names the repeated fact and the diverging change may carry Confidence: high once verified at every copy. A project's own severity vocabulary or criteria still win.
  • plugins/review/skills/quality-gate/context/self.md: the self-mode prompt allows that Quality bar: line.
  • plugins/review/skills/fanout/context/findings-normalization.md: the confidence column notes the Duplicated Code exception.
  • plugins/review/agents/brief-reviewer.md: lists code-design among the quality-gate modes that dispatch it.
  • New eval plugins/review/evals/code-reviewer-duplicated-code-severity (dispatch, duplicated-constant CRITICAL, Shotgun Surgery not blocking) and a changelog fragment.

Because the merge lane blocks on CRITICAL, an introduced, unsynced copy now blocks an unattended merge.

Verification

  • Phase verifier: 9/9 acceptance criteria met, plus one advisory finding fixed (c1cf27a: point code-reviewer at the code-design table and allow its quality-bar line).
  • Paid eval run of code-reviewer-duplicated-code-severity: with the branch's plugin 1.0, without the plugin 0.0 (+1.0).
  • bash scripts/check-affected.sh --tests --base origin/main after merging main: 8 passed, 1 skipped (no changed .py).
  • typos clean over the changed paths.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 17 commits October 18, 2026 20:22
Every quality-gate mode takes --worktree, --base, --quality-bar and
--report-only, so an orchestrator can review a phase diff in a worker's
worktree. With a base SHA no pull-request lookup or fetch runs. Adds the
qg-phase-boundary-worktree eval case.

Refs #8327

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The phase-boundary inputs are passed explicitly by an orchestrator, so the
description needs no new trigger phrase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d grants

Restore the argument-hint to the mode set so it fits the 100-character
budget and matches the lead of the Arguments line; the phase-boundary
flags stay documented in the Arguments line and context/phase-boundary.md.

Remove the allowed-tools entries that put a wildcard before the git
subcommand (git -C * ...). A wildcard there also approves options such as
-c core.fsmonitor=<cmd>, which runs a program, in a skill that reviews
untrusted diffs. Worktree-targeted commands go through normal permission
handling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under --base or --worktree, code mode skips the pr-review-toolkit path
for its code-reviewer fallback, and downstream mode skips the remote
downstream_probe layer and treats the floor as report. Under
--report-only the size-crossing loop reads git diff -z instead of a
written path file. Name the modes --quality-bar applies to, pass spec
text to the spec reviewer, and fail the eval grader only on a finding
in admin.js, not on a note that it predates the base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Name pr and close-out in the --quality-bar row; brief reviewers with
  each mode's own required inputs; restatement dispatches under --base.
- Under --report-only the standards ladder takes its non-interactive rung.
- code skips size crossings under --worktree; define the report-only base.
- Step 0 skips the PR-exists signal with --base; drop restated upstream.
- Eval: fail on any Write, add a no-Edit grader.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
code-reviewer, security-reviewer and architecture-guardian run only the
change-set commands their brief supplies (worktree path and base SHA),
with no gh lookup, fetch or ls-remote; without one, step 2 is unchanged.
phase-boundary.md says the brief replaces that step. criteria mode under
--base or --worktree dispatches a fresh-context review:brief-reviewer
instead of reviewing inline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restatement mode now dispatches its batch reviewer under --worktree as
well as --base, so a worktree-only run no longer reviews inline from the
invoking checkout.

The phase-boundary reviewer brief names the worktree's absolute path as
the file-read root, and code-reviewer, security-reviewer and
architecture-guardian resolve every Read, Grep, Glob and listed
untracked path under a supplied worktree. The advisory line no longer
reads as if per-slice passes the plan's rationale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace the per-command worktree anchoring with one rule: when the brief
supplies a worktree, every command and tool call in the review targets it
(git via git -C, Read/Grep/Glob, untracked paths, and any other command
such as a dependency audit), never the invoking checkout. Stated
identically in code-reviewer, security-reviewer and architecture-guardian,
and in the quality-gate phase-boundary brief for every dispatched
reviewer, review:brief-reviewer included. The downstream probe's
repository root is the worktree path under --worktree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alternation

typos read the [Ss]earch character class as the misspelling "earch" and
failed lint-repo. (?:search|Search) matches the same strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mode loads the consumer's review criteria through the standards
resolution ladder, falls back to small bundled criteria (Duplicated Code,
Shotgun Surgery, Speculative Generality), and dispatches a fresh-context
brief-reviewer. Repetition is CRITICAL only when the diff introduces an
unsynced copy in code, naming the fact and the diverging change; Markdown,
cascades and the prototype bar stay SUGGESTION. A contradicting consumer
standard wins and the report names the overridden default; with no
quality bar the review assumes production and says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Five plugin-eval cases cover the mode's severity rules: an introduced,
unsynced code copy is CRITICAL with the production assumption named; a
declared-registry entry and a file move are not CRITICAL; Markdown
repetition and the prototype bar stay SUGGESTION; a contradicting
docs/standards file produces the override line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The no-critical and repetition-is-suggestion graders now fail only on a
rated finding (a severity table cell, a line that starts with the
severity, a (CRITICAL) or [CRITICAL] label, or Severity: CRITICAL) and
pass a negated mention such as "Not CRITICAL: setup.md is Markdown".
The cascade grader requires the CRITICAL finding to name
FREE_SHIPPING_THRESHOLD or 50, not the word threshold. code-design.md
states that its repetition rule overrides severity.md's "code
duplication" IMPORTANT example.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…esign

code-reviewer now treats the bundled code-design criteria as the
documented rule that licenses escalating Duplicated Code, and only
Duplicated Code: an introduced, unsynced copy in code is CRITICAL when
the finding names the repeated fact and the diverging change, and may
carry Confidence: high once verified at every copy. Shotgun Surgery and
other repetition stay SUGGESTION, as do Markdown and a prototype bar.
With no Quality bar: line it rates as production and says so.

brief-reviewer lists code-design among the quality-gate modes that
dispatch it. Adds eval case code-reviewer-duplicated-code-severity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ts quality-bar line

- code-reviewer reads the code-design "Bundled criteria" section and no
  longer restates its Markdown, prototype and Shotgun Surgery ratings.
- Self mode's worker template and code-reviewer's exact-output rule allow
  the required `Quality bar:` line.
- Fanout's parse contract notes the Duplicated Code confidence exception.
- The duplicated-constant-critical grader no longer passes a summary
  count line; two count-line fail samples and a pass sample added.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 19, 2026 05:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-10-19T05:13:22.417684Z 9d8d09f Draft marked ready
ℹ️ 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.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 9d8d09f3b0c15e902ab5ed22788c53c27b7462d0: 0 finding(s), 0 as inline comments.

Review of #8395 (code-reviewer Duplicated Code severity)

No findings.

I read all 14 changed files and the closing issue #8330, and checked the new code-reviewer.md paragraph against plugins/review/skills/quality-gate/context/code-design.md. I did not run the eval or the graders; the paid-eval and check-affected.sh results in the PR body are author-claimed and unverified by me.

Closing issue #8330

  • The code-reviewer smell-severity rule and confidence rule are edited, and other smells stay SUGGESTION. The edit is at plugins/review/agents/code-reviewer.md lines 97 and 105.
  • The cited sections "Bundled criteria", "The cascade rule" and "Exempt from CRITICAL" exist in code-design.md (lines 32, 43 and 58).
  • The Quality bar: production (assumed: none given) fallback matches code-design.md line 30.
  • The eval case code-reviewer-duplicated-code-severity covers an unsynced copy rated CRITICAL and a Shotgun Surgery-only diff kept below IMPORTANT.
  • A changelog fragment is present.

Minor note (not raised as a finding)

  • context/severity.md line 12 still lists "code duplication" as an IMPORTANT example. code-design.md says the cascade rule overrides that example only "in a code-design review". The new code-reviewer paragraph does not repeat that override. It tells the agent to rate "as that table and the cascade rule do", and the table gives CRITICAL or SUGGESTION, so the intent reads clearly.
  • An agent could still read the severity example as IMPORTANT for a Duplicated Code finding that fails the cascade rule. The eval would not catch that case, because it only covers the CRITICAL and Shotgun Surgery paths.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 9d8d09f3b0c15e902ab5ed22788c53c27b7462d0: 0 finding(s), 0 as inline comments.

Security review: no findings

I reviewed all 14 files in PR #8395 at head 9d8d09f3. I found no security issues.

  • Instruction-surface lens: plugins/review/agents/code-reviewer.md, plugins/review/skills/quality-gate/context/self.md and plugins/review/skills/fanout/context/findings-normalization.md are standing instructions. The diff removes and narrows no rule. It adds a rule that rates introduced, unsynced Duplicated Code CRITICAL, and it lets a Quality bar: line survive a caller's exact-output shape. That makes review stricter, so no guardrail is lost. I did not consult the protected-class register because nothing was removed from the instructions.
  • Eval scaffold: scaffold.sh is static. It runs git init and writes fixed files in the eval's working directory. It takes no external input, runs no eval or network calls, and handles no secrets or tokens.
  • Eval graders and samples: These are regex and JSON fixtures only. I saw no ReDoS-style input path in an attacker-reachable surface.
  • Remaining files: The changelog fragment and the brief-reviewer description change are prose only.

No Actions workflow or permission changes are in the diff.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit 934923a Oct 19, 2026
57 checks passed
@kyle-sexton
kyle-sexton deleted the fix/8330-code-reviewer-duplicated-code-severity branch October 19, 2026 05:21
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.

fix(review): align code-reviewer Duplicated Code severity with the code-design mode

1 participant