fix: Retry tests when build is still in progress instead of failing#973
Merged
fix: Retry tests when build is still in progress instead of failing#973
Conversation
This fixes a regression introduced in Phase 2 reliability improvements (PRs #943/#946) where tests would be permanently marked as failed when the GitHub Actions build hadn't completed yet. Previous behavior (before Dec 2025): - If artifact not found, just return silently - Test stays in "pending" state - Next cron cycle retries the test - Eventually build completes and test runs Regression behavior (after Phase 2): - If artifact not found, mark test as failed immediately - Test is permanently marked as "canceled" with ERROR status - No retry - test never runs even after build completes Fixed behavior (this PR): - Distinguish between retryable and permanent failures - Retryable: build in progress, workflow queued, diagnostic error - Permanent: build failed, artifact expired - Only mark as failed for permanent failures - Return silently for retryable failures (next cron cycle retries) Changes: - Modified _diagnose_missing_artifact() to return tuple (message, is_retryable) - Modified start_test() to check is_retryable before marking as failed - Added 8 comprehensive tests for retry behavior Fixes issue where Windows tests fail with "Build still in progress" when the cron job runs before the 40-minute Windows build completes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.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.



Summary
This PR fixes a critical regression introduced in the Phase 2 reliability improvements (PRs #943/#946) that causes tests to be permanently marked as failed when the GitHub Actions build hasn't completed yet.
The Problem
When a PR is opened, both the GitHub Actions build and the Sample Platform test are triggered. If the cron job picks up the test before the build completes (which can take up to 40 minutes for Windows builds), the test is marked as permanently failed instead of being retried later.
Real-world example: PR CCExtractor/ccextractor#1896:
Root Cause Analysis
Previous behavior (before December 2025):
Regression behavior (after Phase 2 fixes):
The Fix
Modified
_diagnose_missing_artifact()to return a tuple indicating whether the failure is retryable:in_progress,queued)failure,cancelled)Fixed behavior:
Files Changed
mod_ci/controllers.py_diagnose_missing_artifact()to return(message, is_retryable)tuple; Updatedstart_test()to handle retryable vs permanent failurestests/test_ci/test_controllers.pyTest Coverage
New Tests Added
TestDiagnoseMissingArtifactclass (6 tests):test_build_in_progress_is_retryable- Build with statusin_progressreturnsis_retryable=Truetest_build_queued_is_retryable- Build with statusqueuedreturnsis_retryable=Truetest_build_failed_is_not_retryable- Build with conclusionfailurereturnsis_retryable=Falsetest_artifact_expired_is_not_retryable- Successful build with missing artifact returnsis_retryable=Falsetest_no_workflow_run_is_retryable- No workflow run found returnsis_retryable=Truetest_diagnostic_exception_is_retryable- API errors default tois_retryable=True(safe default)TestStartTestRetryBehaviorclass (2 tests):test_retryable_failure_does_not_mark_test_failed- Verifiesmark_test_failed()is NOT called for retryable failurestest_permanent_failure_marks_test_failed- Verifiesmark_test_failed()IS called for permanent failuresTest Results
How to Verify
Before This Fix
After This Fix
"Test {id}: Build still in progress: ... Will retry when build completes."Manual Verification
After deploying, monitor logs for:
This indicates the retry logic is working correctly.
Deployment Notes
Related Issues
🤖 Generated with Claude Code