Skip to content

Report rate-limit headers for runner-registration failures #4732

Open

Description

@wadherv

Describe the bug
The runner configuration flow does not inspect or report GitHub API rate-limit response headers when obtaining tenant credentials from POST https://api.github.com/actions/runner-registration.

ConfigurationManager.GetTenantCredential(...) posts to this endpoint, captures only the HTTP status and X-GitHub-Request-Id, and prints the response body before calling EnsureSuccessStatusCode(). When GitHub returns an installation-scoped rate-limit error (for example, API rate limit exceeded for installation ID ...), the runner does not surface X-RateLimit-Remaining, X-RateLimit-Reset, resource/scope information, or Retry-After when present. It also retries transient failures without using server-provided retry guidance.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a self-hosted runner using an authentication flow that invokes GetTenantCredential(...).
  2. Cause POST https://api.github.com/actions/runner-registration to receive an installation-scoped rate-limit response.
  3. Observe the runner configuration output and diagnostic logs.

Expected behavior
For a rate-limited runner-registration response, the runner should identify the rate-limit condition and emit actionable, non-sensitive diagnostics, including the HTTP status, request ID, and available rate-limit/retry headers such as X-RateLimit-Remaining, X-RateLimit-Reset, X-RateLimit-Resource, and Retry-After.

If a retry delay is supplied by GitHub, the configuration flow should honor it rather than applying only its current randomized retry delay. The resulting failure message should clearly distinguish an installation/API rate limit from other 403 Forbidden errors.

Runner Version and Platform

v2.336.0

Observed in the current main implementation of src/Runner.Listener/Configuration/ConfigurationManager.cs.

OS of the machine running the runner? OSX/Windows/Linux/...

Not platform-specific; this occurs in the shared C# configuration code.

What's not working?

GetTenantCredential(...) creates the hosted URL as:

https://api.github.com/actions/runner-registration

and handles the response as follows:

var response = await httpClient.PostAsync(githubApiUrl, ...);
responseStatus = response.StatusCode;
var githubRequestId = UrlUtil.GetGitHubRequestId(response.Headers);

if (!response.IsSuccessStatusCode)
{
    var errorResponse = await response.Content.ReadAsStringAsync();
    _term.WriteError(errorResponse);
    response.EnsureSuccessStatusCode();
}

The path does not read GitHub API rate-limit headers. Consequently, a response body containing API rate limit exceeded for installation ID ... is logged, but the user is not told when the limit resets or whether a retry should be delayed.

Job Log Output

Not applicable. This occurs during runner configuration/registration authentication, before a job is run.

Runner and Worker's Diagnostic Logs

The configuration trace currently records the status and GitHub request ID for the request. It does not log rate-limit headers for this endpoint.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions