Repository navigation
claude-review: R0-only diffs get the Sonnet reviewer in Opus repositories (row 1.252) #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3209222
1824e0d
d26fd83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -250,21 +250,100 @@ jobs: | |
| # One place for the model. The small sites get Sonnet; 4thcltr.com, heuristics, papers, | ||
| # gorfed.net, bindercurve.com, assess and ops keep Opus under "auto". Matching is by | ||
| # repository name, case-insensitive (ACID2REAPER's remote is spelled in capitals). | ||
| # A diff whose every changed path is R0 (shipping.md ladder: docs, lockfiles, generated | ||
| # files, a patch bump in package.json) gets Sonnet in an Opus repository too. Fails closed: | ||
| # a missing or empty file list, a rename, a quoted path or any path outside the R0 classes | ||
| # keeps Opus. Rule files (REVIEW.md, CLAUDE.md, the files REVIEW.md lists under "Where the rules live", templates, .claude/, control/) never count as docs. | ||
| - name: Pick the model | ||
| if: steps.dup.outputs.skip != 'true' | ||
| id: model | ||
| env: | ||
| REPO: ${{ github.repository }} | ||
| REQUESTED: ${{ inputs.model }} | ||
| REVIEW_INPUT: review-input | ||
| BASE: ${{ steps.pr.outputs.base }} | ||
| HEAD: ${{ steps.pr.outputs.head }} | ||
| run: | | ||
| set -euo pipefail | ||
| # 0 only when every changed path is R0. Matching is on the lowercased path, as ship-bot's | ||
| # touchesControlPlane does (a case-insensitive disk lands Docs/x on docs/x). | ||
| r0_only() { | ||
| local list="${REVIEW_INPUT:-review-input}/files.txt" added deleted path lower found=0 | ||
| [[ -s "$list" ]] || return 1 | ||
| while IFS=$'\t' read -r added deleted path; do | ||
| [[ -n "$path" ]] || return 1 | ||
| found=1 | ||
| lower="$(printf '%s' "$path" | tr '[:upper:]' '[:lower:]')" | ||
| case "$lower" in | ||
| *'=>'*|\"*) return 1 ;; | ||
| # 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 ;; | ||
| skills/*|*/skills/*|agents/*|*/agents/*|rules/*|*/rules/*) return 1 ;; | ||
| # What REVIEW.md lists under "Where the rules live", and the rule text beside it. | ||
| readme.md|docs/verification-rules.md|docs/retired-checks.md|docs/content-guidelines.md|docs/programme-template.md|docs/backlog.json) return 1 ;; | ||
| *.md|docs/*.txt|docs/*/*.txt) ;; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Low: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| package-lock.json|*/package-lock.json|pnpm-lock.yaml|*/pnpm-lock.yaml|yarn.lock|*/yarn.lock|bun.lock|*/bun.lock|bun.lockb|*/bun.lockb|cargo.lock|*/cargo.lock|poetry.lock|*/poetry.lock|gemfile.lock|*/gemfile.lock) ;; | ||
| *.generated.*|*/generated/*) ;; | ||
| package.json|*/package.json) patch_bump_only "$path" || return 1 ;; | ||
| *) return 1 ;; | ||
| esac | ||
| done < "$list" | ||
| [[ "$found" == 1 ]] | ||
| } | ||
| # 0 only when this package.json changed nothing but dependency versions that stay within | ||
| # the same range prefix, major and minor, inside the same section (dependencies, | ||
| # devDependencies, peerDependencies, optionalDependencies, overrides, resolutions). Read | ||
| # from git, so a line's section is known. Fails closed on any error. | ||
| patch_bump_only() { | ||
| [[ -n "${BASE:-}" && -n "${HEAD:-}" ]] || return 1 | ||
| local mb | ||
| mb="$(git merge-base "$BASE" "$HEAD")" || return 1 | ||
| node - "$mb" "$HEAD" "$1" <<'JS' || return 1 | ||
| import { execFileSync } from 'node:child_process' | ||
| import { isDeepStrictEqual } from 'node:util' | ||
| const [, , base, head, path] = process.argv | ||
| const read = (rev) => JSON.parse(execFileSync('git', ['show', `${rev}:${path}`], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 })) | ||
| const before = read(base) | ||
| const after = read(head) | ||
| const SECTIONS = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies', 'overrides', 'resolutions'] | ||
| const VERSION = /^([\^~]?)(\d+)\.(\d+)\.\d+$/ | ||
| const sameBump = (x, y) => { | ||
| if (x === y) return true | ||
| if (typeof x !== 'string' || typeof y !== 'string') return false | ||
| const a = VERSION.exec(x) | ||
| const b = VERSION.exec(y) | ||
| return Boolean(a && b && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]) | ||
| } | ||
| const ok = (() => { | ||
| const keys = new Set([...Object.keys(before), ...Object.keys(after)]) | ||
| for (const key of keys) { | ||
| if (!SECTIONS.includes(key)) { | ||
| if (!isDeepStrictEqual(before[key], after[key])) return false | ||
| continue | ||
| } | ||
| const x = before[key] ?? {} | ||
| const y = after[key] ?? {} | ||
| if (!isDeepStrictEqual(Object.keys(x).sort(), Object.keys(y).sort())) return false | ||
| for (const name of Object.keys(x)) if (!sameBump(x[name], y[name])) return false | ||
| } | ||
| return true | ||
| })() | ||
| process.exit(ok ? 0 : 1) | ||
| JS | ||
| } | ||
| model="${REQUESTED:-auto}" | ||
| if [[ "$model" == auto ]]; then | ||
| model=claude-opus-5-5 | ||
| repo="$(printf '%s' "${REPO#*/}" | tr '[:upper:]' '[:lower:]')" | ||
| case "$repo" in | ||
| promptboi.com|denseware.com|ssatcy.com|gorfmusic.com|subrythm.com|blackpixelrecords.com|anal0g.org|rowanmcarthur.com|acid2reaper) model=claude-sonnet-5-5 ;; | ||
| esac | ||
| if [[ "$model" == claude-opus-5-5 ]] && r0_only; then | ||
| model=claude-sonnet-5-5 | ||
| echo "every changed path is R0: Sonnet reads it" | ||
| fi | ||
| fi | ||
| echo "model=${model}" >> "$GITHUB_OUTPUT" | ||
| echo "reviewing ${REPO} with ${model}" | ||
|
|
||
There was a problem hiding this comment.
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
touchesControlPlanetreats as control plane never counts as docs, but this list leaves out the per-repo prefixes inship-bot/lib/drafts.mjsREPO_EXTRA. For gorfednet/ops those arehosts/,infra/andinventory-patches/(control/is already covered).REPO_EXTRAsays 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 changeshosts/<host>/README.md,infra/x.mdorinventory-patches/notes.mdmatches*.mdand drops to Sonnet. These are the root-run files whose review this PR says it keeps on Opus. To see it, runpick(['hosts/nas/README.md'])in the new test: it returns Sonnet. Fix: addhosts/*|infra/*|inventory-patches/*here (scope by$REPOif you want the.githubrepo'sinfra/nginx/README.mdto stay R0), and add those paths to the "keeps Opus for rule, review and control files" test.