fix: mark parent job failed when build times out or is manually cleared - #98
Conversation
When cleanUpBuildsThatDidntReportBack marks a build as failed after the 6-hour GitHub Actions timeout, or manualCleanUp marks a build as failed, the parent job was left in its current state (typically inProgress). The Ingeminator only processes jobs in "failed" status, so these builds were never retried. Worse, with maxConcurrentJobs=9 the ghost-inProgress jobs consumed all queue capacity, blocking all 53 created jobs from being scheduled. Three-part fix: - cleanUpBuildsThatDidntReportBack: call markFailureForJob after marking build as failed so the Ingeminator picks it up next cycle - manualCleanUp: same fix for the manual path - transitionStaleInProgressJobsToFailed: new cleaner step that detects active jobs where all builds have settled (none are started) and transitions them to failed, recovering capacity for builds already stuck Adds CiBuilds.hasAnyStartedBuildsForJob to support the new step. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR adds job failure marking across build cleanup operations. A new query method checks for started builds, enabling detection of stale in-progress jobs with no remaining builds. These jobs are now transitioned to failed status. Additionally, existing cleanup methods ( ChangesJob Failure Marking in Build Cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
functions/src/logic/buildQueue/cleaner.tsOops! Something went wrong! :( ESLint: 10.3.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by functions/src/model/ciBuilds.tsOops! Something went wrong! :( ESLint: 10.3.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by 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 |
Summary
cleanUpBuildsThatDidntReportBackmarks a buildfailedafter the 6-hour GitHub Actions timeout but never calledmarkFailureForJob, leaving the parent job stuck ininProgressmanualCleanUpmaxConcurrentJobs=9, these ghost-inProgress jobs consumed all queue capacity — confirmed as the cause of the current blockage where 9 inProgress jobs with 9 failed builds were holding 53 created jobs from schedulingThree-part fix:
cleanUpBuildsThatDidntReportBack— callmarkFailureForJobafter marking build as failed so the Ingeminator picks it up next cron cyclemanualCleanUp— same fix for the manual pathtransitionStaleInProgressJobsToFailed— new cleaner step that detects active jobs where all builds have settled (none arestarted) and transitions them tofailed, unblocking capacity for jobs already stuck before this deployAdds
CiBuilds.hasAnyStartedBuildsForJobto support the new cleaner step.Why it wasn't caught by PR #97
requeueActiveJobsWithoutBuilds(added in #97) only fires for jobs with no build records at all. The stuck jobs had build records — just failed ones — so they fell through every existing self-healing path.Test plan
yarn typecheck)failedon the next cleaner runcreatededitor jobs begin scheduling once capacity is freedfailed, and Ingeminator retries on the next cycle🤖 Generated with Claude Code
Summary by CodeRabbit