fix: prevent false positive 'Ready to merge' when CI hasn't fully registered (#1480) - #1490
Merged
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #1480
…istered Two root causes identified and fixed: 1. **Success path false positive (Case 2):** When fast external checks like CodeFactor register and pass before the main CI pipeline starts, getDetailedCIStatus returns 'success' prematurely. Fix: cross-validate 'success' status with GitHub Actions workflow runs API — if repo has PR-triggered workflows but no workflow runs exist yet, add ci_pending blocker instead of trusting the external checks. 2. **no_checks path false positive (Case 1):** Commit date != push date. Grace period check used commit age, but commits may be authored hours before being pushed (rebased branches, cherry-picks). Fix: when workflow files have PR/push triggers, always wait for workflow runs to appear regardless of commit age. Safety valve after 5 consecutive checks with zero workflow runs prevents infinite waiting for paths-ignore/conditional workflows. Includes: - Case study analysis with full logs in docs/case-studies/issue-1480/ - 21 unit tests covering both false positive scenarios, safety valves, and existing behavior preservation - All existing tests pass (63 total across related test suites) Fixes #1480 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ready to merge was posted as false positive
konard
marked this pull request as ready for review
March 28, 2026 23:16
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit d3478f7.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (3502KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
🔄 Auto-restart triggered (iteration 1)Reason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
Extract common assertion patterns into helper functions (assertHasBlocker, assertNoBlockers, assertBlockerCount, assertBlockerType) to bring code duplication below the 11% threshold. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (4087KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
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
Fixes #1480 —
Ready to mergewas posted as false positive in two distinct scenarios.Root Causes Identified
Case 1 (hive-mind PR #1479): The
no_checkspath used commit age as a proxy for push time. But commit date reflects authoring time, not push time — rebased/cherry-picked commits may be authored hours before being pushed. The grace period check concluded CI wasn't triggered when it just hadn't started yet.Case 2 (trees-rs PR #21): Fast external checks (CodeFactor) registered and passed before the main CI pipeline started.
getDetailedCIStatusreturnedstatus: 'success'because the only registered check was passing — but the main workflow hadn't started producing check-runs yet.Changes
src/solve.auto-merge.lib.mjs— Two fixes ingetMergeBlockers():New
successstatus cross-validation: When CI status issuccess, cross-validate with the GitHub Actions workflow runs API:in_progress/queued→ wait (more check-runs may appear)Fixed
no_checkspath: When workflows have PR/push triggers, always wait for workflow runs regardless of commit age (commit date ≠ push date). Safety valve after 5 consecutive checks with zero workflow runs to handle paths-ignore/conditional workflows.tests/test-false-positive-ci-success-1480.mjs— 21 unit tests covering:docs/case-studies/issue-1480/— Full case study with:Test Results
Ready to mergeas false positive #1363): all passing ✅--auto-restart-until-mergeableis stuck on no CI checks #1442): all passing ✅--auto-restart-until-mergeablestuck on no CI/CD checks #1345): all passing ✅This PR was generated by the AI issue solver