From 2778fa4ea518c428db758cc80f4d3690bd2565ca Mon Sep 17 00:00:00 2001 From: openhands Date: Fri, 13 Mar 2026 06:36:23 +0000 Subject: [PATCH] fix: detect merge conflicts in approved PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #649 sat blocked for hours — CI passed, review approved, but merge conflict from other PRs landing. Supervisor said 'all clear'. Now checks mergeable=false before CI state, alerts on conflict. --- factory/factory-poll.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/factory/factory-poll.sh b/factory/factory-poll.sh index 0442c17..3877f98 100755 --- a/factory/factory-poll.sh +++ b/factory/factory-poll.sh @@ -230,7 +230,11 @@ for pr in $OPEN_PRS; do CI_STATE=$(codeberg_api GET "/commits/${PR_SHA}/status" 2>/dev/null | jq -r '.state // "unknown"' 2>/dev/null || true) - if [ "$CI_STATE" = "failure" ] || [ "$CI_STATE" = "error" ]; then + # Check for merge conflicts first (approved + CI pass but unmergeable) + MERGEABLE=$(echo "$PR_JSON" | jq -r '.mergeable // true') + if [ "$MERGEABLE" = "false" ] && [ "$CI_STATE" = "success" ]; then + p3 "PR #${pr}: CI pass but merge conflict — needs rebase" + elif [ "$CI_STATE" = "failure" ] || [ "$CI_STATE" = "error" ]; then UPDATED=$(echo "$PR_JSON" | jq -r '.updated_at // ""') if [ -n "$UPDATED" ]; then UPDATED_EPOCH=$(date -d "$UPDATED" +%s 2>/dev/null || echo 0)