fix(review): add missing GitHub-budget rate-limit admission for 5 maintenance job types - #4570
Conversation
…ntenance job types (#4505) reconcile-open-prs was missing from GITHUB_BUDGET_BACKGROUND_TYPES and had no jobCoalesceKey case, so once GITTENSORY_PR_RECONCILIATION is enabled its real paginated per-repo GitHub REST calls would never yield to an exhausted shared budget, and every 10-min tick would insert a duplicate row instead of coalescing into one still-pending scan. Fixing this one prompted a systematic audit of every MAINTENANCE_JOB_TYPES member against GITHUB_BUDGET_BACKGROUND_TYPES (the module's own header comment claims universal coverage), which found four more of the same gap: - refresh-installation-health: getAppInstallation (a direct, unprotected `GET /app/installations/{id}` REST call) per installation, plus resolveRepositorySettings per installed repo. Runs every 30 min, UNCONDITIONALLY -- the most severe of the five, since it is exercised in every deployment today, not just after an operator opts into a flag. - backlog-convergence-sweep: resolveRepositorySettings per repo in both the fan-out and per-repo handler. Runs every 30 min, unconditional for self-hosted runtimes. - selftune: resolveRepositorySettings per registered repo. Hourly, flag-gated. - generate-review-recap: loadRepoFocusManifest directly. Not yet cron-enqueued (manual/API trigger only today), and had no jobCoalesceKey case at all -- every trigger inserted a fresh duplicate row. All five now yield to shouldWaitForGitHubRateLimit at dequeue time and coalesce a repeated enqueue into an already-pending/processing row. The maintenance-admission.ts header comment is corrected to describe which job types get GitHub-budget admission (the subset making real GitHub calls) vs. only local-load admission (the purely-internal sweeps), rather than claiming universal coverage.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4570 +/- ##
=======================================
Coverage 94.10% 94.10%
=======================================
Files 427 427
Lines 38022 38022
Branches 13877 13877
=======================================
Hits 35779 35779
+ Misses 1586 1585 -1
- Partials 657 658 +1
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-10 04:45:19 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Linked issue satisfactionPartially addressed 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.
|
Summary
reconcile-open-prswas missing fromGITHUB_BUDGET_BACKGROUND_TYPESand had nojobCoalesceKeycase, so onceGITTENSORY_PR_RECONCILIATIONis enabled its real paginated per-repo GitHub REST calls would never yield to an exhausted shared budget, and every 10-min tick would insert a duplicate row instead of coalescing into one still-pending scan.MAINTENANCE_JOB_TYPESmember againstGITHUB_BUDGET_BACKGROUND_TYPES(the module's own header comment claims universal coverage — it wasn't true), which found four more of the same gap:refresh-installation-health—getAppInstallation(a direct, unprotectedGET /app/installations/{id}REST call) per installation, plusresolveRepositorySettingsper installed repo. Runs every 30 min, UNCONDITIONALLY — the most severe of the five, since it's exercised in every deployment today, not just after an operator opts into a flag.backlog-convergence-sweep—resolveRepositorySettingsper repo in both the fan-out and per-repo handler. Runs every 30 min, unconditional for self-hosted runtimes.selftune—resolveRepositorySettingsper registered repo. Hourly, flag-gated.generate-review-recap—loadRepoFocusManifestdirectly. Not yet cron-enqueued (manual/API trigger only today), and had nojobCoalesceKeycase at all — every trigger inserted a fresh duplicate row.MAINTENANCE_JOB_TYPESmember not already in the set was traced and confirmed to make zero GitHub calls (purely local D1 work, or dispatching an already-gated job type) — see the new negative-assertion test.shouldWaitForGitHubRateLimitat dequeue time and coalesce a repeated enqueue into an already-pending/processing row.maintenance-admission.ts's header comment is corrected to describe which job types get GitHub-budget admission (the subset making real GitHub calls) vs. only local-load admission (the purely-internal sweeps), rather than claiming universal coverage.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint(vianpm run test:ci)npm run typechecknpm run test:coveragelocally (unsharded) — zero uncovered statements/branches in the diffnpm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderatereconcile-open-prspre-yields at the dequeue-time throttle while the shared budget is exhausted, end-to-end viaworker.queue()), regression tests (jobCoalesceKeynow returns a stable per-repo key forgenerate-review-recapinstead of falling through tonull; the two previously-simple-return-type casesrefresh-installation-health/selftunestill coalesce correctly), and a positive+negativeisGitHubBudgetBackgroundJobmatrix covering all 5 newly-gated types plus every confirmed-clean type from the audit, per fix(queue): reconcile-open-prs has no GitHub rate-limit admission or job dedup #4505's requirementsSafety
UI Evidence— N/A, no visible/UI change.