fix: validate persisted runner registration before reusing it - #77
Merged
Conversation
The upstream myoung34 entrypoint reuses CONFIGURED_ACTIONS_RUNNER_FILES_DIR credentials unconditionally: if .runner exists it skips registration with no validation and no fallback. When the runner has been removed server-side (GitHub prunes runners offline >14 days, manual deletion, etc), the stored credentials are dead and the container crash-loops forever — even though a valid ACCESS_TOKEN is sitting in the environment the whole time. Add a preflight entrypoint that asks GitHub whether the persisted agentId still exists. Only a definitive 404 wipes the persisted registration, letting the upstream entrypoint fall through to fresh ACCESS_TOKEN registration and store the new credentials back. Transient errors, missing env, or unparseable state leave everything untouched, so behavior is never worse than upstream. Declaring ENTRYPOINT resets the CMD inherited from the base image, so the base CMD is restated verbatim. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a preflight wrapper entrypoint to validate (via GitHub API) whether a persisted runner registration is still valid before the upstream entrypoint reuses it, preventing crash-loops caused by stale .runner credentials and enabling automatic re-registration when the runner was deleted/pruned server-side.
Changes:
- Introduces
preflight-entrypoint.shto detect persisted registrations, query runner existence (org/repo scopes), and wipe persisted credentials only on definitive 404s. - Updates
Dockerfileto install the preflight entrypoint as the imageENTRYPOINTand restate the base imageCMD.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| preflight-entrypoint.sh | Adds a startup preflight that validates persisted runner registrations and wipes dead credentials on HTTP 404 to allow fresh registration. |
| Dockerfile | Switches to the preflight entrypoint and reasserts the base CMD so runtime behavior remains consistent aside from the preflight. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
The upstream myoung34 entrypoint reuses
CONFIGURED_ACTIONS_RUNNER_FILES_DIRcredentials unconditionally — if.runnerexists it skips registration entirely, with no validation and no fallback. When the runner has meanwhile been removed server-side (GitHub prunes runners offline >14 days; manual deletion), the stored credentials are dead and the container crash-loops forever, even though a validACCESS_TOKENis in the environment the whole time.This is the failure mode that has repeatedly taken down the Bump CI runners after image updates: container recreation → stale persisted registration → restart loop until someone wipes the volume or redeploys by hand.
Fix
A thin preflight entrypoint that runs before the upstream one:
CONFIGURED_ACTIONS_RUNNER_FILES_DIRis set,.runnerexists, andACCESS_TOKENis present.agentIdfrom the persisted.runner(BOM-tolerant) and asks GitHub whether that runner still exists (org and repo scopes; enterprise left as-is)..runner/.credentials/.credentials_rsaparamsfrom the persist dir, so the upstream entrypoint falls through to freshACCESS_TOKENregistration and stores the new credentials back.Declaring
ENTRYPOINTresets the base image's inheritedCMD, so the baseCMDis restated verbatim.Testing
bash -n+ shellcheck clean.ACCESS_TOKENno-ops, repo-scope URL parsing verified, args pass through to the parent CMD.🤖 Generated with Claude Code