feat(selfhost): add per-installation GitHub-fetch concurrency admission - #2970
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 2068381 | Commit Preview URL Branch Preview URL |
Jul 04 2026, 08:19 AM |
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2970 +/- ##
=======================================
Coverage 96.06% 96.07%
=======================================
Files 259 260 +1
Lines 28663 28700 +37
Branches 10431 10444 +13
=======================================
+ Hits 27536 27574 +38
Misses 490 490
+ Partials 637 636 -1
🚀 New features to boost your workflow:
|
QUEUE_BACKGROUND_CONCURRENCY caps how many background jobs run AT ALL, globally -- it has no notion of WHICH installation those jobs belong to, so once an operator raises it above the default of 1, one installation's background sweep/backfill can claim every available background slot at once and starve every other installation's background work, even though GitHub's rate-limit admission is nowhere near exhausted for either installation. Adds a third, per-installation claim-time admission check (alongside GitHub rate-limit admission and maintenance-lane admission), checked only for background jobs that make GitHub calls -- never for foreground live-PR work (github-webhook, agent-regate-pr; the latter is exempted by its actual claim-priority, not by job type, since a live regate must never be deferred by this policy regardless of how the rate-limit-budget classifier sees it). A denied job is deferred with jitter, never dropped, mirroring the existing maintenance-admission mechanism's shape. Deliberately in-process (a plain per-installation in-flight counter), not DB-backed: the queue's existing active/activeBackground counters are already per-process scalars with no cross-process aggregation, and this mirrors that same, already-supported single-process-per-deployment topology rather than introducing a new coordination mechanism.
…e raced-defer branch
The env-reference generator only recognized envString(container, "NAME")
calls, so every env var read via the widely-used parsePositiveIntEnv("NAME",
opts) helper -- including this PR's own GITHUB_INSTALLATION_CONCURRENCY_LIMIT
and _DEFER_MS -- was silently missing from the operator-facing self-host env
reference. Teach the generator to also recognize that call shape.
Also add the sqlite-queue installation-concurrency defer path's missing
"UPDATE changed no rows" branch test, mirroring the existing
maintenance-admission test for the identical UPDATE shape.
JSONbored
force-pushed
the
claude/installation-concurrency-admission
branch
from
July 4, 2026 08:18
92b3ca8 to
2068381
Compare
22 tasks
Merged
23 tasks
26 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #2847 ("prioritize live PR work under GitHub rate pressure") explicitly deferred this as needing "a dedicated design pass":
QUEUE_BACKGROUND_CONCURRENCYcaps how many background jobs run at all, globally — it has no notion of which installation those jobs belong to. Once an operator raises it above the default of 1, one installation's background sweep/backfill can claim every available background slot at once and starve every other installation's background work, even though GitHub's rate-limit admission is nowhere near exhausted for either installation.This adds a third, per-installation claim-time admission check (alongside GitHub rate-limit admission and maintenance-lane admission), checked only for background jobs that make GitHub calls — never for foreground live-PR work (
github-webhook,agent-regate-pr; the latter is exempted by its actual claim-priority, not by job type, since a live regate must never be deferred by this policy regardless of how the rate-limit-budget classifier sees it). A denied job is deferred with jitter, never dropped, mirroring the existingmaintenance-admissionmechanism's shape and metrics.Deliberately in-process (a plain per-installation in-flight counter), not DB-backed: the queue's existing
active/activeBackgroundcounters are already per-process scalars with no cross-process aggregation, and this mirrors that same, already-supported single-process-per-deployment topology rather than introducing a new coordination mechanism.New env knobs (documented in
.env.example):GITHUB_INSTALLATION_CONCURRENCY_ENABLED(default true),GITHUB_INSTALLATION_CONCURRENCY_LIMIT(default 2),GITHUB_INSTALLATION_CONCURRENCY_DEFER_MS(default 15s).Generic self-host engine behavior only; no repo-specific logic. Follow-up to a related PR fixing the deferred CI-state snapshot cache is coming separately (independent files, independent risk profile).
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint(not run — no workflow files touched)npm run typechecknpm run test:coveragelocally (unsharded); precise diff-coverage cross-reference againstcoverage/coverage-final.jsonconfirms 100% branch coverage on every changed line across all touchedsrc/**filesnpm run test:workers(not run — no Cloudflare-Workers-pool-specific code touched)npm run build:mcp/npm run test:mcp-pack(not run — no MCP package changes)npm run ui:openapi:check/npm run ui:lint/npm run ui:typecheck/npm run ui:build(not run — noapps/gittensory-uisource or API/OpenAPI surface changes; only the generated env-reference file was regenerated)npm audit --audit-level=moderatenpm run selfhost:env-reference:check(regenerated after adding new env vars)npm run db:migrations:check(no migration needed for this PR; confirms 0108 is next-free for a following PR)If any required check was skipped, explain why:
validatejob runs them as a backstop.Safety
UI Evidencesection below with screenshots. (N/A — no visible UI changes.)Notes