fix(relay-load): reuse an Asia load principal set for shards past the fourth (#27403)

Staging auth mints principal sets for shards 0-3, so the second hosted runner's shards 4-7 were
refused. Their hosts stay distinct by peer index; each set carries the same host count as the
proven 4 x 710 run.
This commit is contained in:
Jinwoo Hong
2026-10-11 03:05:10 -04:00
committed by GitHub
parent 5a0795a59b
commit c19e2dd363
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -50,10 +50,13 @@ export async function requestGitHubSmokeTokens(
}
}
// Staging auth mints Asia load principal sets for this many shards.
export const RELAY_ASIA_LOAD_PRINCIPAL_SHARDS = 4
function parseRelayAsiaLoadOptions(value) {
if (
!value || typeof value !== 'object' ||
!Number.isSafeInteger(value.shardIndex) || value.shardIndex < 0 || value.shardIndex > 3 ||
!Number.isSafeInteger(value.shardIndex) || value.shardIndex < 0 || value.shardIndex >= RELAY_ASIA_LOAD_PRINCIPAL_SHARDS ||
!Number.isSafeInteger(value.principalCount) || value.principalCount < 1 ||
value.principalCount > 32
) throw new Error('Relay Asia load principal request is invalid')
+4 -2
View File
@@ -3,7 +3,7 @@ import { readFileSync } from 'node:fs'
import { monitorEventLoopDelay } from 'node:perf_hooks'
import { setTimeout as delay } from 'node:timers/promises'
import { RelayLoadControlPeer } from './relay-load-control-peer.mjs'
import { requestGitHubSmokeTokens } from './github-smoke-token.mjs'
import { RELAY_ASIA_LOAD_PRINCIPAL_SHARDS, requestGitHubSmokeTokens } from './github-smoke-token.mjs'
import { relayLoadFailureReason } from './relay-load-connection-failure.mjs'
import {
assertRelayLoadDirectorCapacityToken,
@@ -164,7 +164,9 @@ if (!accessToken && !key.signingKey && process.env.ACTIONS_ID_TOKEN_REQUEST_URL
const loadOptions = config.relayAsiaLoadPrincipalCount > 0
? {
relayAsiaLoad: {
shardIndex: config.shardIndex,
// Staging auth mints principal sets for shards 0-3 only; shards past that (a second
// hosted runner) reuse a set, and their hosts stay distinct by peer index.
shardIndex: config.shardIndex % RELAY_ASIA_LOAD_PRINCIPAL_SHARDS,
principalCount: config.relayAsiaLoadPrincipalCount
}
}