Repository navigation
π fix(automerge): key the 085 entry comment on the decision, not the observing lane - #16407
Conversation
β¦serving lane Signed-off-by: scanner <280983584+hivecommons-hive[bot]@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
|
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Read
One rollout observation, not a defect: a PR already parked at 085 whose persisted I have not approved or merged anything. Review findings from Read One operational note, not a defect: records already persisted with Packages |
There was a problem hiding this comment.
The steady-state fix is correct; there is one upgrade-time side effect worth a small addition before this lands.
Verified the mechanism. decisionCauseFor returns "" for stageReasonVerdictRequiresHuman (src/pkg/github/automerge/automerge_stage_human.go:593), and routeHuman passes CauseDecision only when the lane handed off at 085 (automerge_stage_human.go:474-476). So the contributor lane's sweep reaches the else if e.Cause == CauseDecision && len(e.ForkGuard) == 0 branch in RouteHuman (src/pkg/stagelabels/human.go:506-507) and appends the consequence bullet, while the trusted lane's CauseTrust hand-off builds the same decide list without it. Dropping that bullet from EntryCause makes the two digests equal; keeping it when it is the only bullet preserves a non-empty cause. The new test exercises exactly that pair of sweeps.
One finding (lowβmedium): a one-time repost on every PR already parked at 085 via this path.
src/pkg/stagelabels/store.go:1195-1197β the digest for[requires_human bullet, β¦, consequence bullet]changes with this PR.src/pkg/stagelabels/store.go:1231-1235βEntryCommentExplainsreturns false whenEntryCommentedCausesis non-empty and does not contain the new digest.src/pkg/github/automerge/automerge_stage_human.go:647-655β withrec.EntryCommentedtrue, same head, non-empty cause, that false falls through to postingDecisionCommentagain.
So on the first sweep after deploy, every record currently parked at 085 whose stored cause was computed with the consequence bullet (any contributor-lane requires_human park without a decision question, since decisionKey is empty there and EntryCommentRepeatsDecision cannot short-circuit) gets one more <!-- hive:stage-needs-decision --> comment on the same head β the exact noise this PR removes, paid once across the whole parked set. The doc comment at store.go:1227-1230 names this as the case the empty-list rule was added to avoid.
Suggested minimal addition: in postHumanEntry, when route.Reasons contains decisionConsequenceReason, also accept the legacy digest (sha of the reasons with the bullet) in the EntryCommentExplains check, then MarkEntryCommentedCause with the new digest so the record migrates silently. A unit test seeding EntryCommentedCauses with the legacy digest and asserting zero comments would pin it.
Security, scope and docs: nothing to add β no trust surface touched, the change matches Closes #16405 and leaves the follow-up out as the body says, and the comment body/public names are unchanged so no operator doc moves.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the diff against v5 merge-base 18ddec8 plus the callers; the mechanism matches the tree and this looks correct to me.
Why the two lanes digested differently. routeHuman (src/pkg/github/automerge/automerge_stage_human.go:474-476) picks CauseDecision only when the lane's own stage is 085; the trusted lane's untrusted-author-role hand-off arrives as CauseTrust. For stageReasonVerdictRequiresHuman, decisionCauseFor returns "" (automerge_stage_human.go:593-595), so RouteHuman (src/pkg/stagelabels/human.go:505-508) appends the consequence bullet on the contributor sweep and nothing on the trusted sweep. Both sweeps otherwise produce the identical requires_human @sha bullet, so the only delta in route.Reasons β and hence in EntryCause at automerge_stage_human.go:635 β was that one bullet. Dropping it from the digest (store.go:1194-1196) collapses the two to one cause; keeping it when it is the sole bullet preserves a non-empty cause for the lane-rule-only park.
Edge I checked. rec.EntryCommentExplains(head, cause) is the only consumer of the digest, so the change cannot mask a genuine cause change: a reason list that differs by anything other than this bullet still digests differently. The rendered DecisionComment body is untouched, as the PR body says.
Test: TestDecisionEntryNotRepostedWhenObservingLaneFlaps drives exactly the two-lane sequence above; the trusted sweep without the fix would add a second EntryCommentedCauses entry and a second comment. I could not execute it here (test execution is disabled for agents in this pod); the test (hub */4) shards were still running at review time, so a maintainer should see them finish green before relying on it.
No security, scope, or docs concerns: changelog.d/fixed-16405.md follows the fragment naming rule and no public names change.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Why
A PR parked at 085 can be observed by two lanes in turn. One example is a fork PR whose
requires_humanverdict reaches 085 through the contributor lane's verdict hand-off on one sweep and through the trusted lane's trust hand-off on the next.RouteHumanadds the filler bullet "the automerge lane will not merge this unattended" only on theCauseDecisionpath. Because of that, the two lanes produce differentstagelabels.EntryCausedigests for the same decision on the same head. Each flap looks like a new cause, so the<!-- hive:stage-needs-decision -->comment is posted again. #16398 got it 4 times.The maintainer should get one explanation for each decision on each head, whichever lane saw the PR last.
What
stagelabels.EntryCausenow leaves the lane-rule consequence bullet out of the digest. That bullet describes presentation, not the cause. It still counts when it is the only bullet, so a PR parked only on an unnamed lane rule keeps a non-empty cause. Public names and record fields are unchanged. The comment body is unchanged too.TestDecisionEntryNotRepostedWhenObservingLaneFlaps, next toTestDecisionEntryRepostsWhenCauseChanges. It sweeps PR 9 withrequires_humanon headsha, first throughstageLaneContributor(stageReasonVerdictRequiresHuman) and then throughstageLaneTrusted(untrusted-author-role). It asserts one entry comment and one recorded cause. Without the fix, the second sweep posts a second comment.The optional follow-up in the issue is not part of this PR.
Closes #16405
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88