Repository navigation
fix(sweep): allow PR review lease comments - #539
Conversation
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed July 13, 2026, 11:46 PM ET / July 14, 2026, 03:46 UTC. Summary Reproducibility: yes. The linked production run consistently failed all 29 PR review shards with authorization errors while the ordinary issue succeeded, and current main's token permissions explain that split. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the narrow token change under the approved monitored rollout, then capture redacted output and resulting comment URLs from the first normal pull-request and issue review cycle and re-review the deployed behavior. Do we have a high-confidence way to reproduce the issue? Yes. The linked production run consistently failed all 29 PR review shards with authorization errors while the ordinary issue succeeded, and current main's token permissions explain that split. Is this the best way to solve the issue? Yes. Changing only the affected short-lived review token is the narrowest correction, while the separate read-only Codex credential and focused regression assertion preserve the intended security boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b30773af54b4. Label changesLabel justifications:
Evidence reviewedSecurity concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (9 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
@clawsweeper review |
|
proof: override As a maintainer, I approve a monitored rollout of #539's only new capability: the short-lived target-review token may request This is a pre-merge proof override because real App-token PR-and-issue lease/status-comment proof is only possible after the default-branch workflow is deployed. Do not widen any other token, workflow capability, state publication path, or the read-only Codex subprocess boundary. Before the rollout is considered complete, capture redacted output from the first normal post-merge review run plus the resulting pull-request and ordinary-issue lease/status comment URLs. |
Reverts merge commit c0aa0bc while preserving follow-up openclaw#539 and openclaw#545 behavior.
Summary
pull-requests: write, while retaining its existingissues: writescope.Create target review tokenblock.Problem
The scheduled ClawHub sweep in run 29261805316 minted a token with
issues: writebutpull-requests: read. Review-shard lease/status comments usePOST /repos/{target}/issues/{number}/comments; on PR items that endpoint needs the App's Pull requests write permission. All 29 ClawHub PR shards therefore received403 Resource not accessible by integration, while the one ordinary issue succeeded.This is independent of PR #518's recovery/fanout handling and PR #521's ledger lifecycle work.
Implementation
Only the review-shard
Create target review tokenblock in.github/workflows/sweep.ymlchanges:permission-pull-requests: readbecomespermission-pull-requests: write.Validation
pnpm run build:all— passed.node --test --test-name-pattern "sweep target review token can post pull request review leases" test/sweep-workflow.test.ts— passed (1/1).node --test --test-name-pattern "sweep target review token can post pull request review leases|review workflow gives Codex a read-only inspection token" test/sweep-workflow.test.ts— passed (2/2).node --test --test-name-pattern "codex subprocess env strips GitHub and App credentials|codex subprocess env can expose an explicit read-only GitHub token" test/clawsweeper.test.ts— passed (2/2).node --test test/sweep-workflow.test.ts— passed (62/62) in Linux local-container Crabbox proof, providerlocal-container, leasecbx_8c70bf6e5438, commitf38ac5bb6d75f01ea21fdf2d70927b0965dedde4. The one-shot lease stopped automatically.node:24-bookworm, Debian 12): mounted the PR worktree read-only, copied source into/work, installed withpnpm install --frozen-lockfile, then passed:node --test --test-name-pattern "sweep target review token can post pull request review leases|review workflow gives Codex a read-only inspection token" test/sweep-workflow.test.ts— passed (2/2).node --test --test-name-pattern "codex subprocess env strips GitHub and App credentials|codex subprocess env can expose an explicit read-only GitHub token" test/clawsweeper.test.ts— passed (2/2).node --test --test-name-pattern "review start status comment is marker-backed and crustacean-friendly|spoofed durable markers cannot suppress a bot-owned start lease|concurrent review lease election uses server comment order, not client timestamps" test/review-comment-rendering.test.ts— passed (3/3).pnpm exec oxlint test/sweep-workflow.test.ts --deny-warnings— passed..github/workflows/sweep.yml— passed.git diff --check origin/main...HEAD— passed.actionlint— unavailable on this host: executable is not onPATH.pnpm run format:checkreports pre-existing formatting differences across 373 files, including both unchanged full files touched here; no repository-wide formatting rewrite was applied.Credential-boundary proof
GH_TOKENonly for deterministic review orchestration and lease/status publication.Create target Codex inspection tokenstep requests onlycontents: read,issues: read, andpull-requests: read. TheReview shardstep passes that token separately asCLAWSWEEPER_PROOF_INSPECTION_TOKEN.src/codex-env.tsdeletes inheritedGH_TOKEN,GITHUB_TOKEN, App credentials, andCLAWSWEEPER_PROOF_INSPECTION_TOKENbefore reinjecting only the explicit inspection token for the Codex subprocess. Existing tests cover both stripping inherited credentials and passing an explicit inspection token.This preserves the intended boundary: deterministic workflow code can post the lease/status comment; the untrusted Codex subprocess receives the separate read-only inspection credential.
Deployment prerequisite and installation evidence
The ClawSweeper GitHub App installation for
openclaw/clawhubmust allow Pull requests: Read & write.actions/create-github-app-tokencan narrow an installation permission but cannot grant a permission that the installation does not have.The installation settings endpoint is not readable with the available user authentication:
GET /repos/openclaw/clawhub/installationreturns401 A JSON web token could not be decoded. The capability is nevertheless proven by redacted live workflow evidence from the failing parent run itself: run 29261805316, jobPublish review artifacts(86858453103), ranCreate target write tokenat 2026-07-13T15:27:35Z foropenclaw/clawhubwithpermission-pull-requests: write; that step succeeded and its normal post-step cleanup revoked the token. The pinned workflow at the run head requested the same write scope. This establishes that the installation could mint a ClawHub PR-write token at incident time; the remaining defect was that the review shard requested only PR read.Post-merge behavior proof
The Docker proof above is deterministic local-container evidence for the workflow/token boundary and lease-comment behavior. It is not claimed as the requested live post-deployment App-token proof; the real lease/status comment URLs still require a normal default-branch run after merge or an explicit maintainer proof override.
The requested real App-token proof cannot be produced from this unmerged branch: scheduled review shards execute the default-branch workflow, and this PR does not dispatch or rerun workflows. Before treating the rollout as complete, a maintainer must:
@clawsweeper re-review.Maintainer rollout decision
Maintainer decision recorded 2026-07-14:
Authenticated approval: proof: override comment by
brokemac79.pull-requests: writealongside its existingissues: writescope.@clawsweeper re-review.Risks and rollout
The additional scope is limited to the short-lived review token already used for deterministic lease/status comments. Repository contents, checks, statuses, and the Codex inspection token remain read-only. The remaining proof is a post-deployment normal-run observation; this PR does not dispatch or rerun anything.
Codex review closeout
codex review --uncommitted— clean; no accepted or actionable findings.codex review --base origin/main— clean; no accepted or actionable findings.