Skip to content

fix(pool): count registered offline runners within boot time - #5487

Open
shinharaguchi wants to merge 2 commits into
github-aws-runners:mainfrom
shinharaguchi:fix/pool-count-booting-offline-runners
Open

shinharaguchi wants to merge 2 commits into
github-aws-runners:mainfrom
shinharaguchi:fix/pool-count-booting-offline-runners

Conversation

@shinharaguchi

@shinharaguchi shinharaguchi commented Sep 28, 2026 •

Copy link
Copy Markdown

Description

A registered runner that is offline and not busy is now counted by the pool while it is within RUNNER_BOOT_TIME_IN_MINUTES. Today the pool skips the boot time check for any registered runner that is not online and idle, so a frequently running pool can launch extra instances while the first runner is still starting.

Root cause

With JIT config, the runner is registered in GitHub right after the EC2 instance is launched, before its agent connects. The example response of the JIT configuration endpoint and the observation in #3799 show such a runner as { busy: false, status: "offline" }.

countAvailableEc2PoolRunners treats a runner as booting only when it is not in the GitHub status map. A registered offline runner falls into the "not idle in GitHub and NOT counted" branch instead.

Change

Registered offline runners that are not busy get their own branch: counted while within the boot time, not counted after it. Online idle runners, busy runners and unregistered runners keep their existing handling. The check is based on runner status, so it also applies to non-JIT runners reported as offline within their boot time.

Logs

Pool size one, running every minute (instance IDs anonymised):

12:28:44 [pool] The pool will be topped up with 1 runners.
12:28:46 [pool] Created instance(s): i-aaaa
12:29:44 [pool] The pool will be topped up with 1 runners.
12:29:46 [pool] Created instance(s): i-bbbb
12:30:44 [pool] The pool will be topped up with 1 runners.
12:30:46 [pool] Created instance(s): i-cccc
12:31:44 [pool] The pool will be topped up with 1 runners.
12:31:46 [pool] Created instance(s): i-dddd
12:32:44 [pool] Pool will not be topped up. Found 1 managed idle runners.
12:35:24 [scale-down] Runner 'i-bbbb' will be kept idle.
12:35:25 [scale-down] AWS runner instance 'i-aaaa' is terminated and GitHub runner is de-registered.

Test Plan

  • Added counts registered offline runners that are still booting. It fails on main and passes with this change.
  • Split does not count registered busy or offline runners into a busy case and an expired offline case, and added an offline busy case.
  • Ran yarn format, yarn lint, yarn test and yarn build in lambdas/. All passed.

Related Issues

Related #3799
Related #3809

With JIT config the runner is registered in GitHub before the agent on the
instance connects, so it can be reported as offline while it is still
booting. The pool counted a runner as booting only when it was not
registered yet, so such a runner was excluded without checking its boot
time, and a frequently running pool could launch extra instances.

Count a registered runner that is offline and not busy while it is within
its boot time. Offline runners that are busy, have no busy value, or whose
boot time has expired are still excluded.

Related github-aws-runners#3799
@shinharaguchi
shinharaguchi requested a review from a team as a code owner September 28, 2026 08:15
Move the check for registered offline runners that are not busy into its
own branch instead of excluding them from the "not idle" branch with a
negated flag. Behaviour is unchanged.

Drop the test case for a runner status without a busy value, since
RunnerStatus.busy is required and the case could only be built with a
type cast.
@shinharaguchi shinharaguchi changed the title fix(pool): count JIT-registered offline runners that are still booting fix(pool): count registered offline runners within boot time Sep 28, 2026
@edersonbrilhante

Copy link
Copy Markdown
Contributor

@shinharaguchi we need your commits to be signed, so it can be merged

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants