From 922376df4b2f69d32754b0ed6e41ee77b1037ed8 Mon Sep 17 00:00:00 2001 From: Danathar Date: Sat, 7 Nov 2026 11:43:13 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(stage-labels):=20a=20merge-g?= =?UTF-8?q?uard=20refusal=20no=20longer=20moves=20a=20parked=20085=20PR=20?= =?UTF-8?q?to=20080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit projectbluefin/utah-packages#917 (fork PR, approve verdict, fork-guarded red required Canary, head 7e52182c0 unchanged) went 085 -> 080 -> 085 about 15 times on 2026-11-07. Each 080 came from a contributor-lane pass refused the destination-merge lock ("destination merge already in progress", another sweep was evaluating a PR into the same base). The lane records that as base-refresh:merge-guard with the error, so the observation is Err, and ClassifyStage's errored-lane branch ran before the hand-off check that #16819 added: approve verdict + no CI reason = a weak 080. The 080 seated the red PR at a merge train's front until the next evaluated pass. The refusal is now no stage opinion whether or not the lane reports an error. The reversal guard (#16881) and the dampener (#16980) on v6 tip do not stop this shape: the replay test fails on tip at the first refusal. Also corrects two stale derive_pr_classify.go citations in the stage-engine docs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- changelog.d/fixed-merge-guard-stage-flap.md | 1 + src/docs/adr/0025-central-stage-engine.md | 4 +- .../stage-labels.md | 2 +- src/docs/stage-engine-plan.md | 4 +- .../automerge_stage_merge_guard_err_test.go | 97 +++++++++++++++++++ src/pkg/stageengine/derive_pr_classify.go | 8 ++ 6 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 changelog.d/fixed-merge-guard-stage-flap.md create mode 100644 src/pkg/github/automerge/automerge_stage_merge_guard_err_test.go diff --git a/changelog.d/fixed-merge-guard-stage-flap.md b/changelog.d/fixed-merge-guard-stage-flap.md new file mode 100644 index 0000000000..58be9c1b12 --- /dev/null +++ b/changelog.d/fixed-merge-guard-stage-flap.md @@ -0,0 +1 @@ +- A PR parked at 085 on a red check no longer flips to 080 whenever a contributor-lane pass is refused the destination-merge lock. The lane reports that refusal (`base-refresh:merge-guard`, "destination merge already in progress") together with its error, and the classifier's errored-lane branch ran first: an approved head read as a weak 080, which replaced the standing 085 and seated the red PR at the front of a merge train until the next evaluated pass put it back (projectbluefin/utah-packages#917, about 15 round trips on one head). The refusal is now no stage opinion, error or not. diff --git a/src/docs/adr/0025-central-stage-engine.md b/src/docs/adr/0025-central-stage-engine.md index 4e55ca7623..b2fc7466b2 100644 --- a/src/docs/adr/0025-central-stage-engine.md +++ b/src/docs/adr/0025-central-stage-engine.md @@ -55,11 +55,11 @@ hub read that store and nothing else (`stageStoreOrShared`, (`src/pkg/github/automerge/automerge_stage_labels.go:365`), observations are sorted by `stageLanePrecedence` (self 3 > trusted 2 > contributor 1, `src/pkg/github/automerge/automerge_stage_labels.go:177`), each is classified - by `ClassifyStage` (`src/pkg/stageengine/derive_pr_classify.go:261`) + by `ClassifyStage` (`src/pkg/stageengine/derive_pr_classify.go:342`) into a ranked opinion (`prstage.RankNone..prstage.RankOwned`, `src/pkg/stageengine/prstage/types.go:145-148`), and `ResolveStage` picks the winner - (`src/pkg/stageengine/derive_pr_classify.go:454`). These PR helpers now + (`src/pkg/stageengine/derive_pr_classify.go:718`). These PR helpers now live in the engine (#13779); automerge keeps only gathering-side previews. Shared concepts — parking (045/085, `needs-human`, hold labels), author kind (070/071/072), adoption (074), terminal states, `origin/*` — are modelled twice with diff --git a/src/docs/labels-and-control-signals/stage-labels.md b/src/docs/labels-and-control-signals/stage-labels.md index c12b841d9e..71cb59f359 100644 --- a/src/docs/labels-and-control-signals/stage-labels.md +++ b/src/docs/labels-and-control-signals/stage-labels.md @@ -398,7 +398,7 @@ used to admit the PR: | `label:hold`, `held`, `label:needs-human`, `exempt-label`, `excluded-label:*`, `sentinel`, `human-merge-path*`, `intent-*`, `contributor-lane:workflow-path` / `tests-removed` / `no-reviewer` / `reporter-trust-hold`, `workflow-permission` (GitHub refused update-branch or the merge-forward with a 403 because the base changed `.github/workflows/` and the token the hive used lacks the workflows permission; no token the hive holds can push that update, so it is not sent to 070), `fork-workflow-update` (the same update-branch refusal on a fork head: the App is not installed on the fork, so no grant lets it push there), `linked-issue:hold:#N: