Repository navigation
fix: collapse exact publication on GitHub quota - #1102
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 12:16 PM ET / 16:16 UTC. ClawSweeper reviewWhat this changesThe PR adds reset-aware credential circuits, first-failure batch collapse, and observer-only quota telemetry to exact-review publication. Merge readinessKeep open for normal maintainer review. The PR provides a focused, source-backed quota-containment design with controlled real-behavior proof; no actionable patch defect was found. Priority: P1 Review scores
Verification
How this fits togetherExact-review publication downloads review artifacts and posts outcomes through GitHub while a durable queue controls admission, retries, and recovery. This PR connects GitHub quota signals to that queue and exposes redacted operational status in Bay. flowchart LR
A[Publication batch] --> B[GitHub requests]
B --> C[Quota signal]
C --> D[Credential circuit]
D --> E[Queue admission and reset recovery]
E --> F[Status API]
F --> G[Bay health context]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the scoped circuit design, land it after normal maintainer approval, and observe two quota windows for healthy-owner progress, backlog drain, and dead-letter stability. Do we have a high-confidence way to reproduce the issue? Yes: the PR supplies deterministic quota-fixture scenarios for repository and target-App exhaustion, collapse, persistence, and reset recovery, with current-head source paths matching the claimed behavior. Is this the best way to solve the issue? Yes: credential-scoped durable admission and reset recovery directly prevent repeat attempts without conflating quota pressure with worker-capacity pressure. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75ac66b2b3b7. 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
|
Summary
Contain exact-review publication when GitHub throttles a shared credential pool, instead of rotating queued items through the same exhausted quota. This combines the six CSW-117 remediation items in one stack: reset-aware errors, durable scoped circuits, first-failure batch collapse, bounded public-read fallback, adaptive feedback/operator telemetry, and successful-path request accounting.
Related: #1097 remains separate and unchanged.
Problem
The 2026-08-10 production observation showed a publication backlog while publisher capacity was idle. In the retained sample, 31 throttled batches made 187 member attempts for only 63 unique revisions; 124 attempts (66%) repeated a revision already attempted in a throttled batch. Eight consecutive full batches expired all 64 members. This is shared GitHub quota amplification, not a shortage of publication workers.
The previous path could lose the authoritative reset boundary, retry after a short fallback, and rotate other ready items through the same credential. Artifact preparation also began before the first batch throttle could stop later members, and batch throttle outcomes were not feeding current publication control.
Implementation
Reset-aware quota signals
retry-afterprecedence, preservesx-ratelimit-reset, and applies a stable conservative future deadline when headers are absent or stale.Durable credential-scoped circuits
First-failure batch collapse
Bounded public-read fallback
Adaptive feedback and operator telemetry
/api/statusand Bay; no operational controls are added.Measured request demand and safe early reductions
Receipt insertion, dispatcher state, and counters are committed atomically. Fault-injection coverage proves failed state or receipt writes do not leave partial acknowledgement.
Validation
Current base:
75ac66b2b3b7dbf9def8007c52f5f05fac616c3dCurrent head:
8d387089c30fbc84bd628f6b56ff629dbb875879pnpm run build:allpnpm run lintpnpm run check:docspnpm run check:limitsgit diff --checknode --test test/exact-review-publication-batches.test.ts— 63/63 passedactionlintparsed the changed workflow. It reports five existing/intentional SC2016 informational notices for literal GitHub expressions in single-quoted shell text. A repository-wide run also reports unrelated current-main errors inrepair-comment-router.ymland unsupportedqueuekeys insweep.yml; this patch does not alter those surfaces. The changed Bash path passed its Linux workflow tests.On native Windows, the workflow test that invokes
/bin/bashcannot execute because that path is not a Windows surface. The same path passed in the required Linux container proof.Real Behavior Proof
Claim: An exhausted GitHub credential pool opens one durable reset-aware circuit, collapses later same-pool work, preserves healthy owners/pools, and resumes after reset with bounded jitter without weakening exact-review fencing, freshness, idempotency, or mutation authorization.
Exercised surface: rate-limit parsing and propagation; exact-review preparation/outcomes; durable queue persistence, admission, alarm, recovery, and status; public-read routing; adaptive control; Bay/status telemetry; receipt atomicity and retention.
Scenario/fixture: deterministic primary/secondary/missing-header throttles; repository exhausted/App healthy; App exhausted/repository healthy; both exhausted; 8-member first-failure collapse; concurrency-in-flight bound; Durable Object restart; 52 blocked owners ahead of a healthy owner; reset recovery; duplicate and late telemetry; receipt/state write fault injection; private/mutating route rejection.
Command/environment: Docker-backed Crabbox
local-container, imagenode:24-bookworm, read-only source bind copied to disposable/tmp/proof, frozen install, build, and focused Node/workflow suites.Observed result: 123 tests passed with zero failures. No later member was admitted after a shared failure beyond already-in-flight work; unattempted releases did not spend retry budget; the healthy owner beyond the scan limit was admitted; persisted circuits survived restart and recovered after the deadline; duplicate feedback remained idempotent; injected transactional failures left no partial receipt/acknowledgement.
Artifact/trace: provider
local-container; leasecbx_8aa5ded88ca0; run sluggolden-shrimp; exact head8d387089c30fbc84bd628f6b56ff629dbb875879; total 32.822s (command 32.714s). The lease auto-stopped normally.Limits: The proof uses local GitHub-boundary fixtures and does not exhaust a real credential or mutate production. Organic behavior still needs read-only observation across subsequent quota windows. Containing amplification does not prove that all legitimate successful-path demand fits every GitHub pool.
Review closeout
Overall correctness: patch is correct, no findings. Artifact:C:\clawsweeper-work\repos\clawsweeper\.git\worktrees\csw-117-github-quota-circuit\clawsweeper\reviews\local-range-1786377440411-17960\0.md.GITHUB_TOKEN, full secondary-limit patterns, repeat revision propagation, stable fallback deadlines, cross-lease identity, bounded receipt retention, fallback observation semantics, transactional receipt/state updates, and blocked-owner scan saturation.Risks and rollout
Documentation
Updated limits, scheduler, and live-dashboard guidance alongside the status/Bay contract. The mandatory documentation/config drift checks pass.
CHANGELOG.mdis intentionally untouched because release notes are release-owned.Non-goals