Repository navigation
Reclaim our own offline registration instead of crashlooping on it - #154
Conversation
A container killed rather than stopped comes back under the same runner name and collides with the registration its previous incarnation left on GitHub, then crashloops. Six containers of the issue-worm-pro pool were doing exactly this after the host hit its commit limit. The name was assumed to be unique per process. It is not: entrypoint.sh is PID 1 (exec-form ENTRYPOINT, no init), so $$ is always 1, and $(hostname) is Config.Hostname, which a restart preserves. Only the comment claimed otherwise -- every runner name ends in "-1". The existing stale-cleanup block cannot cover this. Its GitHub-side removal is nested inside the remove-token call, so when minting that token fails -- which is what a starved host does -- nothing is removed there, yet .runner is deleted locally anyway. config.sh then registers under a name GitHub already knows. reclaim_orphaned_name() deletes a same-named registration only when GitHub reports it offline. Not --replace: replacing a live runner silently is worse than refusing to start, which is the stance the RUNNER_NAME comment already took. An online same-named runner is left alone and we still refuse, as before. Verified against the real API with the image and a mounted entrypoint: an offline orphan is reclaimed and the runner comes up; the unpatched entrypoint fails "A runner exists with the same name" (exit 1) in the same scenario; and a live same-named runner is left untouched while the second container refuses to start. Closes #153 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
GPT AI Code ReviewSkipped: API key not configured The To enable GPT reviews, add
Once the secret is configured, re-run this workflow or push a new commit to trigger a fresh review. REVIEW SKIPPED - API KEY NOT CONFIGURED Reviewed by GPT via gpt-pr-review.yml. Advisory only. |
DeepSeek AI Code Review1. Acceptance criteriaThe core AC — reclaim our own offline registration instead of crashlooping — is met. The new One gap: the issue's "Why the stale-cleanup path does not save it" section describes a second, independent bug — the 2. Bugs and logic errors
3. CLI and API safety
4. Test coverageNo tests are added. The reproduce steps in the issue (hard-kill, restart, observe crashloop) are the natural validation, but they are manual and require a live GitHub repo. Given this is a shell entrypoint with no existing test harness, that's understandable — but the two branches that matter ( 5. Suggested follow-up issues
APPROVE — the fix is correct and scoped to the AC; the Reviewed by DeepSeek via deepseek-pr-review.yml. Advisory only. |
Closes #153
The bug
A container killed rather than stopped comes back under the same runner name and collides with the registration its previous incarnation left on GitHub, then crashloops. Six containers of the
issue-worm-propool were doing exactly this after the host hit its commit limit:The name was assumed unique per process. It is not:
entrypoint.shis PID 1 (exec-formENTRYPOINT, no init), so$$is always1— every runner name on every host ends in-1.$(hostname)is the container'sConfig.Hostname, which a restart preserves.Only the comment claimed otherwise.
The existing stale-cleanup block cannot cover this. Its GitHub-side removal is nested inside the
remove-tokencall, so when minting that token fails — which is what a starved host does — nothing is removed there, yet.runneris deleted locally anyway.config.shthen registers under a name GitHub already knows.The fix
reclaim_orphaned_name()deletes a same-named registration only when GitHub reports itoffline.Deliberately not
--replace, preserving the stance theRUNNER_NAMEcomment already took: silently replacing a live runner is worse than refusing to start. An offline runner under our own exact name is by definition our own orphan. An online one is left alone and we still refuse, exactly as before.Also adds an
api_methodhelper for the GET/DELETE this needs, kept separate fromapi()so no existing token-minting POST can acquire a caller-supplied verb, and corrects the two comments that claimed names are regenerated per process.Verification
Tested against the real API by mounting the entrypoint over the existing image, so no rebuild was involved:
id 114), runner came up and listenedA runner exists with the same name, exit 1 — the controlPlus
bash -n, shellcheck clean across all six shell scripts (samekoalaman/shellcheckimage CI uses), andtests/pools_test.shat 107 checks passing.The negative control earned its keep: the first draft had a URL bug (
.../runners/?per_page=100, a stray slash) that made the listing 404 silently, so the reclaim never ran and the container recovered by luck. A failed listing is treated as "nothing to reclaim", which is why that failure mode is now called out in the comment.Known limitation
GitHub keeps a killed runner
onlinefor roughly a minute, and reclaim deliberately will not touch an online runner. A container restarting inside that window still collides once — butrestart: alwaysretries and recovers as soon as the status flips, rather than looping forever. Trading a bounded retry for never replacing a live runner seemed the right way round; happy to revisit if you would rather it waited for the status to settle.🤖 Generated with Claude Code