Skip to content

fix(claude): grant the one permission resolving a thread actually needs - #237

Merged
elewashy merged 1 commit into
mainfrom
fix/thread-resolution-permission
Nov 21, 2026
Merged

elewashy merged 1 commit into
mainfrom
fix/thread-resolution-permission

Conversation

@elewashy

Copy link
Copy Markdown
Collaborator

Refs #73, #236

The measurement

On #236 the reviewer verified its own 🟡 finding, tried to resolve the thread, and reported:

fix verified, thread open (not permitted: viewerCanResolve is false for this token, so a human can resolve it)

viewerCanResolve: false is the token telling the truth: resolveReviewThread is gated on Contents: write, and the job declared contents: read. pull_requests: write does not help — that is refused with Resource not accessible by integration (github/gh-aw#35726, oven-sh/bun#36959, oven-sh/bun#40468, all with live logs).

This is not cosmetic. main has required_conversation_resolution enabled, 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-demand review job in claude.yml) grant contents: write — one permission, for one mutation — with the controls that keep it narrow:

Control Why
persist-credentials: false on every checkout git has no credential to push with
git push/commit/merge, gh pr merge/close/review/edit denied no code, PR state, approval or merge
gh api -X … and gh api --method … denied every REST write verb; GraphQL is the only path left, and the only thing it is used for is the resolve

The reviewer still checks viewerCanResolve before mutating and reports not permitted instead of assuming. If an installation cannot grant Contents: write, the human fallback is unchanged and documented.

Verification

  • test_claude_integration.py now 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; with test_ci_workflow.py, 83 passed.
  • actionlint clean; root ruff clean.
  • Not yet verified live: that the App installation accepts the grant and the mutation now returns isResolved: true. That needs this on main plus 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.

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
@elewashy
elewashy merged commit f9ab28b into main Nov 21, 2026
8 checks passed
@elewashy
elewashy deleted the fix/thread-resolution-permission branch November 21, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant