From ff9b76e0f34e07c313f4ab97e39066ba8c2ea703 Mon Sep 17 00:00:00 2001 From: Danathar Date: Thu, 5 Nov 2026 16:42:10 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(stage-labels):=20stop=20PR?= =?UTF-8?q?=20stages=20flipping=20between=20two=20sweeps'=20passes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit projectbluefin/utah-packages, 11-05 21:10-21:29Z: #878 070<->072, #873 080<->090 and #869 080<->085 flipped every pass with head, checks and labels unchanged. The engine's ticker and the queued sweep reconcile alternate passes from one stage tracker: - base-refresh:merge-guard (lane skipped the PR: a merge to its destination was in flight) classified as an owned base-refresh stage and overwrote the other sweep's stage. It is now a no-opinion hand-off reason. - the self-authored lane runs only in the ticker, so the queued sweep's contributor lane overwrote its stage for the same head. The tracker now remembers the lane and head that set the stage; a lower lane's different stage waits while that lane is absent, up to 30 minutes, never across a new head or a terminal outcome. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- changelog.d/fixed-stage-label-flap.md | 1 + .../stage-labels.md | 12 +- .../automerge/automerge_stage_flap_test.go | 196 ++++++++++++++++++ .../automerge/automerge_stage_labels.go | 74 ++++++- src/pkg/stageengine/derive_pr_classify.go | 5 + src/pkg/stageengine/prstage/reasons.go | 10 +- 6 files changed, 292 insertions(+), 6 deletions(-) create mode 100644 changelog.d/fixed-stage-label-flap.md create mode 100644 src/pkg/github/automerge/automerge_stage_flap_test.go diff --git a/changelog.d/fixed-stage-label-flap.md b/changelog.d/fixed-stage-label-flap.md new file mode 100644 index 0000000000..c19dd6c43d --- /dev/null +++ b/changelog.d/fixed-stage-label-flap.md @@ -0,0 +1 @@ +- PR stage labels no longer flip between two stages on every pass with nothing changed. Two sweeps (the engine's ticker and the main loop's queued sweep) reconcile alternate passes from one tracker. A contributor lane that skipped a PR because another merge to its destination was in flight recorded `base-refresh:merge-guard`, which was written as an awaiting-admission stage over the stage the other sweep set a minute earlier (projectbluefin/utah-packages#869 080↔085, #873 080↔090); it is now no opinion. And a lower lane no longer overwrites the stage a higher lane set for the same head while that lane simply did not run this pass, for up to 30 minutes (projectbluefin/utah-packages#878 070↔072). diff --git a/src/docs/labels-and-control-signals/stage-labels.md b/src/docs/labels-and-control-signals/stage-labels.md index 7c70b15b32..c061621d17 100644 --- a/src/docs/labels-and-control-signals/stage-labels.md +++ b/src/docs/labels-and-control-signals/stage-labels.md @@ -380,7 +380,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: