Skip to content

fix: wipe migrated config files too when clearing dead registrations - #78

Merged
compscidr merged 1 commit into
mainfrom
fix/preflight-wipe-migrated-config
Aug 11, 2026
Merged

fix: wipe migrated config files too when clearing dead registrations#78
compscidr merged 1 commit into
mainfrom
fix/preflight-wipe-migrated-config

Conversation

@compscidr

Copy link
Copy Markdown
Owner

Problem

bump-android-nas.local got stuck in an unrecoverable crash loop after the runner registration it had persisted (agentId=1891) was pruned server-side by GitHub while the host was offline.

The preflight from #77 correctly detected the 404 and wiped .runner, .credentials, and .credentials_rsaparams — but the persist dir also held a .runner_migrated (written by the runner's broker migration), which the wipe doesn't know about. The runner's IsConfigured() treats the migrated file as a valid config (ConfigurationStore.cs):

bool configured = new FileInfo(_configFilePath).Exists || new FileInfo(_migratedConfigFilePath).Exists;

So config.sh refused to register ("already configured") while run.sh crashed loading the missing .runner (Value cannot be null. (Parameter 'configuredSettings')) — looping forever. The preflight can't recover either, since it gates on .runner existing.

Fix

  • The wipe now also removes .runner_migrated and .credentials_migrated (IsConfigured()/HasCredentials() treat them as equivalent to the primary files).
  • The wipe also cleans the same files from /actions-runner: the container's writable layer survives restarts, and the upstream entrypoint's persist-back step re-seeds the persist dir from it (observed live — deleting the file from the volume alone got it immediately re-created on the next loop iteration).
  • A preflight pass heals the already-wedged state (.runner_migrated present without .runner) left behind by images with the old wipe, so affected hosts recover on their own once they pull this image.

Testing

  • bash -n + shellcheck clean.
  • Script-level test of the three paths: wedged state gets healed, empty persist dir is a no-op, healthy .runner without ACCESS_TOKEN is left untouched.
  • The equivalent manual cleanup (removing .runner_migrated from both the volume and /actions-runner) unstuck the real crash-looping runner on nas.local, which registered fresh and immediately picked up a job.

🤖 Generated with Claude Code

The 404 wipe removed .runner/.credentials/.credentials_rsaparams but left
.runner_migrated behind. The runner's IsConfigured() treats .runner_migrated
as a valid config (ConfigurationStore.cs checks either file), so config.sh
refused to re-register while run.sh crashed loading the missing .runner
("Value cannot be null. (Parameter 'configuredSettings')") — an unrecoverable
crash loop, observed on bump-android-nas.local after GitHub pruned its
registration during a long offline stretch.

Wipes now cover the migrated files, clean /actions-runner as well (the
writable layer survives restarts and the upstream persist-back step re-seeds
the persist dir from it), and a preflight pass heals the already-wedged
orphaned-.runner_migrated state left by older images.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 11, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the runner-registration preflight so it can recover from a “wedged” state caused by GitHub Actions runner broker migration files (.runner_migrated / .credentials_migrated) surviving a registration wipe, which can otherwise block re-registration while still causing run.sh to crash-loop.

Changes:

  • Add a centralized wipe_registration() helper that removes both primary and migrated config/credential files.
  • Extend wipe behavior to also remove the same files from /actions-runner to prevent the upstream persist-back step from re-seeding the volume.
  • Add a preflight healing step that detects and fixes the specific orphaned migrated-config state (.runner_migrated present without .runner).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@compscidr
compscidr merged commit e0494f7 into main Aug 11, 2026
10 checks passed
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.

2 participants