Repository navigation
🐛 fix(automerge): a maintainer keeps role/trusted when the hive merges main into their approved PR - #16993
Conversation
…dmissions The contributor lane's adoption and operator-approval routes admit a PR's head and return before the clean-merged-PR auto-promotion check, so they recorded the author's raw registry tier as the role. When the hive merged main into an auto-promoted maintainer's PR and carried their approval onto the merge commit, the PR went role/trusted -> role/newcomer (projectbluefin/utah#1132; utah-packages#893 flipped and back as the approval stopped matching the head). Both routes now record authorStandingTier: the registry tier, or trusted when the author's clean merged history would promote them. The read posts no announcement and a failed read keeps the registry tier. The ratchet's eligibility check is shared as autoPromotionEligible. 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 |
|
@Danathar this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity. |
There was a problem hiding this comment.
Read admitContributor and the two head-scoped routes against 8325a54d; the fix is correct and matches what the author route already records.
Mechanism verified. admitContributor (src/pkg/github/automerge/automerge_contributor_lane.go:666-680) returns from the adopted-head and operator-approval routes before the merged-history ratchet at :687-696, and both used observedRegistryTier(author) — the raw profile — for ObservedTier, which feeds the role/* label. The author's own route sets ObservedTier: "trusted" on a clean history (:694). authorStandingTier (:768-783) reproduces exactly that outcome: tier in RequireTiers → unchanged; otherwise same autoPromotionEligible gate (revoked / [bot] / App login, :752-760, extracted verbatim from the old inline condition) and the same contributorCleanMergedHistory call with the same need/hive-wide args. A history read error degrades to the registry tier instead of failing admission, which is the right asymmetry — admission already happened by a head-scoped route and the label is cosmetic. go build ./pkg/github/automerge/ passes.
Cost: this adds a contributorCleanMergedHistory walk on head-scoped admissions, but only for authors below require_tiers and only where the author route would have walked anyway, so it is not a new class of API traffic.
One info note, not a defect: the author route also calls ClearTrustPromotion(author) when history.Reason == contributorHistoryReasonDemoted (:696-700); authorStandingTier does not. The label is still correct (falls back to the registry tier), and the store is cleared the next time the author route runs, so I would not hold the PR for it — just noting the two paths are no longer perfectly symmetric.
Test table covers operator and adopted routes, short history, revoked, and in-require_tiers. Looks correct to me.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the change against
Test stage 080-awaiting-merge-admission → 072-returned-to-contributor: check-failure Review findings from Conclusion: looks correct to me. Verified against the
Cost note (info): head-scoped admissions for sub-tier authors now do one The test file sets up both routes and asserts |
|
🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
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. |
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
The hive's GitHub App lacks |
|
Needs a decision, not a merge: Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
… CI incident is withdrawn (#17007) The 072 nudge goes out the moment a contributor PR goes red ("the hive will not merge it until the head changes"). The scanner's [shared-ci] incident marker can land minutes later. The stage pass then moved the PR to 050, but the nudge stayed as posted and the head's nudge count stayed at 1. Seen on hivecommons/hive #16993, #16995, #17000 and #17001: nudged for native-queue-policy about ten minutes before they were deferred to incident #17003. - When the pass reads a nudged head's red as shared-ci-incident:<n> or base-branch-red:<checks>, edit the hive's own nudge comments for that head in place to say it was withdrawn, and forget the nudge (Store.WithdrawNudge), so a genuine return to 072 is nudged afresh. - After an incident closes as completed, keep a PR deferred to it until the rerun sweep stamps hive-shared-ci-rerun-<n> (at most 30 minutes), so the head is not handed back in the gap before the re-run. - Name the head's red checks in the nudge when the CI gate's reason is a bare token such as check-failure (a base with no required checks). Refs #17003, #12606, #12253 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Looks correct to me. Read automerge_contributor_lane.go on v6 (the PR base), not just the diff.
- Mechanism confirmed: on v6
admitContributorreturns at line 667 (adopted head) or 670 (operator Approve) withObservedTier: c.observedRegistryTier(author)— the raw registry tier — while the auto-promotion that yieldsObservedTier: "trusted"only runs at line 679-686, after both early returns.noteStageRoleat line 1421 turns that tier into therole/*label, so a hive-pushed merge commit that carried a person's approval really does flip an auto-promoted author back torole/newcomer. The diagnosis in the body matches the code. authorStandingTierreproduces what the author's own route would have recorded: registry tier if it is already inrequire_tiers, else"trusted"iffcontributorCleanMergedHistoryis clean, else the registry tier. It deliberately does not callannounceContributorAutoPromotionorClearTrustPromotion— labelling stays side-effect-free, and the test assertscomments == 0.autoPromotionEligibleis a behaviour-preserving extraction of the v6:679 condition. The addedauthor == ""short-circuit matches the old outcome too:contributorCleanMergedHistory(line ~804) already returnedReason: "disabled",Clean: falsefor an empty author.- Test covers both head-scoped routes plus the short-history, revoked, and already-trusted cases.
One cost note, not a defect: head-admitted PRs by below-tier authors now trigger a PullRequests.List(state=closed, per_page=100) per sweep (contributorCleanMergesInRepo, v6:847-849; more in hive-wide scope) that previously only ran on the author's own route. That is the same read the un-admitted path already makes, so it is a modest increase; if the lane's sweeps are REST-budget-sensitive, caching the clean-history answer per author per sweep would be the natural follow-up.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the diff against the tree at v6 and the callers of admitContributor. This looks correct to me.
What I checked:
admittedRegistryTier(automerge_contributor_lane.go:639-656) already filters toRequireTiers, and the claim-marker path (:1251-1260) only admits a tier inRequireTiers, so the only routes that could record a sub-tierObservedTierfor an author whose clean history would promote them were the two head-scoped early returns at:674-679. The fix targets exactly those.authorStandingTier(:767-781) short-circuits on aRequireTierstier and onautoPromotionEligible == false, so revoked/bot/App authors never reachcontributorCleanMergedHistory. The revoked case is pinned by the new test.- The extracted
autoPromotionEligiblepreserves the four conditions of the inlined predicate it replaces (configured, not revoked, not[bot], not the App login); the added empty-author guard is harmless sincecontributorCleanMergedHistoryalready returneddisabledfor it (:851). - The head route swallows a history read error and keeps the registry tier, while the author route still fails admission on the same error (
:689-690). That asymmetry is intentional per the comment and reasonable: labelling should not block an admission a person already made. - Cost note, not a defect: a head-route PR whose author sits below
require_tiersnow costs onePullRequests.List(closed, 100)per sweep (contributorCleanMergesInRepo,:889), plus the hive-wide search when the own-repo count is short. That is the same read the author route already does every sweep, so no new order of cost.
Test fails on v6 tip for the two head-route cases (ObservedTier = "newcomer"), which matches the body.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read admitContributor, contributorCleanMergedHistory and the role-label consumer at 2eabd89. Looks correct to me, and it does not widen admission.
- Only
ObservedTierchanges on the adoption and operator routes (automerge_contributor_lane.go:675,678);AdoptedHead/OperatorLoginand the admissionReasonare untouched, and the label is derived downstream at:1465viaRoleFromTier(claim.ObservedTier, …). So this is label consistency, not a new trust grant:authorStandingTiercan only return"trusted"under the sameautoPromotionEligible+history.Cleanconditions the author route already requires at:687-694. autoPromotionEligibleis a faithful extraction of the old inline condition at:687; the addedTrimSpace(author) == ""guard is behaviour-neutral becausecontributorCleanMergedHistoryalready returnsReason: "disabled"for an empty author (:851-854).- A failed history read returns the registry tier rather than an error (
:775-778), so a flakyPullRequests.Listcannot turn an admitted head into a skip. Good. - The new test exercises both head routes through the real
stagelabelsstore (NoteAdmission/MarkAdoptedInPlace) and asserts no promotion comment is posted.
One info-level note, not a defect: on the author route a contributorHistoryReasonDemoted result calls ClearTrustPromotion(author) (:696-699) so a later re-promotion is announced again; authorStandingTier does not, so a demotion first observed on a head-scoped route keeps the stale "announced" record until the author route next runs. Cosmetic (only affects whether the promotion comment is re-posted), and the author route runs on the next sweep without a carried approval anyway.
Cost note: the two head-scoped routes now make the same merged-history reads the author route already makes each sweep (one PullRequests.List per repo, plus the hive-wide search when enabled), only for authors below require_tiers. That matches the body's "reads the same history the normal route reads every sweep".
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1
Summary
A maintainer trusted through auto-promotion (five clean merged PRs, registry profile still
newcomer) dropped torole/newcomerafter the hive merged main into their PR. The cause is not the merge commit's author. The cause is the admission route. A person's Approve carried onto the hive's merge commit (or the hive's in-place adoption) admits the head, and that route returned before the auto-promotion check, so the role label fell back to the raw registry tier. The role now comes from the author's standing on every route.What went wrong
contributor-lane admitted … reason=contributor-lane:auto-promotedat 05:09 and 05:10Z (role trusted). At 05:10:49 hanthor's typed approve was recorded. The hive then merged main (head235d779), and at 05:11:35 loggeddecision carried over base refresh. Every sweep after that loggedreason=contributor-lane:operator-approval. At 05:13:52 the stage pass wroterole=newcomer(-role/trusted +role/newcomer). The approval is still carried, so it stays newcomer.operator-approvaladmission at 20:45:10Z on the old head9e6f438, before the hive's merge commit. At 20:48 the head was the merge commit0b9c721, the approval did not carry over this time, the lane went back toauto-promoted, and the label returned to trusted at 20:49. One code path gave two answers depending on which admission route matched first. No second code path was racing.The role was never read from the newest commit's author. The trusted-author lane never sees hanthor here. Only the contributor lane does, and its
admitContributorsetsObservedTierfromobservedRegistryTier(author)on the adoption and operator routes, skipping the merged-history ratchet that the normal route runs.What changes
admitContributornow recordauthorStandingTier. That is the registry tier, ortrustedwhen the tier is belowrequire_tiersand the author's clean merged history would auto-promote them. It reads the same history the normal route reads every sweep.autoPromotionEligible, and both callers use it.Files
src/pkg/github/automerge/automerge_contributor_lane.go: the two routes, plus the newautoPromotionEligibleandauthorStandingTierhelpers.src/pkg/github/automerge/automerge_contributor_role_standing_test.go: new test.changelog.d/fixed-role-label-author-standing.mdTests
TestAdmitContributorHeadRoutesKeepAuthorStandingcovers five cases:require_tiersneeds no history readOn v6 tip the first two fail (
ObservedTier = "newcomer", want "trusted") and the three control cases pass. With the fix, all five pass. Rango testin full for./pkg/github/automerge/,./pkg/stagelabels/and./pkg/stageengine/..., plusgo vetandgofmt.Refs projectbluefin/utah#1132
🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1