Skip to content

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

Closed

Description

@kyle-sexton

Problem

When GitHub's pull request files API returns no patch for a text file (an over-size diff, or very long lines), the merge gate holds the PR for a person:
plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py:2294-2307 books any non-media file with has_patch is False and unread content as unreviewed-patch:<path> at Risk.HIGH, and the comment at :2438-2441 says "no review read, so a person does". Both review lanes read the same files API, so neither reads the change either.

This recurs on every PR that touches a large docs/upstream/* file:

The hold is not a security boundary and not an intent change, so under the stop list it is a workflow defect (hub lessons ledger L632).

Fix

When the files API omits a text file's patch, the review lanes and pr-merge's risk gate read that file's change from the git diff of the PR's base and head (git diff <base>...<head> -- <path>) instead:

  1. The review lanes feed the git-diff hunk to the reviewer, so a review reads the file.
  2. babysit_risk.py treats a file whose change a review read from the git diff as reviewed, and keeps unreviewed-patch only when no review read it (for example, the git diff also fails).
  3. Media files keep today's no-patch: MED path.

Done when

  • A PR touching a text file the files API returns without a patch gets review findings over that file's change, and pr-merge does not hold it as unreviewed-patch.
  • A test in plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_risk.py covers both the read-from-git-diff case (no hold) and the no-read case (hold kept).
  • PR docs(upstream): re-audit addyosmani agent-skills at 8c99fa3 #18159's class no longer needs an owner label removal.

Notes

  • If the review-lane change lands under .github/workflows/, lane tokens cannot push it (no workflows permission, hub Q1); a session builds that part.
  • docs/upstream/* is text from outside repositories, which is why a reader is wanted; the fix keeps a reader, it only changes where the reader gets the hunk.

Refs: #18159, #15850, #16403

Activity

  1. added
    needs-triage
    on Nov 22, 2026
  2. github-actions commented on Nov 22, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Known
    Flags: none
    Blocked by: none
    Blast radius: the review lanes' diff input and babysit_risk.py's unreviewed-patch hold in the source-control plugin, plus its tests, docs and changelog; read by the pr-merge gate and anyone who owns the PR pipeline.
    Reversible: yes; revert the change and the hold returns.
    Open questions: none
    Understood: when the files API omits a text file's patch, the review lanes should read that change from git diff base...head -- path. pr-merge should then stop holding the file as unreviewed-patch once a review has read it. It should keep the hold when no review read it, and media files keep the no-patch MED path. The issue states the fix and its done-when exactly, so I found no open design question. No duplicate open issue and no merged PR that already fixes this turned up. Any part of the change under .github/workflows/ will need a session, as the issue notes.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triage
    on Nov 22, 2026
  4. melodic-automation-lanes commented on Nov 22, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

  5. melodic-automation-lanes commented on Nov 22, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: When the files API omits a text file's patch, the review lanes read that file's change from git diff base...head, and babysit_risk.py scores the file as reviewed (no unreviewed-patch hold) when a review read it, keeping the hold only when no review did; media files keep the no-patch MED path.

    Acceptance criteria

    • For a non-media file with has_patch False, the review lanes' diff input is built from git diff <base>...<head> -- <path>, and a review reads that hunk
    • babysit_risk.py gives the risk gate a field saying a review read the file's change from the git diff, set per path
    • When that field marks a path read, _size_reasons at babysit_risk.py:2294-2308 emits no unreviewed-patch:<path> reason for it
    • When no review read the path (for example the git diff also fails), unreviewed-patch:<path> at Risk.HIGH is still emitted
    • A media file (MEDIA_SUFFIXES) with no patch still scores the no-patch:<path> MED reason, unchanged
    • A path listed twice still holds when either entry is unread
    • test_babysit_risk.py has a test for the read-from-git-diff case that asserts no unreviewed-patch hold
    • test_babysit_risk.py has a test for the no-read case that asserts the unreviewed-patch hold is kept
    • Existing tests at test_babysit_risk.py:1636-1751 and test_babysit_merge_policy.py still pass
    • The comment at babysit_risk.py:2438-2441 and docs/conventions/pr-pipeline/README.md:1313 describe the git-diff read
    • An entry is added to plugins/source-control/CHANGELOG.md for the change

    External state: none

    Dependencies

    • If the review-lane change lands under .github/workflows/, lane tokens cannot push it (no workflows permission), so a session must build that part

    Related work

    Sources read

    • plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py:2294-2308: a non-media file with has_patch False and unread content becomes unreviewed-patch:<path> at Risk.HIGH, otherwise no-patch:<path> MED
    • plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py:2438-2446: comment says a non-media no-patch file is read by no review, so a person does; defines MEDIA_SUFFIXES and UNREVIEWED_PATCH_PREFIX
    • plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py:170: ChangedFile has_patch is False for binary, submodule, or over-size files
    • plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py:6871: has_patch is derived from whether the files API entry has a patch key
    • plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_risk.py:1636-1751: existing tests for unreviewed-patch holds that must keep passing
    • docs/conventions/pr-pipeline/CHANGELOG.md:3383: earlier entry says the main-run review diffs with --text and writes no verdict for a binary or over-size patch
    • docs/conventions/pr-pipeline/README.md:1313: documents the unreviewed-patch hold

    Automated refinement by the lanes App. Intake triages the issue again with it.

  6. melodic-automation-lanes commented on Nov 22, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"1a4e55a69210333b68a41ae495878a341520ddc1b3124978380ef92124399874","body_sha256":"2380b7623f6e936d3e90521f6d640743d2de1616cf5e06e6d68c6f808d6e0151"}

  7. github-actions commented on Nov 22, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    needs-triage

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions