Skip to content

claude-review: R0-only diffs get the Sonnet reviewer in Opus repositories (row 1.252) - #376

Closed
gorfednet wants to merge 3 commits into
mainfrom
github-1-252
Closed

gorfednet wants to merge 3 commits into
mainfrom
github-1-252

Conversation

@gorfednet

@gorfednet gorfednet commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Row 1.252. `Pick the model` reads `review-input/files.txt` (already built before it). Under `auto`, in an Opus repository, Sonnet is picked when every changed path is R0: markdown outside REVIEW.md, CLAUDE.md, AGENTS.md, `.claude/`, `control/` and `.github/`; lockfiles; `.generated.` and `generated/`; a `package.json` whose only changes are dependency versions inside the same major.minor. Otherwise Opus. Fails closed: missing or empty list, rename, quoted path, unknown path. An explicit `model` input is untouched.

Tests (`test/claudeReview.test.mjs`, 90 pass): R0-only, patch bump, minor and major bump, non-version package.json edit, mixed, rule files, empty/missing/unreadable lists, explicit model. Mixed case watched failing once by turning the final `) return 1` into `) ;;`: red, restored, green.

One run of each model (the step's script run locally, repository `gorfednet/ops`): `docs/a.md` only gives `claude-sonnet-5-5`; `docs/a.md` plus `src/x.ts` gives `claude-opus-5-5`. This PR's own review runs the shared workflow from `main`, so a live Actions run of each is not shown here; the first R0 PR after merge will show it in its job log ("every changed path is R0: Sonnet reads it").

Untouched: `templates/claude-review.yml`, `test/claudeReview.test.mjs:432` (row 1.276m). R2 (shared workflow): Fable whole-diff read per the pace gate.

Next

  • Desk: the Sonnet fact sheet, then the scoped Fable read, once claude review is clean on d26fd83 (round 3, the last).
  • Desk: merge when clean and CI is green.

🤖 Generated with Claude Code

…itories (row 1.252)

"Pick the model" now reads review-input/files.txt: when every changed path is docs,
a lockfile, a generated file or a package.json patch bump, auto picks Sonnet. An
empty or unreadable list, a rename, or any other path keeps Opus.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AI-Use: L3 made undo unread (Claude Sonnet 5.5)
AI-Use-Standing: https://github.com/gorfednet/ai-use-levels/blob/main/docs/delegation.md 2026-11-18
@gorfednet

Copy link
Copy Markdown
Owner Author

claude review

Comment thread .github/workflows/claude-review.yml Outdated
if (!match($0, /^[-+] *"[^"]+": *"[\^~]?[0-9]+\.[0-9]+\.[0-9]+",?$/)) { bad = 1; next }
sign = substr($0, 1, 1)
name = $0; sub(/^[-+] *"/, "", name); sub(/".*$/, "", name)
ver = $0; sub(/^[-+] *"[^"]+": *"[\^~]?/, "", ver); sub(/\.[0-9]+",?$/, "", ver)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: the range prefix is stripped before the major.minor comparison, so a change to the prefix alone counts as a "patch bump". -"x": "~1.2.3" → +"x": "^1.2.3" widens the accepted range from patches to every 1.x minor release, but both sides reduce to 1.2, so patch_bump_only returns 0 and an Opus repository gets Sonnet for a range change the comment says keeps Opus. You can see it by adding that pair to the bump helper in the test: pick(['package.json'], …) returns Sonnet. Fix: keep the prefix in ver (strip only the last .N), so a different prefix no longer pairs up.

case "$path" in
*'=>'*|\"*) return 1 ;;
REVIEW.md|*/REVIEW.md|CLAUDE.md|*/CLAUDE.md|AGENTS.md|*/AGENTS.md|.claude/*|control/*|.github/*) return 1 ;;
*.md|docs/*.txt|docs/*/*.txt) ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: *.md counts every markdown file outside the short deny-list as docs, including files that are rules. In this repository, docs/verification-rules.md is listed in REVIEW.md under "Where the rules live", and templates/REVIEW.site-footer.md is the text every site repository copies into its REVIEW.md. A PR that changes only those files gets Sonnet, although the step comment says rule files never count as docs. To reproduce: pick(['docs/verification-rules.md']) returns claude-sonnet-5-5. Either deny those paths, or narrow the comment so it no longer promises more than the case statement does.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Reviewed full.diff (the R0-only Sonnet downgrade in the model-picking step and its tests). It fails closed on missing input, renames, quoted paths and mixed lists. Two Low gaps: a change to the range prefix alone (~ to ^) passes as a patch bump, and markdown rule files outside the deny-list (e.g. docs/verification-rules.md) count as docs.

…cs (row 1.252)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AI-Use: L3 made undo unread (Claude Sonnet 5.5)
AI-Use-Standing: https://github.com/gorfednet/ai-use-levels/blob/main/docs/delegation.md 2026-11-18
@gorfednet

Copy link
Copy Markdown
Owner Author

Round 2 fixes: the range prefix is now compared (a prefix change is not a patch bump; watched failing first), and the files REVIEW.md lists under Where the rules live, plus templates and the verification kit, are denied as docs, one test per file.

claude review

REVIEW.md|*/REVIEW.md|CLAUDE.md|*/CLAUDE.md|AGENTS.md|*/AGENTS.md|.claude/*|control/*|.github/*) return 1 ;;
# What REVIEW.md lists under "Where the rules live", and the rule text behind it.
README.md|ship-bot/README.md|docs/verification-rules.md|docs/retired-checks.md|docs/content-guidelines.md|templates/*|verification-kit/*|*/verification-kit/*|scripts/local-llm/*) return 1 ;;
*.md|docs/*.txt|docs/*/*.txt) ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: agent prompts and skills count as docs here, so a change to them gets Sonnet in an Opus repository. That breaks the step's own promise that rule files never count as docs. The exclusions above this line leave out SKILL.md (and skills/**/*.md) and janitor/PROMPT.md, so both fall through to *.md. ship-bot/lib/drafts.mjs:79 already treats SKILL.md as control plane, next to REVIEW.md, CLAUDE.md and AGENTS.md, and scripts/check-rules-drift.mjs:65 treats **/SKILL.md and **/skills/**/*.md as rule files. janitor/PROMPT.md is the prompt the daily janitor reads from origin/main at run time, and that janitor deletes branches and archives sessions. To see it, give the step a files.txt of 1 0 janitor/PROMPT.md (or janitor/SKILL.md) in gorfednet/ops: it picks claude-sonnet-5-5. Fix: add SKILL.md|*/SKILL.md|*/skills/*|janitor/PROMPT.md (or a general *PROMPT.md) to the return 1 arm, and add those paths to the 'keeps Opus for rule, review and control files' test.

