Skip to content

fix(source-control): count a no-patch text file the review lanes read from the git diff as reviewed - #18174

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-18166-45040512192-1
Nov 22, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-18166-45040512192-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #18166

Summary

Opened by the work-resolve-issue lane. The run's own summary:

The merge gate now reads the same git diff the review lanes read for a file the files API sends no patch for. Before, it held every such non-media file for a person as unreviewed-patch:<path>. Now, when a local full-history clone holding both commits counts the file's changed lines as text in git diff <base>...<head>, _changed_files sets the new ChangedFile.diff_read field and _size_reasons scores the file as the mergeable no-patch:<path> MED. A file git calls binary, one with no changed line, or one whose diff no clone can read keeps the HIGH hold. A path listed twice holds if either entry is unread, and media files keep today's path.

No review-lane change was needed: the issue's premise that the lanes read the files API does not hold. The regular lanes (the org's pr-review-cli reusable) build their review diff with build-review-diff/diff.sh, which is git diff --no-ext-diff --no-textconv --text --find-renames from the merge base with no size or line-length cap. Only declared generated-data files and media sections are cut down. The main-run lane builds its diff with .github/scripts/pr-review-main/write-diff.py, also git diff --text. Neither is under this repository's control, and neither needed editing.

Design choices: the git read uses --numstat with attributes taken from the empty tree (--attr-source) and core.attributesFile=/dev/null, so a checked-out .gitattributes cannot make a binary file count as text. The SHAs are checked against SHA_RE first, and media paths skip the read. Following docs/review/comments.md, I added no code comments. The stale comment above MEDIA_SUFFIXES, which said an over-size patch is read by no review, was deleted rather than rewritten. Its reason now lives in the babysit_risk.py module docstring and the pr-pipeline README's "Risk score" bullet.

Not verified

  • The Python test suites (test_babysit_risk.py, test_babysit_merge_policy.py and the rest of the babysit-prs tests) were not run here: this lane's Bash runs only the named wrappers. They are left to the PR's CI.
  • Tidy was skipped: the change spans 3 areas (plugins/source-control, docs/conventions, .changes/pr-pipeline), over the 1-area tidy cutoff.
  • The lane review was not in the CI venue: review-venue.txt was absent, so a local fresh-context subagent reviewed the diff instead.
  • check-affected could not run three legs here: typos (not installed), comment-hygiene (its network fetch was denied) and size-check (audit-size.sh is missing in the lane's check copy). CI runs them.
  • The git docs pages I read do not say which git version added --attr-source. On a git without it, the read fails closed: diff_read stays False, the hold is kept as before, and the new merge-policy test's True case would fail on CI.
  • The hosted review lane counts declared generated-data files (scripts/review-generated-data.txt) as read without showing them to the model. A no-patch generated-data file whose git diff is text now also passes the gate, which matches that lane's policy, but no model read it.
  • The issue's first done-when item (review findings over a no-patch file's change) needed no build: both lanes already read the whole git diff --text. I did not observe it on a live PR here.

