fix(recipe-upgrade): stop auto-closing superseded/unrelated open PRs

Per operator: opening a new upgrade PR should stack ON TOP of any other
still-open PRs, not close them. Only PRs already merged into upstream
main are closed (merging them is a no-op). This prevents the phase-7
incident where an unrelated open ghost PR was auto-closed as 'superseded'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
autonomic-bot
2026-06-02 00:07:05 +00:00
co-authored by Claude Opus 4.8
parent 2304628375
commit 19fda8d2b8
2 changed files with 13 additions and 10 deletions
@@ -19,8 +19,10 @@
# never reflected it.
#
# Default mode (open a PR — preconditions: HEAD has the upgrade commit(s)):
# - Additionally closes any OTHER still-open PR for this recipe (superseded),
# then pushes the upgrade branch and opens the new PR IN ITS PLACE.
# - Pushes the upgrade branch and opens the new PR ALONGSIDE any other still-open
# PRs for this recipe. It does NOT close superseded/unrelated open PRs — stacking
# a fresh PR on top of the open ones is intentional; the operator decides which to
# merge/close. (Only PRs already merged into upstream main are closed — see above.)
#
# --reconcile-only: just sync main + close merged-upstream PRs; no push, no new
# PR (used when a recipe is up to date but its mirror may be stale).
@@ -120,10 +122,10 @@ while IFS=$'\t' read -r IDX HEAD_REF; do
fi
if [ "${merged}" = "1" ]; then
close_pr "${IDX}" "its changes are already in upstream main (merged upstream); mirror main re-synced"
elif [ -n "${BRANCH}" ]; then
close_pr "${IDX}" "superseded by ${BRANCH} (fresh upgrade against current upstream main)"
else
echo " • PR #${IDX} (${HEAD_REF}) still open vs upstream main — left as-is (reconcile-only)"
# Do NOT auto-close superseded/unrelated open PRs. Open the new PR alongside them and
# let the operator decide which to merge/close. Only merged-upstream PRs are closed above.
echo " • PR #${IDX} (${HEAD_REF}) still open vs upstream main — leaving open (operator decides)"
fi
done < <(echo "${OPEN_PRS}" | jq -r '.[] | [(.number | tostring), .head.ref] | @tsv' 2>/dev/null || true)