Skip to content

fix(scale-down): don't let busy runners use idle slots - #5566

Open
sarankumar1325 wants to merge 1 commit into
github-aws-runners:mainfrom
sarankumar1325:fix/scale-down-busy-idle-slot
Open

sarankumar1325 wants to merge 1 commit into
github-aws-runners:mainfrom
sarankumar1325:fix/scale-down-busy-idle-slot

Conversation

@sarankumar1325

Copy link
Copy Markdown

Description

In evaluateAndRemoveRunners, a runner that has passed its minimum running time is counted against idleCount before we know whether it is busy. A busy runner is never removed (removeRunner checks the busy state again before deregistering), so it ends up taking an idle slot without being kept as an idle runner. The warm pool is then one short, and an idle runner further down the list gets terminated.

This change only lets an idle runner fill an idle slot. The busy state comes from the GitHub runner list that is already fetched for that instance, so it adds no API calls. Busy runners still go through removeRunner, which keeps them as before.

Fixes #5564

Test Plan

  • Added Should not let a busy runner use an idle slot to the When idle config defined suite (runs for both eviction strategies). With idleCount: 1, one busy runner and one idle runner, the idle runner is kept and nothing is terminated. The test fails on main and passes with this change.
  • yarn vitest run in lambdas/functions/control-plane: 15 files, 501 tests pass.
  • eslint, prettier --check and tsc --noEmit are clean on the changed files.

Note: #5536 also touches scale-down.ts, but it deals with re-reading the busy state before deregistering, which is a separate problem. If one is merged first, the other may need a small rebase.

Related Issues


I used an AI assistant to help write this change. I reviewed and tested it myself.

A busy runner was counted against idleCount before the busy check in
removeRunner, so it consumed an idle slot without being kept as idle.
That left the warm pool short and terminated an idle runner further
down the list. Only count idle runners against idleCount.

Fixes github-aws-runners#5564
@sarankumar1325
sarankumar1325 requested a review from a team as a code owner October 30, 2026 13:54

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.

scale-down: idle_config idleCount is used up by busy runners

1 participant