fix: don't treat UNSTABLE merge state as blocker when CI is pending#126
Open
AgentWrapper wants to merge 5 commits intomainfrom
Open
fix: don't treat UNSTABLE merge state as blocker when CI is pending#126AgentWrapper wants to merge 5 commits intomainfrom
AgentWrapper wants to merge 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
GitHub's mergeStateStatus: UNSTABLE means required status checks exist but aren't all passing — it doesn't distinguish between pending and failing. Previously we unconditionally added "Required checks are failing" as a blocker, which made the dashboard show PRs as unmergeable while CI was still running. Now cross-references UNSTABLE with the actual ciStatus: only adds the blocker when CI is genuinely failing, not when checks are still pending. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous check (ciStatus === FAILING) left a gap: when ciStatus is "none" (all checks skipped) but GitHub says UNSTABLE, neither section added a blocker — false positive "mergeable". Flipped to ciStatus !== PENDING so we only suppress the UNSTABLE blocker for the one case where it's misleading (checks still running). Added test for UNSTABLE + skipped-only checks to cover the fail-closed edge case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead of checking ciStatus !== PENDING (which still adds a redundant "Required checks are failing" alongside "CI is failing"), gate on ciPassing — the UNSTABLE blocker now only fires when the CI section didn't already report the problem. This eliminates duplicate blockers while preserving the fail-closed safety net for edge cases (e.g. all checks skipped but GitHub reports UNSTABLE). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Trimmed the 7-line UNSTABLE comment to 3 lines. Replaced toContain + not.toContain pairs with toEqual([...]) so tests pin the exact blocker list — no unexpected extras can sneak in undetected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d2b5037 to
ca45d42
Compare
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
GitHub's
mergeStateStatus: UNSTABLEmeans required status checks exist but aren't all passing. Previously we unconditionally added "Required checks are failing" as a blocker, which caused two problems:Fix: Gate the UNSTABLE blocker on
ciPassing— it only fires when the CI section didn't already report the problem. This is also the fail-closed safety net for edge cases where our CI aggregation says "none" (all skipped) but GitHub still reports UNSTABLE.Blocker matrix after fix
Test plan
reports CI failures as blockers— UNSTABLE + FAILURE: only "CI is failing", no duplicatefalls back to CI failing when CI fetch fails— UNSTABLE + error: only "CI is failing"does not treat UNSTABLE as a blocker when CI is pending— UNSTABLE + PENDING: only "CI is pending"reports UNSTABLE as blocker when CI status is none (fail closed)— UNSTABLE + SKIPPED: "Required checks are failing"🤖 Generated with Claude Code