Repository navigation
fix(queue): preserve GitHub quota headroom - #1086
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 7:13 PM ET / 23:13 UTC. ClawSweeper reviewWhat this changesThe PR lowers scheduled exact-review admission to 300/hour with a 30-item burst, pauses scheduled and background admission after typed GitHub throttles, and forwards the event repository default branch in dispatcher payloads. Merge readinessKeep open for maintainer review: current main still admits scheduled work at 450/hour with a 120-item burst and has no throttle-driven scheduled-admission pause, while this PR provides a bounded repair with substantial runtime proof. The remaining choice is whether to accept the deliberate scheduled-throughput reduction in exchange for GitHub quota headroom. Priority: P1 Review scores
Verification
How this fits togetherGitHub events and scheduled target scans enter the exact-review queue, which admits work into review workflows that share a GitHub App installation quota. Completion signals and dispatcher payloads feed back into that queue so it can defer lower-priority work and retain the correct target branch. flowchart LR
A[GitHub events and schedules] --> B[Exact-review queue]
B --> C[Admission budget]
C --> D[Review workflows]
D --> E[GitHub App quota]
E --> F[Throttle completion]
F --> C
B --> G[Target branch dispatch]
G --> D
Decision needed
Why: The code and controlled proof establish the behavior, but the acceptable balance between scheduled review latency and shared GitHub quota headroom is an operational policy choice that only maintainers can make after considering live demand. Before merge
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: Accept the narrow admission and cooldown repair only if the scheduled-throughput trade-off is acceptable, then use deployed quota and queue telemetry to recalibrate the target from measured demand. Do we have a high-confidence way to reproduce the issue? Yes—the supplied failure runs identify GitHub rate-limit responses, and the PR body gives a concrete Worker/Workerd scenario that completes a typed throttle, verifies scheduled/background shedding, preserves interactive admission, and observes recovery. Is this the best way to solve the issue? Yes—the queue-level budget and typed-throttle cooldown address the shared admission source directly while retaining legacy branch lookup and interactive exact-event handling; the remaining question is the chosen operational capacity target. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 95f9dab14c45. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
35ce928 to
ed5ed93
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Ports the durable command-intake pipeline for the "@clawsweeper re-review" command from the abandoned Aug-8 WIP (snapshot 4cad8de on codex/fix-command-review-publication) onto current main. Commands are now durably recorded pre-acknowledgement (intake/watermark/receipt/revision tables, 16-item intake, 15s-15m bounded retries, 30-day receipts), verified against the live comment and head, fenced through verify/enqueue/effects stages, and superseded by full version identity - including equal-timestamp edits (review-caught P1). Acknowledgement and reaction effects are idempotent; router runs that throttle mid-command now recover instead of stranding the command (live instance: openclaw/openclaw#116562 was acked then lost when both router runs throttled). Superseded snapshot pieces were dropped, not ported: retry jitter (#1076/#1077), quota headroom (#1086), retry budgets (#1089), parked reconciliation (#1111), branch guard (#962); dashboard-monolith diffs were reworked around the #1116/#1124/#1132 splits. Proof: committed receipt at this exact head (docs/proof/durable-command-intake/), real Wrangler Worker + DO comparison with durable throttled recovery, GitHub confined to loopback API; full gate 7056 passed / 0 failed; strict check green. Verdict clean (Findings: None) on 9eb957e.
Summary
Problem
Current
mainintermittently exhausts the shared GitHub App installation request bucket across otherwise independent consumers. Read-only investigation re-established primary quota failures in:These were installation-token
403 API rate limit exceededresponses interleaved with successful runs. Router-ledger finalize errors were secondary fallout after the primary quota failures. The current open issue/PR population is large enough that the repeated list and hydration paths amplify the shared pressure.The structural over-capacity is the scheduled exact-review budget: the worker documents about 30 GitHub requests per full review, while 450 reviews/hour permits roughly 13,500 requests/hour and a 120-item cold-start burst permits roughly 3,600 requests before the hourly limiter dominates. That leaves insufficient room inside the 15,000-request installation allowance for all other lanes. This is independent of #1085, whose exact-publication batching and guard behavior remain unchanged. The branch is rebased onto #1087, which separately reduces only hot fleet target-fanout cadence from every 5 minutes to every 20 minutes. That containment lowers one producer's pressure but does not change core 5-minute intake, ClawHub, normal, or audit schedules and does not replace the shared admission/cooldown repair here.
Implementation
retryKind: throttlepauses scheduled admission plus failed-shard recovery, artifact-retention recovery, and source-drift requeue admission. Interactive exact-event admission remains available. The durable deadline is the maximum of the existing deadline, the reported retry time, and a 15-minute minimum, so concurrent shorter reports cannot shrink an active cooldown.github.event.repository.default_branch; the legacy ingress fallback remains available for older senders.No token pool was shuffled and no retry count was increased. Mutation leases, idempotence, publication guards, authorization, and destructive-close behavior are unchanged.
Validation
corepack pnpm run build:allnode --test test/dashboard-worker.test.ts(326 passing)node --test test/target-dispatcher-workflow.test.ts(2 passing)corepack pnpm exec oxlint dashboard/exact-review-queue.ts test/dashboard-worker.test.tsgit diff --checkcorepack pnpm run checkreached repository-wideformat:check; on this Windows checkout oxfmt reported all 648 files because of baseline line-ending behavior. The five changed files were formatted directly and scoped lint/diff checks passed. No repository-wide line-ending policy was changed.actionlintis not installed in this checkout. The changed workflow payload is covered by the dispatcher-template tests and exact-head Linux proof below.Review gates
docs/scheduler.md,docs/limits.md, and the scheduler continuation comment now consistently document 300/hour, burst 30, request headroom, and the independent 600-item pending soft limit.codex review --base origin/mainon headedf9eb74c01870212e6b2c3e65f88cf07e275cb4: no actionable findings. The final read-only local ClawSweeper range review also completed with no blockers (decision=keep_open, confidence high, actionkept_open).corepack pnpm run review -- --local-range --target-repo openclaw/clawsweeper --base origin/main: one committed-range item,decision=keep_open,confidence=high, no blockers and no GitHub mutation.Real Behavior Proof
Claim: the exact head bounds scheduled request demand, durably sheds scheduled/background admission after a typed GitHub throttle without blocking interactive exact events, preserves the longest recovery deadline, and removes the ingress default-branch GET for current dispatcher events.
Exercised surface: production queue configuration, exact-review enqueue/completion/token-bucket/status paths, repeated and partial throttle reports, coordination retries, queue ordering and close-safety regressions, and the target-dispatch workflow/template payload.
Scenario and fixture: the complete dashboard worker suite (326 tests) plus dispatcher workflow suite (2 tests), including production limit assertions, scheduled/background-vs-interactive admission, supplied and concurrent throttle deadlines, fallback/partial-failure paths, ordering, idempotence, and close-safety coverage. A separate transport proof ran the built Worker through Wrangler/workerd HTTP routing and SQLite-backed Durable Object persistence: it seeded an isolated claimed lease, posted a typed throttle completion through
/internal/exact-review/complete, sent signed enqueue traffic through/internal/exact-review/enqueue, read/api/exact-review-queue, advanced only the isolated proof deadline, and observed recovery.Command/environment: Crabbox provider
local-container, leasecbx_c1798df48a65(golden-prawn), Docker imagemcr.microsoft.com/playwright:v1.60.0-noble. A fresh PR checkout and public branch clone asserted exact headedf9eb74c01870212e6b2c3e65f88cf07e275cb4, installed the frozen lockfile, built all targets, then ran Wrangler4.107.0locally with isolated persisted Durable Object state and an isolated proof-only webhook secret.Observed result: exit 0 in 28.549s. The typed completion returned
{ok:true,requeued:true}. Scheduled normal backfill and all three low-priority background sources returnedshed:true, reason:scheduled_rate; interactiveopenedingress queued. Active stats exposed redactedreview_completionrecovery telemetry. After the isolated deadline passed, source-drift recovery queued and all throttle fields disappeared. The script ended withCSW110_WORKERD_PROOF=passand the asserted exact SHA. Separately, the full exact-head test suites passed 326 + 2 tests.Artifact/trace: Crabbox local-container receipt for lease
cbx_c1798df48a65, sluggolden-prawn, exit 0 in 40.898s (command 29.934s), withCSW110_WORKERD_PROOF=pass head=edf9eb74c01870212e6b2c3e65f88cf07e275cb4. Two preceding local-container leases (cbx_3a6c0490ed87,cbx_6509ab46b654) stopped before command execution when raw-workspace rsync closed; the successful run used Crabbox fresh-PR checkout to bypass that transport failure without changing provider or image. This exact-head receipt is the authoritative result.Limits: the transport proof uses the production Worker and Durable Object implementation but an isolated local workerd instance and a seeded claimed-lease fixture; it does not dispatch a GitHub workflow, mutate a live queue, or consume production GitHub state. Organic quota health can only be confirmed after merge and deployment. Current
maintherefore remains intermittently quota-constrained until the change is landed and deployed.Operational impact and rollback
.github/workflows/**; GitHub OAuth workflow scope may require a maintainer-owned replacement branch or approval. No workflow was dispatched while developing or proving this patch.Risks