Skip to content

Model review for PRs to .github itself (second federation rule) #36

Closed

Description

@irvingpop

Summary

PRs to .github itself get no model review. The review file runs there as a normal pull_request_target workflow from main, so its OIDC job_workflow_ref ends in @refs/heads/main. Production rule R1 binds @<release SHA>, so every pass fails auth and the gate fails with pass-records. This has been true for every .github PR since 2026-10-31 (see #33).

Proposal

Add a second federation rule, R-self, used only for .github PRs:

.github PR --pull_request_target--> claude-review.yml @ main (merged code only)
     |                                   |
     |                  OIDC: repo=.github, job_workflow_ref=@refs/heads/main,
     |                        event_name=pull_request_target
     v                                   v
  PR content read via REST only     R-self --> self-review workspace (own low spend limit)
  • pull_request_target runs the workflow file from main, never the PR's copy, so the code that holds the token is merged code. That is the same trust as a push to main.
  • Exact claims in pattern mode: .github repository ID, job_workflow_ref of claude-review.yml@refs/heads/main, event_name pull_request_target. A workflow_dispatch of the same file does not match.
  • Own workspace with a low spend limit, so it cannot drain the production budget.
  • analyze picks R-self only when the run's repository is .github and the event is pull_request_target. Everything else keeps R1.
  • The .github result still does not gate merges through the ruleset (no ruleset targets .github), but it gives a real model review and a real summary comment.

Residual

  • The run uses main HEAD, which can be ahead of the released SHA (merged but unreleased code). That is acceptable: only maintainers can push to main.
  • A change to the reviewer itself is reviewed by the code it replaces. A second human review on .github still matters.

Owner steps (Console, web UI)

  1. Create the self-review workspace and set its spend limit.
  2. Create rule R-self with the claims above, bound to that workspace and the service account.
  3. Put its rule ID into the code (same pattern as the eval-test rule in Set the eval-test federation rule id #30).

🤖 Generated with Claude Code

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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions