Delete stale AutoscalingListeners left behind by a naming change #4657
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 360 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.352
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4657"
general
weight: 0.35
KR-Ravindra
Problem
Fixes https://github.com/actions/actions-runner-controller/issues/4629
Upgrading the controller in place across 0.13.x -> 0.14.x leaves two
AutoscalingListenerobjects perAutoscalingRunnerSet: the new one, and the pre-upgrade one whose pod crash-loops forever withRunnerScaleSetNotFoundExceptionbecause it still carries the oldrunnerScaleSetId. Nothing ever deletes it.Root cause
scaleSetListenerName(controllers/actions.github.com/resourcebuilder.go:990) embeds a hash whose inputs changed in 0.14.0 (https://github.com/actions/actions-runner-controller/pull/4299):hash(namespace)becamehash(namespace, runnerGroup, gitHubConfigUrl). TheAutoscalingRunnerSetreconciler finds its listener only by a singleGeton that derived name (autoscalingrunnerset_controller.go, the listener lookup beforecreateAutoScalingListenerForRunnerSet). After the upgrade theGetmisses the existing listener, so a new one is created and the old one is orphaned. It lives in the controller namespace, so it has no owner reference and is not garbage collected, and the listener reconciler only deletes a listener when itsAutoscalingRunnerSetis gone.Fix
Before the by-name lookup, list the listeners in the controller namespace that carry the scale set identity labels (
actions.github.com/scale-set-nameandactions.github.com/scale-set-namespace, stamped on every listener since at least 0.12) and delete any whose name is not the derived one. A reconcile then converges back to exactly one listener perAutoscalingRunnerSet. Thelistverb is already granted to the manager role, and the reconciler already watchesAutoscalingListenerevents.How tested
New envtest case in
autoscalingrunnerset_controller_test.go: a listener namedtest-asrs-deadbeef-listenerwith the identity labels and a spec pointing at the scale set exists before theAutoscalingRunnerSetis created; the test asserts exactly one listener remains and it is the derived one.Before:
After:
gofmt,go vetandgolangci-lint run(v2.11.2) are clean.Links
This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.