fix(scale-down): reselect GitHub Apps and attribute cleanup quota - #5466
Open
guicaulada wants to merge 1 commit into
Open
guicaulada wants to merge 1 commit into
guicaulada wants to merge 1 commit into
Conversation
guicaulada
added this pull request to stack #5468
September 23, 2026 14:28
guicaulada
force-pushed
the
gc/fix/scale-down-multi-app-cleanup
branch
from
September 23, 2026 14:36
c404f77 to
576ac85
Compare
guicaulada
removed this pull request from stack #5468
September 23, 2026 14:39
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Quota attribution is missing for pre-installation lookups and failed GitHub requests.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Updates scale-down GitHub App selection, client caching, and quota attribution for multi-App cleanup workflows.
Changes:
- Re-selects Apps before cache lookup and scopes clients by App, runner type, and owner.
- Adds App-specific quota instrumentation.
- Adds tests for App reselection, client reuse, and attribution.
| File | Summary |
|---|---|
lambdas/functions/control-plane/src/scale-runners/scale-down.ts |
Updates client selection, caching, and quota hooks. |
lambdas/functions/control-plane/src/scale-runners/scale-down.test.ts |
Tests multi-App selection and quota attribution. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+57
to
+59
| octokit.hook.after('request', async (response) => { | ||
| await metricGitHubAppRateLimit(response.headers, appIdx); | ||
| }); |
Comment on lines
+57
to
+59
| octokit.hook.after('request', async (response) => { | ||
| await metricGitHubAppRateLimit(response.headers, appIdx); | ||
| }); |
This branch has not been deployed
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.

Scale-down caches an installation client by owner, so an invocation can keep using the first selected GitHub App even when additional Apps have available quota. Its runner-state response metrics also omit the selected App index and attribute quota to the primary App.
Re-evaluate App selection before cache lookup and key installation clients by App, runner type, and owner. Attach a response hook that reports quota and metrics for the App making each request, including paginated lookups and deletion. Subsequent cleanup operations can select another configured App while retaining client reuse within the correct scope.
Validation: 353 control-plane tests pass, including selection changes for the same owner, client reuse, and correct App attribution. Runtime TypeScript, ESLint, Prettier, Lambda bundle build, and diff checks pass. No live GitHub/AWS changes were performed.
This PR targets main and contains only client-selection and quota-attribution changes.