Skip to content

fix: prevent false positive 'Ready to merge' when CI hasn't fully registered (#1480) - #1490

Merged
konard merged 5 commits into
mainfrom
issue-1480-e2d9531f1751
Mar 29, 2026
Merged

fix: prevent false positive 'Ready to merge' when CI hasn't fully registered (#1480)#1490
konard merged 5 commits into
mainfrom
issue-1480-e2d9531f1751

Conversation

@konard

@konard konard commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1480Ready to merge was posted as false positive in two distinct scenarios.

Root Causes Identified

Case 1 (hive-mind PR #1479): The no_checks path 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. getDetailedCIStatus returned status: '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 in getMergeBlockers():

  1. New success status cross-validation: When CI status is success, cross-validate with the GitHub Actions workflow runs API:

    • If workflow runs exist but some are still in_progress/queued → wait (more check-runs may appear)
    • If no workflow runs exist but repo has PR-triggered workflows → wait (external checks are insufficient)
    • Safety valve: after 5 consecutive checks (~5 min), trust external checks
  2. Fixed no_checks path: 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:

  • Both false positive scenarios (Case 1 and Case 2)
  • Safety valve behavior (terminates after max checks)
  • Existing behavior preservation (genuine success, genuine no-CI, failures, etc.)
  • Mixed workflow run states

docs/case-studies/issue-1480/ — Full case study with:

  • Timeline reconstruction of both false positive incidents
  • Root cause analysis
  • Downloaded execution logs from both cases

Test Results


This PR was generated by the AI issue solver

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #1480
@konard konard self-assigned this Mar 28, 2026
…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>
@konard konard changed the title [WIP] Ready to merge was posted as false positive fix: prevent false positive 'Ready to merge' when CI hasn't fully registered (#1480) Mar 28, 2026
@konard
konard marked this pull request as ready for review March 28, 2026 23:16
konard and others added 2 commits March 28, 2026 23:17
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard

konard commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $9.911314
  • Calculated by Anthropic: $6.246569 USD
  • Difference: $-3.664745 (-36.98%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.6 (claude-opus-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (3502KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Mar 28, 2026

Copy link
Copy Markdown
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>
@konard

konard commented Mar 28, 2026

Copy link
Copy Markdown
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:

  • Public pricing estimate: $1.499512
  • Calculated by Anthropic: $0.910457 USD
  • Difference: $-0.589055 (-39.28%)

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.6 (claude-opus-4-6)

📎 Log file uploaded as Gist (4087KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard
konard merged commit 8f9136a into main Mar 29, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ready to merge was posted as false positive

1 participant