Fix

  • plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py: new ChangedFile.diff_read: bool = False. _size_reasons treats a no-patch file whose diff_read is True as no-patch:<path> MED, not unreviewed-patch:<path> HIGH; any other value keeps the hold. Added a…
  • plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py: new _diff_read(base_sha, head, path), which runs `git --attr-source=<empty tree> -c core.attributesFile=/dev/null diff --numstat --no-renames --no-ext-diff --no-textconv <base>...<head> --…
  • plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_risk.py: new tests for the read-from-git-diff case (no hold, no-patch: MED), the no-read case (hold kept for False, None, "true" and 1), and a path listed twice (holds unless both entries were read).
  • plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_merge_policy.py: new LocalEnabledSince test against a real temp clone. An over-size-style text change gives diff_read True, a NUL-byte file False, a file with a patch False, and a base missing from the clone False. The…
  • docs/conventions/pr-pipeline/README.md: the merge gate's "Risk score" bullet now says a text file whose change the review lanes read from the git diff scores no-patch:, and what still holds as unreviewed-patch:.
  • .changes/source-control/work-resolve-issue-issue-18166-45040512192-1-58810a18.md: patch fragment (Fixed).
  • .changes/pr-pipeline/work-resolve-issue-issue-18166-45040512192-1-e6898359.md: patch fragment (Fixed).

Verification

The runner ran each check from the base copy against 59b3f14:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 2 fragments valid (run again after the review fixes).
  • check-changed-skills: babysit-prs PASS, 0 errors. Its 4 warnings are about SKILL.md size and description and were there before; this change does not touch SKILL.md.
  • check-affected: 17 passed, 8 skipped over 7 changed files (run again after the review fixes). The skips are typos (not installed), comment-hygiene (network fetch denied), size-check (script missing in the lane copy), changed-skills and three validate-plugins legs (run checked-tree code), and…
  • Fresh-context review subagent over the whole diff: no correctness bugs. It confirmed the new tests should pass and no existing test breaks, and that the only added # is a # fmt: skip directive. It raised four points. Three are fixed: the attribute source is neutralized, media paths skip the git…
  • read https: //raw.githubusercontent.com/melodic-software/ci-workflows/main/.github/workflows/pr-review-cli.yml: the review diff is written by the build-review-diff action from the merge base, not the files API or gh pr diff ("the API returns only part of a large one").
  • read https: //raw.githubusercontent.com/melodic-software/ci-workflows/main/.github/actions/build-review-diff/action.yml: diff.sh writes the full diff; the outputs count left-out generated-data files and binary files; media files show headers only.
  • read https: //raw.githubusercontent.com/melodic-software/ci-workflows/main/.github/actions/build-review-diff/diff.sh: the full diff is git diff --no-color --no-ext-diff --no-textconv --text --find-renames, with no cap on its size and no per-line length limit. Only declared generated-data files…
  • read https: //git-scm.com/docs/git: --attr-source=&lt;tree-ish&gt; reads gitattributes from <tree-ish> instead of the worktree.
  • read https: //git-scm.com/docs/gitattributes: with diff unspecified, git inspects the content and treats the file as text if it looks like text and is under core.bigFileThreshold; core.attributesFile is the per-user attributes file; a set diff attribute makes even NUL-byte content text.
  • read https: //git-scm.com/docs/git-diff: --numstat prints two - for a binary file instead of 0 0; without -z, unusual pathnames are quoted.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/45040512192

Left out: the items under Not verified.

Related

#18166

Follow-ups

  • Pre-existing (advisory): **Advisory: the attribute-neutralizing guard has no test that could fail.** (thread)
  • Pre-existing (advisory): **Advisory: one clone discovery and one 'git diff' per no-patch file, including files that need neither.** (thread)

Lane-Activity: work-resolve-issue/resolve-issue
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 59b3f14c55296be1c1f2cdaeb5586a66e4a4313b. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 2 inline finding(s) on 59b3f14c55296be1c1f2cdaeb5586a66e4a4313b; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 59b3f14c55296be1c1f2cdaeb5586a66e4a4313b: read 7 of 7 changed file(s); 2 finding(s), 2 as inline comments.

Code review: PR #18174 (head 59b3f14)

The change adds ChangedFile.diff_read. _changed_files sets it when a local full-history clone counts a no-patch file's changed lines as text in git diff --numstat <base>...<head>, and _size_reasons then scores the file as the mergeable no-patch:<path> MED instead of the HIGH unreviewed-patch:<path>. It fails closed in each case I traced:

  • SHAs that don't match SHA_RE
  • no clone that holds the head, or a base missing from the clone (_git returns None)
  • - counts (binary) and 0 0 rows
  • a path listed twice with only one entry read

The pr-merge gate job checks out with fetch-depth: 0 (pr-merge.yml#L1115-L1121), so same-repo PR heads are in the clone. The long-line guard for the main-run lane is measured from that lane's own git diff (babysit_review_evidence.py#L720-L725), not from the API patch, so passing a no-patch file does not bypass it. I found no correctness bug. There are two advisory findings, posted inline:

  1. The guard that stops a checked-out .gitattributes from making a binary file count as text (--attr-source=<empty tree>, core.attributesFile=/dev/null) has no test that would fail if it were removed.
  2. _diff_read runs for every no-patch non-media file, including the pure renames and empty files that _unread_content already clears. Each call also repeats the clone discovery in _clones_holding, so a large directory move costs thousands of git subprocesses.

Closing issue #18166

  • "A test in test_babysit_risk.py covers both the read-from-git-diff case (no hold) and the no-read case (hold kept)": met (test_a_no_patch_text_file_the_git_diff_showed_does_not_hold, test_a_no_patch_text_file_no_review_read_still_holds).
  • "pr-merge does not hold it as unreviewed-patch": met for a same-repo PR whose head is in the gate's clone, covered by the new LocalEnabledSince test and the risk tests.
  • "gets review findings over that file's change": the PR says the review lanes already read git diff --text and need no change. That is author-claimed and I did not verify it. This lane did read its diff from a git-diff file.
  • "PR docs(upstream): re-audit addyosmani agent-skills at 8c99fa3 #18159's class no longer needs an owner label removal": follows from the two items above; not observed on a live PR.

Loosened checks. The unreviewed-patch hold is a person-approval hold, a friction hold under the criterion, so it makes no finding. The closing issue also names this exact change and says why. The prompt had no loosened_check_verdict: or loosened_check_patterns: line, so I used fail with no consumer entries. It had no loosened_check_decision_record: line, so the citation requirement was not checked. Loosened checks would be marked: fail (lane default; no verdict line in prompt); patterns: 0

Other notes

  • Paved paths: no paved-path row found under docs/standards, so nothing to report.
  • No settled threads. No prior findings, and this is not a blocking-only review.
  • No plugin manifest changed. Both changelog fragments use bump: patch, which fits a fix.
  • I ran no tests. The PR's "Not verified" section says the Python suites were left to CI.

Verifier dropped 0 of 2 candidates. No verifier subagent ran; I checked both candidates inline against the head source.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 59b3f14c55296be1c1f2cdaeb5586a66e4a4313b: read 7 of 7 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

This PR narrows the merge gate's unreviewed-patch:<path> hold. Before, any non-media file the files API sent no patch for was held for a person. Now, if a local full-history clone shows the file's change as text in git diff --numstat <base>...<head>, it scores the mergeable no-patch:<path> MED instead. Both changed files are trusted paths and the change narrows a merge hold, so I read the whole change and what it gates.

What I checked

  • Not one of the owner's named friction holds. unreviewed-patch is not a path, trust-path, person-approval, bot-author or pin hold, so I judged it as an ordinary merge hold.
  • Parts 1–2 of the severity bar (who reaches it, what it gets). The hold only matters if a model review can read the no-patch file. The review lanes build their diff from git at the merge base, not from the files API. The narrowed condition (text in git diff base...head) matches what those lanes show the model, so the change does not let unread content through.
  • Generated-data and media lists. Two lists could hide a file's content from the model. scripts/review-generated-data.txt and scripts/review-media-paths.txt are both read at the merge base (pr-review-hosted.yml#L300-L305), so a PR cannot add its own file to either list. The media list also needs magic bytes that match the extension, so a text file can't use it to skip review.
  • Part 3 (what still stops it). Gates outside this diff still apply: review-evidence binding, and the main-run verdict's LONG_LINE_BYTES cap (babysit_review_evidence.py#L722-L726).
  • _diff_read input handling (babysit_merge_policy.py#L6888-L6926):
    • Both SHAs are checked with SHA_RE.fullmatch before git runs.
    • git runs through run_command with an argv list and allowed_executables=("git",), so there is no shell.
    • The path is passed after -- as a :(literal) pathspec, so it can't be read as an option or a glob.
    • Attributes come from the empty tree and the user attributes file is /dev/null, so the PR's own .gitattributes can't make a binary file count as text.
    • Every failure returns False and keeps the hold: git missing --attr-source, an unreadable clone, - binary counts, or no changed lines.
  • Scoring (babysit_risk.py _size_reasons): only diff_read is True counts, and a path listed twice still holds if either entry is unread.

No tokens, secrets, trusted actors, workflow permissions or billable resources are touched. The .changes/ fragments, the README and the test files have no security surface.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback

Run 45043144650, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45043144650

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 59b3f14.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback

Run 45043144650, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 45043144650

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head 59b3f14c55296be1c1f2cdaeb5586a66e4a4313b, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=HIGH demote=true head=59b3f14c55296be1c1f2cdaeb5586a66e4a4313b rubric=10.7.0 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 048348e Nov 22, 2026
97 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-18166-45040512192-1 branch November 22, 2026 16:34
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 048348e42e85976ea1d0b82a9146a34e9a7f057f; later checks count it verified from this comment.

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.

source-control: review lanes and pr-merge read a no-patch text file from the git diff instead of holding it for a person

0 participants