From c19e2dd363e55f211fafb9c2fc82d27d8f437ebb Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Sun, 11 Oct 2026 03:05:10 -0400 Subject: [PATCH] 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. --- cloud/dev/scripts/github-smoke-token.mjs | 5 ++++- cloud/dev/scripts/load-relay-controls.mjs | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cloud/dev/scripts/github-smoke-token.mjs b/cloud/dev/scripts/github-smoke-token.mjs index f0bd67c1024..af4c61fd52b 100644 --- a/cloud/dev/scripts/github-smoke-token.mjs +++ b/cloud/dev/scripts/github-smoke-token.mjs @@ -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') diff --git a/cloud/dev/scripts/load-relay-controls.mjs b/cloud/dev/scripts/load-relay-controls.mjs index be642bdbeb3..409f83d8f6e 100644 --- a/cloud/dev/scripts/load-relay-controls.mjs +++ b/cloud/dev/scripts/load-relay-controls.mjs @@ -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 } }