Repository navigation
perf(github): route sweep public reads off App tokens - #1062
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 8:23 PM ET / August 8, 2026, 00:23 UTC. ClawSweeper reviewWhat this changesRoutes safe public OpenClaw issue and pull-request reads in sweep workflows through a workflow token while retaining GitHub App credentials for privileged operations and one bounded throttling fallback. Merge readinessKeep this active PR open: the two prior P1 findings are addressed on the current head, and the reviewed routing, fallback, and workflow changes have no actionable defect. Priority: P1 Review scores
Verification
How this fits togetherClawSweeper sweep jobs read GitHub items before publishing review results or applying guarded actions. The changed GitHub runtime chooses a public workflow token for tightly classified OpenClaw REST reads, while writes and fallback remain on the target App credential. flowchart LR
A[Sweep workflow] --> B[GitHub command runtime]
B --> C{Safe public OpenClaw read?}
C -->|Yes| D[Workflow read token]
C -->|No| E[GitHub App token]
D --> F{Token throttled?}
F -->|First throttle| E
F -->|Later throttle| G[Rate-limit deferral]
E --> H[GitHub API]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the constrained classifier and workflow wiring with the existing bounded fallback intact, then observe normal sweep runs for reduced App-token pressure. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the current main path uses the App credential for scheduled review reads, and the PR’s controlled compiled-runtime throttle scenario exercises the after-fix route and fallback behavior. Is this the best way to solve the issue? Yes: extending the existing narrow read-only classifier and once-per-run fallback avoids duplicating credential-routing policy while retaining App credentials for mutations and explicit-token calls. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d7f18364b02a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
Extend the existing public-read token convention to sweep review, publication, comment-sync, audit, and apply paths while preserving App credentials for mutations and proof inspection. Public-token throttles consume at most one ambient App-token fallback per process.
7980e04 to
c8898f9
Compare
…pools (#1064) PR #1062 moved the exact-event review runtime's reads (~30 calls per review, the largest single stream) onto the per-repo Actions token pool, which the comment router, dashboard CI, and support lanes already share. Concentrating both major read streams on one bucket exhausted it while the App installation bucket idled. Review hydration returns to the App read token; with apply-guard memoization and the router offload in place, the two pools now each carry roughly half the read load.
The 450/h trim ducked App installation 403s at ~30 API calls per review. Apply-guard memoization (#1060) cut that per-item cost and the read-pool split (#1062/#1064) moved router and public reads onto the Actions token pool, so the App bucket now carries only memoized hydration and writes. Post-#1064 telemetry shows ~336 ok reviews/h with near-empty throttle backoff at the 450 cap; restoring the historical 600/h uses the recovered headroom.
…etter recovery (#1146) Makes the dead-letter reconcile lane throttle-resilient so the DLQ can drain during busy hours instead of only when the system is idle. Production evidence: the 19:46Z cycle recovered 0 targets - one 403 on a live-target check aborted canonical discovery and skipped all 125 remaining targets (skip_reasons not_inspected_abort), while the repository_actions bucket sat exhausted (~1,900 throttled item_metadata reads) and target_app had headroom. Five review-hardened layers landed together: (1) target REST/canonical reads route to per-owner App-minted target tokens per the two-bucket doctrine (#1062), reusing the publication path's minting stack in dashboard/github-api.ts - artifact downloads stay on repository_actions; (2) throttle/abuse 403/429 degrade per target with a three-consecutive-throttle fuse instead of abort-all (the #973 abort's quota-protection intent is preserved by the fuse); (3) throttled App installation lookup/minting takes the same bounded skip path (scope=app_setup) with per-owner negative caching; (4) partial App-credential configuration is a hard startup failure naming the missing field - repository-token reads require explicit EXACT_REVIEW_TARGET_TOKEN_MODE=actions, never a silent fallback; (5) installation-missing 404s cache per repository, not per owner, so selected-repositories installations cannot orphan accessible siblings. Auth failures on valid installations remain fail-closed; installation_missing is a structured skip. Proof: Docker-backed Crabbox local-container receipts at each round's head, final 27/27 scenarios (docs/proof/reconcile-throttle-resilience/); operator suite 80/80; full gate green. Verdict clean (Findings: None) on 3ae7bf8. The prior pnpm-check failure was an actionlint CDN 503, rerun green.
Summary
The sweep lanes—scheduled and exact-event review, publication, comment sync, and apply—still performed target-repository reads on the shared GitHub App installation token. That installation has been exhausting its 15,000 requests/hour allowance and producing 403s in production.
This extends the incumbent
CLAWSWEEPER_PUBLIC_GH_TOKENconvention from #1034, hardened by #1054, to the sweep runtime. It uses the same route classification and bounded once-per-run App-token throttle fallback.It also flips the exact-event review runtime and two verified-read-only steps to the repository-conditional workflow-token pattern already used by the live-item probe, removes every
github.tokenfallback from Codex proof-inspection tokens, and gives apply proof a dedicated read-only App inspection mint.OpenClaw Bay is unaffected: this changes internal GitHub credential routing only, with no observer data-contract or action-surface change.
Review finding disposition
gh api -i <endpoint>form used by timeline hydration, while the same shape with--method PATCHremains on the App token.Review shardnow receives the repository-conditional workflow token inCLAWSWEEPER_PUBLIC_GH_TOKEN, while retaining its target App credential inGH_TOKENfor bounded fallback.Proof
c8898f9d807bb5eed7b1bb872c22544b76e04505.gh api -i repos/openclaw/openclaw/issues/123/timeline?per_page=100; the public route is deterministically throttled, the App route succeeds once, and a second public throttle cannot claim the App fallback again.node:24-bookworminside Crabbox provideraws, leasecbx_d72f87c5ebd6, runrun_6b73750759b3.public,app,public; first throttle resultapp-fallback-success; second throttle resultGitHubRateLimitError; invariantpass..github/workflows/sweep.ymlSHA-2562bb0c3500f49d1a9e274f93afe04ed8790c941eaa6a5442e0bb9b9fbb8cdcbe8;src/github-public-read.tsSHA-25688ac66a302a9f25331dd0be09b028fd78738aea812bd993725563d329dff7cb3;test/sweep-workflow.test.tsSHA-256fd8d4e4483aa9393001c3827532fde72cfd27e91125717b43b4a119ea5e0c3a4;test/repair/exact-review-batch-workflow.test.tsSHA-256ac93fb1779a198e38aeb4b7a396640a57dda7386bdddf070cbd4f62401b17120.pnpm run checkpassed on Node 24 in 272 seconds: 3,196 tests, 3,187 passed, 9 skipped, 0 failed; all builds, lint, formatting, and coverage thresholds passed.