Repository navigation
fix(claude): grant the one permission resolving a thread actually needs - #237
Merged
Merged
Conversation
Measured on #236, not inferred: the reviewer verified its own 🟡 finding, tried to resolve the thread, and reported `thread open: not permitted (no Contents: write)`. `resolveReviewThread` is gated on the token's **Contents: write**; `pull_requests: write` alone is refused with `Resource not accessible by integration` (github/gh-aw#35726, oven-sh/bun#36959 and #40468, all with live logs). That is not cosmetic here: branch protection has `required_conversation_resolution` enabled, so an unresolved thread the bot left behind **blocks the merge**. #236 could not be merged until a human resolved it. So both review jobs now grant `contents: write` — one permission, for one GraphQL mutation — and the compensating controls are what keep it narrow: `persist-credentials: false` on every checkout, `git push`/`commit`/`merge`, `gh pr merge/close/review/edit` denied, and every REST write verb (`gh api -X …`, `gh api --method …`) denied, leaving GraphQL as the only mutation path available to the job. The reviewer still checks `viewerCanResolve` first and reports `not permitted` rather than assuming; if an installation cannot grant Contents: write, the human fallback is unchanged and documented. Refs #236, #233
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.
Refs #73, #236
The measurement
On #236 the reviewer verified its own 🟡 finding, tried to resolve the thread, and reported:
viewerCanResolve: falseis the token telling the truth:resolveReviewThreadis gated on Contents: write, and the job declaredcontents: read.pull_requests: writedoes not help — that is refused withResource not accessible by integration(github/gh-aw#35726,oven-sh/bun#36959,oven-sh/bun#40468, all with live logs).This is not cosmetic.
mainhasrequired_conversation_resolutionenabled, so the thread the bot abandoned blocked #236 from merging until it was resolved by hand.What changed
Both review jobs (
.github/workflows/claude-code-review.yml, and the on-demandreviewjob inclaude.yml) grantcontents: write— one permission, for one mutation — with the controls that keep it narrow:persist-credentials: falseon every checkoutgit push/commit/merge,gh pr merge/close/review/editdeniedgh api -X …andgh api --method …deniedThe reviewer still checks
viewerCanResolvebefore mutating and reportsnot permittedinstead of assuming. If an installation cannot grant Contents: write, the human fallback is unchanged and documented.Verification
test_claude_integration.pynow asserts the exact permission set and that both REST write denials are present, while the existing "cannot merge/approve/push" assertions still hold (comments stripped before the literal scan, so the explanatory comment is not mistaken for a command). 39 tests; withtest_ci_workflow.py, 83 passed.isResolved: true. That needs this onmainplus a review with a verified fix — the canary pull request is queued for exactly that, and it is the acceptance evidence for the thread-resolution lifecycle.