Skip to content

Controller deletes busy runners when a new listener session reports totalAssignedJobs=0; the busy-runner guard relies only on the service refusing RemoveRunner #4756

Backlog

Description

@jacob-ablowitz

Checks

Controller Version

0.14.1 (gha-runner-scale-set-controller and gha-runner-scale-set charts; the listener is built with actions/scaleset v0.3.0). The same broker errors also appeared at the same time on a second, older scale set running 0.8.1.

Deployment Method

Helm (through the Flux helm-controller)

Checks

  • This isn't a question or user support case (For Q&A and community support, go to Discussions).
  • I've read the Changelog before submitting this issue and I'm sure it's not due to any recently-introduced backward-incompatible changes

To Reproduce

Not reproducible on demand. The trigger is a broker-side failure. It happened on 2026-11-24 at about 03:01Z on one scale set and at 03:27Z on another; the same JWT 400 also hit the 0.8.1 scale set on 2026-11-18 at 03:01Z.

  1. Run a scale set with minRunners: 2, with several EphemeralRunners executing long jobs (8 busy runners in our case).
  2. The listener's GET https://broker.actions.githubusercontent.com/scalesets/message returns 400 Bad Request: required claims are missing from JWT: owner_id, runner_group_id, scale_set_id, session_id, labels. The listener exits.
  3. The controller recreates the listener. The new session's initial statistics report totalAssignedJobs=0, and the session has an empty message queue URL.
  4. The listener patches the EphemeralRunnerSet to replicas = minRunners. The controller removes the "idle" runners, and the service accepts RemoveRunner for runners that are running jobs.

Describe the bug

The controller deletes EphemeralRunners that are running jobs, and those jobs are cancelled. This happens when a freshly created listener session reports totalAssignedJobs=0 while runners are busy.

  • The only thing protecting a busy runner is the service refusing RemoveRunner. When the service's view is wrong, nothing on the controller side prevents the deletion.
  • For one of the deleted runners, the listener had logged Updating job info for the runner 75 minutes earlier.
  • An ordinary scale-down an hour before the incident tried to remove that same runner. The controller logged Runner is still running a job, skipping deletion (the service refused).
  • At 03:27:43Z the same call succeeded, and the job ended with The runner has received a shutdown signal / The operation was canceled.
  • Three running jobs were cancelled this way.

Separately, the new sessions had an empty message queue URL. The listener polled "" (Get "": unsupported protocol scheme "") and crash-looped at about 50 restarts a minute for about 3 minutes, until a session came back with correct statistics (totalAssignedJobs=10) and a valid URL.

Related: #4736, where the service accepts RemoveRunner for a busy runner during a controller upgrade. The trigger here is different: a listener restart after a broker error, and the runner already had job info recorded. actions/scaleset#145, which validates session responses, may cover the empty-URL loop.

Describe the expected behavior

  • The controller should not pick an EphemeralRunner that has job info recorded (status jobRequestId/jobId, or a job the listener saw start) as an idle scale-down candidate, whatever the service's statistics say. At minimum it should not do so right after a new session whose statistics drop sharply from the previous session's.
  • The listener should treat a session with an empty message queue URL as invalid and retry session creation with backoff, rather than polling "" and exiting.

Workaround we're using: while long jobs are in flight, we raise minRunners to at least the current runner count, so a zero-job target deletes nothing.

Additional Context

# gha-runner-scale-set values (relevant parts; everything else default)
minRunners: 2
maxRunners: 24
containerMode:
  type: dind
# GitHub App auth; scale set registered at repository level

Controller Logs

Excerpts below (names shortened). We have full logs for the window and can share them privately; we've also reported this to GitHub Support.

# listener
03:27:38 Application returned an error: failed to get message: request GET https://broker.actions.githubusercontent.com/scalesets/message?lastMessageId=100013948 failed(status="400 Bad Request"): unexpected status code 400 Bad Request: required claims are missing from JWT: owner_id, runner_group_id, scale_set_id, session_id, labels
# controller
03:27:39 AutoscalingListener  Listener pod is terminated  {"reason": "Error"}
03:27:41 AutoscalingListener  Created listener pod
# new listener
03:27:43 msg="Handling initial session statistics" component=listener totalAssignedJobs=0
03:27:43 msg="Calculated target runner count" component=worker "assigned job"=0 decision=2 min=2 max=24
03:27:43 msg="Preparing EphemeralRunnerSet update" json="{\"spec\":{\"patchID\":0,\"replicas\":2}}"
03:27:43 [DEBUG] GET
03:27:43 msg="Getting next message" component=listener lastMessageID=0
03:27:43 [ERR] GET  request failed: Get "": unsupported protocol scheme ""
# controller
03:27:43 EphemeralRunnerSet  Ephemeral runner counts  {"pending": 0, "running": 8, "finished": 0, "failed": 0, "deleting": 0}
03:27:43 EphemeralRunnerSet  Scaling comparison  {"current": 8, "desired": 2}
03:27:43 EphemeralRunnerSet  Deleting ephemeral runners (scale down)  {"count": 6}
03:27:43 EphemeralRunnerSet  Removing the idle ephemeral runner  {"name": "<set>-runner-b5t67"}
03:27:43 [DEBUG] DELETE https://broker.actions.githubusercontent.com/rest/_apis/distributedtask/pools/0/agents/350063?api-version=6.0-preview
03:27:43 EphemeralRunnerSet  Deleting ephemeral runner after removing from the service  {"name": "<set>-runner-b5t67", "runnerId": 350063}

# same runner, earlier the same day
02:13:32 (listener) msg="Updating job info for the runner" runnerName=<set>-runner-b5t67 jobDisplayName="<E2E job>"
02:19:41 (controller) EphemeralRunnerSet  Removing the idle ephemeral runner  {"name": "<set>-runner-b5t67"}
02:19:41 (controller) EphemeralRunnerSet  Runner is still running a job, skipping deletion  {"name": "<set>-runner-b5t67", "runnerId": 350063}

Runner Pod Logs

# job log on the deleted runner (runner pod itself was deleted by the controller)
2026-11-24T03:27:44Z ##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
2026-11-24T03:27:44Z ##[error]The operation was canceled.

Activity

  1. github-actions commented on Nov 24, 2026

    @github-actions
    Contributor

    Hello! Thank you for filing an issue.

    The maintainers will triage your issue shortly.

    In the meantime, please take a look at the troubleshooting guide for bug reports.

    If this is a feature request, please review our contribution guidelines.

  2. jacob-ablowitz commented on Nov 25, 2026

    @jacob-ablowitz
    Author

    Update: we found a configuration problem on our side that explains the controller-side half of this report.

    Our cluster still had the CRDs from an older 0.8.1 install, which another controller in the cluster still uses. Helm/Flux don't upgrade CRDs, so the 0.14.1 controller was running against schemas without EphemeralRunner.status.jobId and EphemeralRunnerSet.spec.patchID. The API server pruned both fields (Warning: unknown field "status.jobId" on every job-info patch, unknown field "spec.patchID" on every scale patch).

    As a result, HasJob() was always false, and every listener patch took the patchID == 0 scale-down path. That left RemoveRunner's JobStillRunning refusal as the only guard. So the "expected behavior" we asked for already exists in 0.14.1; it was disabled by our stale CRDs. Apologies for the noise on that part.

    Two things may still be worth your attention:

    1. The empty message-queue URL session, and the listener polling "" in a crash loop.
    2. The service accepted RemoveRunner for a runner that was mid-job. In a second event this happened about one second after a step completed, while the next step was about to start.

    A suggestion: the controller could warn at startup if the installed CRDs lack fields it depends on.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions