Repository navigation
π fix(stage-labels): a merge-guard refusal no longer moves a PR parked at 085 back to 080 - #17012
Conversation
β¦85 PR to 080 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 hivecommons#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 (hivecommons#16881) and the dampener (hivecommons#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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
There was a problem hiding this comment.
Read the classifier at src/pkg/stageengine/derive_pr_classify.go on v6 and the four lane sites that emit the reason. The mechanism described here is real and the fix is in the right place.
stageHandoffReasonsalready listsbase-refresh:merge-guard(derive_pr_classify.go:260), but that table is consulted at line 375, after theif o.Errbranch at line 353.- Every lane returns the refusal together with its error β
automerge_contributor_lane.go:1659,automerge_sweep_queued.go:25,automerge_sweep_trusted.go:26and:648β andrecordStagesetsErr: err != nil(automerge_stage_labels.go:562), so the observation always took the errored branch, whereAuthorSideDoneturns an approved head into a role-rank 080. - The new early return sits after the supersession check and before
o.Err, so terminal/supersession handling is untouched, and the non-error path for this reason (already "no opinion" via the hand-off table) is unchanged.stage-labels.mdalready documented this reason as "no opinion"; the code now matches the doc.
TestErroredMergeGuardIsNoStageOpinion is the minimal regression test and TestMergeGuardRefusalKeepsForkGuardedPRAtNeedsDecision replays the #917 cadence through ApplyStageLabels. Looks correct to me.
Note for whoever merges: Sign-off survives the squash shows CANCELLED on this head and coverage has not reported β a re-run rather than a code problem as far as I can see.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Summary
A PR parked at 085 on a red check flipped to 080 every time a contributor-lane pass was refused the destination-merge lock. The lane reports that refusal (
base-refresh:merge-guard) together with its error. The classifier handled errored lanes before it checked for this reason, so an approved head read as "waiting for merge admission" (080). That 080 replaced the standing 085, put the red PR at the front of a merge train, and the next normal pass moved it back. The refusal now has no stage opinion, error or not. Small change: one early return inClassifyStage, plus a replay test.What went wrong
projectbluefin/utah-packages#917 is a fork PR with an approve verdict, and its required
Canarycheck is red and fork-guarded (only a maintainer's exact-head run can clear it). The head stayed at7e52182c0all day. The label timeline shows 085 β 080 β 085 about 15 times between 12:02Z and 16:11Z on 2026-11-07. Each 080 lasted 1β3 minutes.Live log for one round trip (hive build 729baa9):
required-check-failing:Canarybase-refresh:merge-guard, error "destination merge already in progress"base-refresh:merge-guardfork-guard:Canary"Merge guard" here does not mean a base refresh was attempted. The engine ticker and the queued sweep both evaluate PRs. Each takes a per-destination lock (
AcquireDestinationMerge, keyed on repo and base) before reading a PR. When the other sweep holds it, the lane gives up straight away and returnsbase-refresh:merge-guardwithErrDestinationMergeBusy. #16819 made that reason a no-opinion hand-off, but only for an observation recorded without an error. InClassifyStagetheo.Errbranch came first, andAuthorSideDone(approved, no CI reason) returned a weak 080. Nothing else had an owned opinion that pass, so the weak 080 was written.On v6 tip the #16881 reversal guard and the #16980 dampener do not stop this shape. The replay test below fails on tip at the first refusal, and in a scratch run it wrote 080 again on every later refusal pass. #924 shows the same flip on the same passes (080
base-refresh:merge-guard/ 085contributor-lane:workflow-path).What changes
ClassifyStagereturns no opinion forbase-refresh:merge-guardbefore the errored-lane branch, so the refusal never outranks the stage the PR already has.derive_pr_classify.goline citations in the stage-engine docs. They already pointed at the wrong lines on tip.Files
src/pkg/stageengine/derive_pr_classify.gosrc/pkg/github/automerge/automerge_stage_merge_guard_err_test.go(new)src/docs/labels-and-control-signals/stage-labels.md,src/docs/adr/0025-central-stage-engine.md,src/docs/stage-engine-plan.mdchangelog.d/fixed-merge-guard-stage-flap.mdTests
TestMergeGuardRefusalKeepsForkGuardedPRAtNeedsDecisionreplays the fix: contribute page Docker/local mode + HTTP copy fallbackΒ #917 shape: a fork head, an approve verdict and a fork-guarded red required Canary. Evaluated passes alternate with merge-guard passes recorded exactly as the lane records them, error included. The gaps are 70 s to 50 min, so the replay runs both inside and outside the reversal-guard and dampener windows. The PR must stay at 085 withfork-guard:Canary, and 080 must never be added. It fails on v6 tip (3d7e6be) at pass 1 and passes with the fix.TestErroredMergeGuardIsNoStageOpinionis the classifier unit check. It fails on tip (weak 080) and passes with the fix../pkg/stageengine/...,./pkg/github/automerge/,./pkg/stagelabels/.go vetis clean. The docs citation and link checks pass.Not in this PR
cmd/hive/merge_eligibility.go,mergeBucketFailing) logs and queues CI-repair work for this PR on every eligibility pass. That was 41 times from 12:00Z to 16:37Z on one unchanged head, for a fork-guarded check no fixer can clear. It has a different cause and deserves its own issue.mergeTrainUnderRepair), and on build 729baa9 it seated fix: contribute page Docker/local mode + HTTP copy fallbackΒ #917 as front while it wore 080. I did not check whether the train's own readiness inputs keep a red head off the front on v6 tip.Refs projectbluefin/utah-packages#917, Refs #16819
π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1