Repository navigation
Closed
Description
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_targetruns the workflow file frommain, never the PR's copy, so the code that holds the token is merged code. That is the same trust as a push tomain.- Exact claims in pattern mode:
.githubrepository ID,job_workflow_refofclaude-review.yml@refs/heads/main,event_namepull_request_target. Aworkflow_dispatchof 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
.githuband the event ispull_request_target. Everything else keeps R1. - The
.githubresult 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
mainHEAD, which can be ahead of the released SHA (merged but unreleased code). That is acceptable: only maintainers can push tomain. - A change to the reviewer itself is reviewed by the code it replaces. A second human review on
.githubstill matters.
Owner steps (Console, web UI)
- Create the self-review workspace and set its spend limit.
- Create rule R-self with the claims above, bound to that workspace and the service account.
- 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
Metadata
Metadata
Assignees
Labels
No labels
Activity
Model review for PRs to .github: self-review rule R-self and scripted…
Set the self-review federation rule ID (R-self, #36) (#38)