Comment thread .github/workflows/claude-review.yml Outdated
!infile || /^(---|\+\+\+) / || !/^[-+]/ { next }
{
if (!match($0, /^[-+] *"[^"]+": *"[\^~]?[0-9]+\.[0-9]+\.[0-9]+",?$/)) { bad = 1; next }
sign = substr($0, 1, 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: patch_bump_only accepts a dependency moved between sections of package.json as a patch bump. It pairs removed and added lines only by order, name and major.minor, and never checks which object each line sits in. So a hunk that removes "esbuild": "0.21.5", under dependencies and adds it under devDependencies passes, and so does a move into peerDependencies, optionalDependencies, overrides or resolutions. Such a move changes what installs in production, yet it is routed to Sonnet as R0. To see it: a full.diff whose only -/+ lines are the same "name": "x.y.z" in two different sections returns 0. Fix: also require that the full version differs on each pair (a pure move keeps it equal), or track the enclosing section from the hunk context.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Reviewed all of full.diff (the R0-only Sonnet routing in claude-review.yml and its tests). The R0 docs class lets agent prompts and skills (janitor/PROMPT.md, SKILL.md) through as docs, so they get Sonnet in an Opus repository (Medium). patch_bump_only also accepts a dependency moved between package.json sections as a patch bump (Low).

…ependency bump stays in its section (row 1.252)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AI-Use: L3 made undo unread (Claude Sonnet 5.5)
AI-Use-Standing: https://github.com/gorfednet/ai-use-levels/blob/main/docs/delegation.md 2026-11-18
@gorfednet

Copy link
Copy Markdown
Owner Author

Round 3 (d26fd83): SKILL.md, skills/, agents/, rules/, MEMORY.md, janitor/, scripts/, ship-bot/, templates/ and the files REVIEW.md lists are denied as docs, matched on the lowercased path like touchesControlPlane, one test per path (docs/verification-rules.md and templates/REVIEW.site-footer.md were already denied in 1824e0d). A package.json bump is now read from git (base and head): same section, same prefix, same major.minor, nothing else changed; the dependencies-to-devDependencies move was watched failing first.

claude review

# Rule, skill, agent and memory files, and everything ship-bot's touchesControlPlane
# and scripts/check-rules-drift.mjs treat as control plane or rules: never docs.
review.md|*/review.md|claude.md|*/claude.md|agents.md|*/agents.md|skill.md|*/skill.md|memory.md|*/memory.md) return 1 ;;
.claude/*|.github/*|control/*|scripts/*|ship-bot/*|janitor/*|capacity/*|verification-kit/*|*/verification-kit/*|templates/*|docs/claude-home/*) return 1 ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: the comment above says everything ship-bot's touchesControlPlane treats as control plane never counts as docs, but this list leaves out the per-repo prefixes in ship-bot/lib/drafts.mjs REPO_EXTRA. For gorfednet/ops those are hosts/, infra/ and inventory-patches/ (control/ is already covered). REPO_EXTRA says outright that "a host README under hosts/ counts too", because root installs it on the house hosts. So in ops, which is an Opus repository, a PR that only changes hosts/<host>/README.md, infra/x.md or inventory-patches/notes.md matches *.md and drops to Sonnet. These are the root-run files whose review this PR says it keeps on Opus. To see it, run pick(['hosts/nas/README.md']) in the new test: it returns Sonnet. Fix: add hosts/*|infra/*|inventory-patches/* here (scope by $REPO if you want the .github repo's infra/nginx/README.md to stay R0), and add those paths to the "keeps Opus for rule, review and control files" test.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Reviewed review-input/full.diff in full: the new R0-only Sonnet downgrade in claude-review.yml's model step and its tests. One Medium: the never-docs path list leaves out ops' control-plane prefixes (hosts/, infra/, inventory-patches/), so a markdown-only change there drops to Sonnet. The package.json patch-bump check fails closed as intended.

@gorfednet

Copy link
Copy Markdown
Owner Author

Replaced by #377, restarted from main. Docs routing is dropped: the markdown deny-list leaked rule files four times (SKILL.md, janitor/PROMPT.md, hosts and infra READMEs, verification-rules and the site footer). #377 keeps only lockfiles, generated files and patch bumps, with the prefix and same-section fixes. Follow-up only if an allow-list derived from touchesControlPlane is wanted.

@gorfednet gorfednet closed this Dec 5, 2026
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.

1 participant