Repository navigation
fix(bin): retry transient GitHub mergeability unknown - #6115
mehulbhagwani wants to merge 2 commits into
Conversation
|
| case "$UNKNOWN_RETRY_LIMIT" in | ||
| ''|*[!0-9]*) echo "error: FM_PR_MERGE_UNKNOWN_RETRIES must be a non-negative whole number" >&2; exit 2 ;; | ||
| esac | ||
| case "$UNKNOWN_RETRY_BACKOFF_SECS" in | ||
| ''|*[!0-9]*) echo "error: FM_PR_MERGE_UNKNOWN_BACKOFF_SECS must be a non-negative whole number" >&2; exit 2 ;; |
There was a problem hiding this comment.
Retry overrides have no ceiling A mistyped retry count or backoff value can keep the merge waiting for an effectively unbounded time. The process holds the task control lock throughout that wait, blocking the task’s watcher and teardown. Cap both values so an override cannot defeat the bounded-retry safeguard.
| expect_code 0 "$rc" "github-unknown-then-mergeable: UNKNOWN should retry and merge" | ||
| [ "$(cat "$case_dir/github-view-sequence-pos")" -eq 2 ] \ | ||
| || fail "github-unknown-then-mergeable: full verification did not rerun" | ||
| assert_logged_gh_merge "$case_dir" 81 example/repo --squash |
There was a problem hiding this comment.
Changing blockers remain untested This test confirms that verification runs again, but its draft state, checks, and away authority never change. It therefore cannot catch a regression that merges after one of those conditions becomes blocking during backoff. Add a case that changes a blocker between views and asserts that no merge occurs.
|
Speaking as Kun's firstmate: thank you @mehulbhagwani — really appreciate you taking the time on this. Closing as overlap: the same fix for #6020 already landed in #6110 (karotkriss), which was further along (CLEAN CI, live validation go, capped retry delay, re-check coverage for a check turning red mid-retry). Your tip also restores the UNKNOWN-retry path (and documents Contract-class: restore (same concrete |
Intent
do it
This is the fix PR for upstream issue #6020, "fm-pr-merge treats transient GitHub mergeable UNKNOWN as a terminal refusal". On 2026-09-28 the maintainer marked it ready-for-pr. Evidence on main: github_verify_mergeable in bin/fm-pr-merge.sh accepts only literal MERGEABLE; its caller runs it just before gh pr merge and exits on failure; there is no bounded backoff for UNKNOWN, so transient forge recalculation reads as a terminal unmergeable refusal. The fix is bounded backoff on UNKNOWN only; re-check all live conditions on each attempt, including head, draft, conflicts, checks, away-authority, and queue protections; after the bound, report pending, not unmergeable; do not weaken any other refusal. The PR must say "Fixes #6020". The implementation is committed on the feature branch and must be validated from that committed head. Open a new upstream PR with a MATCH attestation and include "Fixes #6020" in the PR body.
What Changed
github_verify_mergeableinbin/fm-pr-merge.shnow applies bounded backoff when GitHub reports mergeable stateUNKNOWNinstead of treating it as a terminal refusal, re-checking all live conditions (head, draft, conflicts, checks, away-authority, and queue protections) on each retry attempt.docs/configuration.mddocuments the new UNKNOWN-retry environment variables, andtests/fm-pr-merge.test.shadds coverage for the retry and pending-report behavior.Fixes #6020
🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is a narrowly-scoped bounded retry added only on the UNKNOWN mergeable status (return code 10), re-verifying every live pre-merge condition on each attempt exactly as intent requires, without weakening any other refusal path, and is covered by four new behavioral tests exercising the real script.
Testing
Code review confirms the fix adds github_verify_mergeable_with_retry() which retries only on live UNKNOWN status (returns 10), re-verifies all live conditions each attempt (draft/conflicts/checks/away-authority/queue), refuses immediately on any other refusal or a head-commit change mid-retry, and reports exit code 3 ("still pending") after exhausting FM_PR_MERGE_UNKNOWN_RETRIES rather than treating exhaustion as a terminal unmergeable refusal. Four new tests exercise these paths end-to-end against a mocked gh CLI with sequenced JSON fixtures, asserting real exit codes and gh call logs — this is genuine product-level behavior verification, not string matching. I could not get the full test file to finish executing within this turn's time budget, so I have no live pass/fail confirmation to report — reporting all scenarios as untested rather than guessing.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
Read git diff d5c2507a..62a8d9b8 for bin/fm-pr-merge.sh and tests/fm-pr-merge.test.shStartedbash tests/fm-pr-merge.test.sh(full suite) in background — still running at end of turn, no result captured✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.