Repository navigation
Read PR author association with the kernel-internal app token - #27
Merged
Merged
Conversation
sjmiller609
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#26 didn't fix the "author is not an org member" skips. On the first run after it merged, the
pull_requestevent payload also reportedCONTRIBUTORfor an org member, the same as the workflow token. Every Kernel member's membership is private, so every human PR is still skipped.This mints a read-only
kernel-internaltoken (contents: read,pull-requests: read, scoped to the current repo) before Gather, and uses it to read the PR, includingauthor_association. Breakglass already relies on this: it checks PR authors through the API with its org-installed app's token, and that check passed for a private member (kernel/kernel#4948). The script goes back to readingauthor_associationfrom the PR response, and the event-payload input from #26 is removed.The credential split for the model is unchanged. The model step still has no GitHub token and no tools, and the token that can comment is still minted only after the model finishes.
Testing
kernel-internaltoken seesMEMBERfor private members. The first PR from an org member after this merges will show it, either a risk comment or the same skip in the Gather log.Note
Medium Risk
Changes CI credential flow and org-member gating for auto-risk comments; misconfiguration could skip eligible PRs or widen token use during gather.
Overview
Fixes PR risk Gather so org-member eligibility works when membership is private. Workflow token and
pull_requestevent both expose those authors asCONTRIBUTOR, so every human PR was incorrectly skipped as “not an org member.”A new Generate read token step mints a read-only
kernel-internalapp token (contents/pull-requests: read) before Gather; Gather uses that token instead ofgithub.token.pr_risk.pydrops theAUTHOR_ASSOCIATIONenv/event input and again usesauthor_associationfrom the PR API (documented as valid only with the app token). The model step still has no GitHub token; the write token for comments is unchanged and still minted after classify.Tests assert read-token ordering/permissions in the workflow and drive membership checks via mocked PR
author_association.Reviewed by Cursor Bugbot for commit b21890b. Bugbot is set up for automated code reviews on this repo. Configure here.