Repository navigation
Rebuild the listener when its runner scale set is gone from the Actions service - #4740
Open
sebdanielsson wants to merge 3 commits into
Open
sebdanielsson wants to merge 3 commits into
sebdanielsson wants to merge 3 commits into
Conversation
…ns service A listener whose runner scale set was deleted on the Actions service side crash-loops forever: the scale set ID is part of the AutoscalingListener spec, so every replacement pod fails session creation with the same 404, and the re-registration added in actions#4571 only runs when the listener has to be created. The listener now exits with a dedicated code when session creation returns not-found. The AutoscalingListener controller deletes the listener instead of only its pod when it sees that code, which routes recovery through the existing AutoscalingRunnerSet path: confirm the scale set is gone, register it again, re-point the EphemeralRunnerSet, and build a listener with the new ID. Fixes actions#4370 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NZ5218pW65sD2NiDqjXYLQ
sebdanielsson
requested review from
a team,
Steve-Glass,
mumoshu,
nikola-jokic,
rentziass and
toast-gear
as code owners
November 9, 2026 20:07
The scaleset client refreshes its admin token inside session creation, so a 404 from the registration-token or runner-registration endpoints also surfaced as scaleset.NotFoundError. Lost repository access or a renamed repository would then tear down and rebuild the whole listener on every crash. Require the Actions exception name as well, and test the classification against the real client over HTTP. When re-registration resolves the same ID that was reported missing, the annotation patch is a no-op and nothing would bring the reconciler back to create the listener. Create it in the same reconcile instead. Add an end-to-end spec that runs both reconcilers, covering the hand-off through the listener finalizer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NZ5218pW65sD2NiDqjXYLQ
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NZ5218pW65sD2NiDqjXYLQ
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4370.
Problem
#4571 made the controller re-register a runner scale set that is gone from the Actions service, but only when the
AutoscalingListenerhas to be created. A listener that is already running when its scale set disappears (deleted from the org settings, or dropped server-side as described in this comment on #4370) is never healed:AutoscalingListenerspec, so every replacement pod failscreateMessageSessionwithRunnerScaleSetNotFoundExceptionand exits;AutoscalingRunnerSet, so its controller never revisits the ID.Today the only way out is deleting the
AutoscalingListenerby hand.Fix
scaleset.NotFoundErrorand the Actions exception isRunnerScaleSetNotFoundException, exit with a dedicated code (ExitCodeRunnerScaleSetNotFound = 3, defined incmd/ghalistener/confignext to the rest of the controller/listener contract). Every other failure still exits1.NotFoundError, but says nothing about the scale set.AgentNotFoundExceptionand friends.AutoscalingListenerinstead of only its pod. Recovery then goes through the existing path: theAutoscalingRunnerSetcontroller sees the listener is gone, callsrunnerScaleSetGone, re-registers the scale set, re-points theEphemeralRunnerSetwith a bumpedActionableRevision, and builds a listener with the new ID.runnerScaleSetGonejust reported missing (the lookups by ID and by name disagree), the annotation patch is a no-op and nothing would bring the reconciler back to create the listener. It now creates the listener in the same reconcile instead of stalling with no listener at all.Notes
1as before, and an older controller treats exit code3as any other failure and recreates the pod.masterby listener spec drift detection. This PR closes the remaining out-of-band deletion case.restartPolicyrestarts the container in place, which the existing dead-pod handling does not see either.runnerScaleSetGonestill treats anyNotFoundErroras gone, so a token-refresh 404 in the controller logs a misleading "no longer exists". It does no harm (the lookups increateRunnerScaleSetfail on the same 404 and back off), and tightening it needs knowing what bodyGetRunnerScaleSetByIDreturns for a missing scale set.Tests
cmd/ghalistener:TestExitCodeFromSessionCreationdrives the real scaleset client against anhttptestserver. ARunnerScaleSetNotFoundExceptionfrom the sessions endpoint exits3; a 404 from the registration-token endpoint exits1. The second case fails with the earlier not-found-only check.TestExitCodecovers other session failures, a not-found outside session creation, and a generic error.autoscalinglistener_controller_test.go: a listener pod terminated withExitCodeRunnerScaleSetNotFoundleads to theAutoscalingListenerbeing deleted.autoscalingrunnerset_listener_recovery_test.go: runs both reconcilers on one manager and checks the full chain, through the listener finalizer: the scale set is re-registered, theEphemeralRunnerSetand a new listener use the new ID, and the listener gets a pod. It fails againstmaster's listener controller.autoscalingrunnerset_controller_test.go: when the lookup by name resolves the ID that was reported missing, the listener is created with it and no second scale set is registered. It fails without the controller change.go test ./cmd/ghalistener/... ./controllers/actions.github.com/...passes locally (envtest k8s 1.37.0), andgolangci-lintv2.15.0 reports no issues.🤖 Generated with Claude Code
https://claude.ai/code/session_01NZ5218pW65sD2NiDqjXYLQ