fix(github): attribute rate limits by token scope - #1951
Conversation
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-01 06:43:30 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1951 +/- ##
==========================================
+ Coverage 95.63% 95.66% +0.02%
==========================================
Files 220 220
Lines 24400 24452 +52
Branches 8847 8867 +20
==========================================
+ Hits 23336 23393 +57
Misses 436 436
+ Partials 628 623 -5
🚀 New features to boost your workflow:
|
6d45216 to
6ce3f4c
Compare
|
Reworked and rebased onto Blocker fixed — Scope-helper divergence reconciled. Threaded the admission key through the paths that didn't exist at this PR's base (so attribution is complete, not partial):
Conflicts resolved by keeping main's structure (GraphQL-preferring CI path, |
6ce3f4c to
4a3454f
Compare
|
Addressed the API-drift note (duplicated token→key derivation + a helper that took a token without requiring the matching key):
Gate green again locally ( |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | e758093 | Commit Preview URL Branch Preview URL |
Jul 01 2026, 06:33 AM |
Summary
Closes #1940.
This fixes GitHub rate-limit attribution so self-host queue admission can distinguish installation-token work, public-token work, and unknown/no-token work instead of collapsing too much traffic into an ambiguous bucket.
What changed
Why
The self-host stack needs to keep unrelated GitHub work moving while respecting the actual depleted token bucket. Without stable attribution, observed rate-limit pressure can be too broad or too vague, which makes queue admission less useful during webhook and scheduled-work bursts.
Validation
git diff --checknpm run typechecknpx vitest run test/unit/github-client.test.ts test/unit/selfhost-queue-common.test.ts test/unit/selfhost-sqlite-queue.test.ts test/unit/selfhost-pg-queue.test.tsnpx vitest run test/unit/backfill.test.ts test/unit/rag-index.test.ts test/unit/queue.test.ts test/unit/fetch-live-pr-state.test.ts test/unit/fetch-live-pull-request.test.ts test/integration/api.test.ts test/integration/routes-errors.test.tsnpx vitest run test/integration/api.test.ts test/unit/backfill.test.ts test/unit/rag-index.test.ts test/unit/queue.test.tsnpm run test:coverage