Repository navigation
fix(webhook): grant pull request fast-ack tokens pull_requests write - #1082
Conversation
The PR receipt fast ack minted its installation token with pull_requests: read, but posting a comment on a pull request through the issues API requires pull_requests: write for App tokens. GitHub answered 403 Resource not accessible by integration, the ack threw, and between PR #1078 and #1079 that uncaught throw returned HTTP 500 to every pull_request opened/ready_for_review webhook delivery (outage window 2026-08-09 04:12-04:52Z); after #1079 the same failure was swallowed silently, so no PR ever received its receipt comment. Also mint App installation tokens with the documented repositories parameter instead of repository_names, which GitHub ignores - tokens were silently granted installation-wide repository_selection=all instead of being scoped to the named repository. Log swallowed fast-ack failures so the next regression is visible in wrangler tail.
|
Codex review: needs real behavior proof before merge. Reviewed August 9, 2026, 2:41 AM ET / 06:41 UTC. ClawSweeper reviewWhat this changesThis PR grants the webhook receipt acknowledgement a pull-request write token, scopes GitHub App tokens with the documented repository list, logs swallowed acknowledgement failures, and updates focused assertions. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep open. The runtime repair is narrowly aligned with current source and the reported incident, but the PR needs inspectable redacted real-behavior proof and should remove its release-owned changelog entries. Priority: P1 Review scores
Verification
How this fits togetherThe Cloudflare webhook worker receives pull-request events, queues review work, and posts a quick receipt acknowledgement using a GitHub App installation token. Dashboard and repair-comment paths mint comparable tokens, so their requested repository scope affects the least-privilege boundary for automation. flowchart LR
A[GitHub pull request webhook] --> B[Webhook worker]
B --> C[Queue review]
B --> D[Mint installation token]
D --> E[Repository scope and permissions]
E --> F[Receipt acknowledgement]
C --> G[Review workflow]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the narrow runtime and regression-test repair without release-owned changelog edits after attaching a redacted production-boundary trace showing selected-repository token scope and a successful acknowledgement. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: current main requests Is this the best way to solve the issue? Yes for the runtime repair: correcting the permission and documented repository-list key is the narrowest shared fix. The release-owned changelog edit is not part of the appropriate solution. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6971afb72029. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Problem
Since PR #1078 deployed (2026-08-09 04:10Z), every
pull_requestopened/ready_for_reviewwebhook delivery toclawsweeper.openclaw.aireturned HTTP 500 (Cloudflare 1101, Worker uncaught exception) until #1079 (04:53Z) moved the fast ack behind a bare.catch(() => undefined)— which stopped the 500s but left the receipt ack silently broken: no PR has received its 🦞👀 comment since.Root cause (verified live)
acknowledgePullRequestReceiptmints its App installation token withpermissions: { issues: "write", pull_requests: "read" }. Posting a comment on a pull request viaPOST /repos/{repo}/issues/{n}/commentsrequirespull_requests: writefor App tokens. GitHub answers 403 "Resource not accessible by integration",githubTokenJsonthrows. Replaying the worker's exact sequence (WebCrypto JWT replica included) from Actions with the production key reproduced it: every step 200/201 until the comment POST 403s withpull_requests: read; flipping towriteposts successfully. The working comparison is the maintainer-command ack path, which has always mintedpull_requests: "write".Bonus finding from the same replay:
createGithubAppTokenForsendsrepository_namesin the mint body — a parameter the GitHub API does not have. It is silently ignored and tokens come backrepository_selection: "all"(installation-wide) instead of scoped to the named repo. The documented parameter isrepositories(verified: yields"selected", 1 repo).Changes
acknowledgePullRequestReceipt: mintpull_requests: "write"(matches the command-ack path).console.error) so the next regression shows up inwrangler tail; webhook still never fails on ack errors.createGithubAppTokenFor(dashboard queue) andcreateInstallationToken(src/repair/comment-webhook.ts):repository_names→repositories, restoring real repo scoping.repositories+pull_requests: write), and the ack-failure case now uses the production-shaped 403 response instead of a thrown mock error.Impact assessment of the incident
Delivery-log audit of the outage window (04:12:08–04:52:37Z): 500s hit only
opened/ready_for_review; enqueue ran before the throw, and reconcile lanes absorbed the rest — every PR opened in the window is either already reviewed or pending in the queue. No redelivery batch needed.Proof
pnpm run checkgreen (coverage 81.34% lines / 74.05% branches / 87.37% functions).node --test test/dashboard-worker.test.ts test/exact-review-publication-batches.test.ts— 386 pass, 0 fail; the 403 regression test logsClawSweeper pull request fast ack failed: ClawSweeper ack comment 403: …and returns 202/queued.pull_requests: writeposted the receipt comment on fix: enable Slack native approvals for Enterprise Grid installs openclaw#120874 (the PR whose lost delivery started this investigation).