fix(github-runner): report GitHub App rate limit from registration token response - #5429
Open
tehlers320 wants to merge 1 commit into
Open
tehlers320 wants to merge 1 commit into
tehlers320 wants to merge 1 commit into
Conversation
…ken response getGithubRunnerRegistrationToken() (classic, non-JIT registration flow) never called metricGitHubAppRateLimit, unlike its JIT sibling three lines below it in createJitConfig(). This means metrics.enable + enable_github_app_rate_limit only ever surfaced rate-limit data for the isJobQueued check and JIT config generation - never for the actual createRegistrationTokenForOrg/ForRepo call, which is the one that mints the token every non-JIT runner registration depends on. No new API calls added: the GitHub response already carries x-ratelimit-remaining/x-ratelimit-limit headers on every request, this just reads and publishes what's already there. Adds coverage in scale-up.test.ts mirroring the existing "creates a token when maximum runners has not been reached" test.
tehlers320
marked this pull request as ready for review
September 14, 2026 18:14
Brend-Smits
approved these changes
Sep 17, 2026
Contributor
There was a problem hiding this comment.
Thanks for the PR!
Tested and it works 🚀
Please make sure to sign your commits so we can merge the PR @tehlers320
Brend-Smits
enabled auto-merge (squash)
September 17, 2026 14:00
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
`getGithubRunnerRegistrationToken()` (the classic, non-JIT registration flow) never called `metricGitHubAppRateLimit`, unlike its JIT sibling three lines below it in `createJitConfig()`. This means `metrics.enable` + `enable_github_app_rate_limit` only ever surfaced rate-limit data for the `isJobQueued` check and JIT config generation — never for the actual `createRegistrationTokenForOrg`/`ForRepo` call, which is the one every non-JIT runner registration depends on minting.
Change
One line, mirroring the existing JIT call site exactly:
```ts
metricGitHubAppRateLimit(registrationToken.headers, githubRunnerConfig.appIndex);
```
No new API calls — the GitHub response already carries `x-ratelimit-remaining`/`x-ratelimit-limit` headers on every request; this just reads and publishes what's already there.
Why this matters
Found this while root-causing a GitHub App installation rate-limit incident on a large self-hosted fleet running the classic (non-JIT) flow. With `ENABLE_METRIC_GITHUB_APP_RATE_LIMIT=true` but `ENABLE_JOB_QUEUED_CHECK=false` and `ENABLE_JIT_CONFIG=false` (both defaults for a fully ephemeral fleet that hasn't opted into either), the metric is a structurally dead flag — neither of its two call sites ever executes. This fix closes that gap for anyone on the classic flow.
Test plan
Marked draft while I confirm CLA/contribution requirements on my end — code and tests are complete and passing.