Repository navigation
fix(hooks): pre-job and cleanup exit 0 under the runner's bash -e - #35
Merged
Merged
Conversation
…s no @scope folder The runner runs the JOB_STARTED hook under bash -e. With no @scope folder in the bun cache, the unmatched glob reached find as a literal path, find exited 1, and every job on the runner failed before its first step. Glob with nullglob, end each sweep command in || true and the script in exit 0, and test the hook under bash -e. Co-Authored-By: Claude Opus 5.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.
Every job on the control runners has failed since today's slots release. In
Set up runner, the JOB_STARTED hook printed[pre-job] Previous job did not finish; sweeping…and exited 1.Cause. The runner runs the hook under
bash -e, whatever the script's shebang or its "not using set -e" comment say. When the bun cache has no@scopefolder,"$bun_cache"/@*/reachesfindas a literal path,findexits 1 (its stderr is discarded), and the hook aborts.Fix. Glob with
nullgloband only when the cache exists, end each sweep command in|| true, and end the script inexit 0. The header comment now says why.Test.
tests/pre-job.shruns the hook underbash -ewith no bun cache, with a cache that has no@scopefolder, and with leftovers to sweep. It fails on the old hook (2 checks) and passes on the new one.shellcheck -xis clean.Second commit:
cleanup.sh, same root cause. This answers the open question. The JOB_COMPLETED hook also runs underbash -e:~/.gradle/caches(every control runner, and any runner that never ran Gradle),findexits 1.cleanup.shthen aborts, and "Complete runner" fails the job even though every step passed.busyis left behind, so the next job takes the crash-recovery path.Since the slots release this failed jobs on control and regular runners: smart-irrigation, nis-suite, kodni-mobile, infrasensing-senslogging.
The fix:
busyis cleared first;|| true;cleanup || true.tests/cleanup.shruns the hook underbash -ewith and without a Gradle cache. It fails on the old hook (4 checks) and passes on the new one.🤖 Generated with Claude Code