Summary
#7472 gave the reviewer token tier pull_requests: write so an advisory reviewer could post its verdict. It merged before we established that hive already had a sanctioned route for this. Now that #7486 makes that route usable, the token grant should be narrowed back to pull_requests: read.
Why
Hive's pattern everywhere else is that the governor performs the write, not the agent: issue_request_watcher.go, pr_request_watcher.go, merge_request_watcher.go all take a request file from an agent and execute it with the App token. review_request_watcher.go is the review analogue, and its doc comment is explicit that this is the intended route:
An agent that wants to review a PR writes a request file here INSTEAD of running gh pr review from its own shell. The hive's watcher submits the review with the App token, so the review is authored by the App bot AND — unlike a direct agent-CLI review, which the hive never observes — it is recorded on the audit/activity trail.
With #7486 merged, an ADVISORY + converse: true reviewer can use that relay. The direct-token grant from #7472 is then redundant — and not neutral:
- Attribution. A relay review is authored by the App bot. A direct-token review is authored by the agent's own identity, outside the App's activity trail.
- Observability. The hive never sees a direct
gh pr review. It is not on the audit trail, so it does not appear in activity counts or SLA accounting.
- Canary / exfiltration. The relay runs review bodies through
scanCanaryText with the fail-closed contract added in kubestellar/hive#4960. The direct path skips it.
- Incentive. Leaving both routes open means the easier one wins, and the easier one is the one we cannot see.
Proposed change
- Revert the
pull_requests: write grant in the reviewer case of pkg/github/app.go back to read.
- Keep the
reviewer tier itself — it is still the right tier, and contents: read / metadata: read are correct.
- Keep
pkg/agentmode.TokenTierForRole and its tests; the role plumbing is independent of the permission level.
- Confirm the reviewer's config carries
converse: true before landing, so the relay route is live when the direct route closes.
Sequencing
Do not land this until a reviewer has actually posted through the relay on the projectbluefin spoke and it is observed on the audit trail. Narrowing the token first would leave the reviewer with no working route at all — which is the state #7485 described.
Verification note
The permission assertions from #7472 already exist in pkg/github/reviewer_tier_permissions_test.go and pin pull_requests presence, so this change is a one-line flip plus updating those expectations.
Summary
#7472 gave the
reviewertoken tierpull_requests: writeso an advisory reviewer could post its verdict. It merged before we established that hive already had a sanctioned route for this. Now that #7486 makes that route usable, the token grant should be narrowed back topull_requests: read.Why
Hive's pattern everywhere else is that the governor performs the write, not the agent:
issue_request_watcher.go,pr_request_watcher.go,merge_request_watcher.goall take a request file from an agent and execute it with the App token.review_request_watcher.gois the review analogue, and its doc comment is explicit that this is the intended route:With #7486 merged, an
ADVISORY+converse: truereviewer can use that relay. The direct-token grant from #7472 is then redundant — and not neutral:gh pr review. It is not on the audit trail, so it does not appear in activity counts or SLA accounting.scanCanaryTextwith the fail-closed contract added inkubestellar/hive#4960. The direct path skips it.Proposed change
pull_requests: writegrant in thereviewercase ofpkg/github/app.goback toread.reviewertier itself — it is still the right tier, andcontents: read/metadata: readare correct.pkg/agentmode.TokenTierForRoleand its tests; the role plumbing is independent of the permission level.converse: truebefore landing, so the relay route is live when the direct route closes.Sequencing
Do not land this until a reviewer has actually posted through the relay on the projectbluefin spoke and it is observed on the audit trail. Narrowing the token first would leave the reviewer with no working route at all — which is the state #7485 described.
Verification note
The permission assertions from #7472 already exist in
pkg/github/reviewer_tier_permissions_test.goand pinpull_requestspresence, so this change is a one-line flip plus updating those expectations.