Skip to content

πŸ› fix(stage): park maintainer-only blockers (hive-caused sign-off attribution, fork guards) at 085, not 072 - #14303

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/maintainer-only-blockers-085
Oct 25, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/maintainer-only-blockers-085

Conversation

@Danathar

@Danathar Danathar commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The stage pass returns some PRs to their contributor (stage/071-needs-author / stage/072-returned-to-contributor) and nudges them to fix something only a maintainer can clear. This PR parks those at stage/085-needs-decision for a maintainer instead, covering both observed cases.

1. Hive-caused sign-off attribution

Evidence: projectbluefin/testsuite#991. j1mc's fork PR is role/contributor and author/clanker.

  • On 2026-10-18 the hive pushed its own fix commit efc0229, signed off as the App.
  • The pass sent the PR to 072 under hive-signoff-attribution. Nudges on 2026-10-24 17:42Z and 2026-10-25 18:17Z told j1mc "1 commit is signed off as the hive App instead of you … set git config user.email …".
  • testsuite allows merge commits. The real resolution was a maintainer approving head 4c8c0e1 at 20:30Z and merging it with a merge commit, d55a794, at 20:32Z.

Cause. In ApplyStageLabels (automerge_stage_labels.go) and DerivePR (derive_pr.go), any squash-unsafe App-signed commit that did not win the merge-commit election went to FixingStage. The election only accepted role/trusted authors. Nothing asked who made the commit.

Change.

  • Hive-caused heads park at 085. The new signoffHiveCaused covers mixed authorship (the contributor's own self-signed commits beside App-signed ones) or a head the hive recorded pushing. Such heads go to 085 under hive-signoff-attribution, with one maintainer note per head, <!-- hive:maintainer-signoff-attribution head=… -->. The note says the contributor has nothing to fix and names what clears the PR. There is no contributor nudge and no adoption.
  • A trusted merger's approval now elects a merge commit. mergeCommitElection accepts an APPROVED review on exactly the current head as an alternative to role/trusted, then elects a merge commit (merge-method/merge) exactly as it already did for trusted PRs. The stage pass reads that approval itself, once, only when it is the missing piece: a hive-caused head, a trusted-merger list configured, and human reviews not known to be zero.
  • Squash-only is checked before role. A squash-only repo is now reported as the refusal ahead of the role, so a squash-only note never suggests --merge.
  • The maintainer ask never targets the contributor. mergeCommitRefusalText, shared with the adoption-stall note, no longer ends with "otherwise @author re-authors the hive's commits".
  • Live adoptions keep their path. An adoption that is still live keeps its existing 074 β†’ 085 escalation, which already carried the maintainer ask.
  • The author's own App-signed commit still goes back to them. A head made only of App-signed commits the hive never pushed is the 🌱 Add OWNERS fileΒ pluk#315 shape: a person's own commit made with the App's identity. It still returns to its author with the re-sign commands, unchanged.

2. Fork-publication guards (forward-port of v5 #14282)

Evidence: projectbluefin/utah-packages#609 to projectbluefin/utah-packages#618 (utah-packages numbers) are fork PRs by mendezr and kylerankin. Their required Canary check fails with "a fork pull request cannot publish the canary image…", and the hive sent them to 072, then adoption.

#14282 fixed this on v5 (88fa705) but has not reached v6; the last v5β†’v6 sync was 2026-10-23. This cherry-picks it:

Design choices

Related issues

Testing

go test ./pkg/github/automerge/... ./pkg/stagelabels/... ./pkg/stageengine/... ./pkg/github/ ./pkg/dashboard/... ./cmd/hive/... -count=1 (run from src/): all ok: pkg/github/automerge 1.0s, pkg/stagelabels, pkg/stageengine (+prstage, stageenginetest), pkg/github 50.1s, pkg/dashboard 107.4s (+collect, theme, webstatic), cmd/hive 8.0s.

New tests in automerge_signoff_attribution_085_test.go, driving the real ApplyStageLabels against a fake GitHub API:

Test Shape Result
TestHiveCausedSignoffAttributionParksForMaintainer testsuite#991 shape: contributor role, merge commits allowed, no approval 085; one maintainer note naming Approve and gh pr merge 991 --merge; no nudge or re-sign ask; nothing re-posted on the next sweep
TestHiveCausedSignoffAttributionSquashOnlyParksNamingPolicy same, squash-only repo 085; the note names auto_merge.squash_only and does not suggest --merge
TestHiveCausedSignoffAttributionApprovedHeadElectsMergeCommit trusted merger approved the current head merge-method/merge and the merge-commit note; not 085 or 072
TestHiveCausedSignoffAttributionStaleApprovalStillParks approval on an older head 085, no label
TestContributorFixableFailureStillReturnsToContributor the contributor's own commits plus check-failing:unit 072
TestAuthorsOwnAppSignedCommitStillReturnsToAuthor pluk#315 shape still 072 on hive-signoff-attribution, with no maintainer note

Other test changes:

  • TestMergeCommitElection gains approved-head, approved-but-squash-only, approved-but-hive-only, and contributor-in-squash-only (refusal names the policy) cases.
  • Fork guard, forward-ported from πŸ› fix(stageengine): park fork PRs failing a fork-publication guard for a maintainerΒ #14282: TestForkGuardChecksFor (plus the real-text cases above), TestClassifyStageForkGuardParksForMaintainer, TestForkGuardChecksRoundTripFacts, TestRouteHumanForkGuard, and the dashboard reason text.
  • Stage goldens: the DCO mirror in stageengine/stage_goldens_test.go models the hive-caused park and adds a squash-unsafe-hive-only shape. Regenerated dco.json: mixed-authorship cases move from 07x to 085 (36 cases), the hive-only shape stays at 07x, and drafts are unchanged. I reverted an unrelated note-capitalisation drift that -update also rewrote in regressions.json.

Validated against real data, outside the committed tests:

Guards and checks:

  • BASE_REF=v6 bash src/scripts/check-changelog-fragment.sh: OK.
  • bash src/scripts/check-api-reference-citations.sh: all verified.
  • gofmt is clean on the touched files, and go vet passes on the touched packages.

Contributor checklist

  • Changelog: changelog.d/fixed-hive-caused-signoff-attribution-085.md, plus the forward-ported changelog.d/fixed-fork-publication-guard-stage.md.
  • Targets v6: v6 is the line the reporting hive runs; the fork-guard half is already on v5.
  • The title uses the emoji convention.
  • Commits include DCO sign-off.
  • Docs updated: src/docs/labels-and-control-signals.md (attribution routing, and the fork-guard row from πŸ› fix(stageengine): park fork PRs failing a fork-publication guard for a maintainerΒ #14282) and src/docs/operator-reference.md (auto_merge.squash_only).
  • No secrets, credentials or local runtime state are committed.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

Two kinds of PR were returned to their contributor (071/072) and nudged
to fix something only a maintainer can clear:

- Hive-caused sign-off attribution. The hive pushed its own App-signed
  fix commit onto a contributor PR (projectbluefin/testsuite#991), and
  the stage pass sent it back under hive-signoff-attribution, asking the
  contributor to re-sign a commit they never made. A head the hive
  caused (mixed authorship, or a head it pushed) now parks at 085 with
  one maintainer note per head; a trusted merger's approval of the
  current head lets the lane elect a merge commit, as it already did for
  role/trusted. The refusal names squash-only before role so the note
  never asks for an impossible --merge. A head of only App-signed
  commits the hive never pushed (hivecommons/pluk#315) still goes back
  to its author.
- Fork-publication guards. Forward-port of v5 hivecommons#14282 (88fa705): a fork
  PR whose only red checks refuse forks parks at 085 with the check
  named. Adapted to v6, where DecisionComment renders the 085 actions.
  Adds the two real utah-packages guard wordings to the matcher tests.

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 25, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 25, 2026
@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 25, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed β€” no findings from this perspective.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness review (head 334023f).

1. Stale adoption record can still send a hive-caused head to 072 with the re-sign nudge, for one pass β€” src/pkg/github/automerge/automerge_stage_labels.go:833-867 vs :879-890.

park := hiveCaused && !(hadPrev && prevRec.AdoptionLive(obs.HeadSHA)) (:860) is evaluated with the prevRec read at :746, before settleInPlaceAdoption (:884) runs. When an in-place adoption is live and the contributor pushes their own commit on top of the hive's App-signed fix (the exact testsuite#991 shape: mixed authorship), settleInPlaceAdoption yields on this same pass (automerge_contributor_adopt.go:862 store.MarkYielded, which clears AdoptedHead so AdoptionLive becomes false, store.go:972). But park was already false, so verdict.Stage stays fixingStage(obs) (:862), the yield check at :891 no longer pins 074, and the PR is written at 071/072 with obs.Reason == LaneReasonHiveSignoffAttribution. The 07x block at :1035-1072 then fires: nudgeContributor for a clanker author, or nudgeSignoffAttribution for a human (automerge_contributor_nudge.go:309-327, "author told to re-sign the head"). Next pass parks it at 085, but the contributor has already received the wrong nudge this PR exists to stop. The new tests do not cover a yield-on-same-pass head.

Fix: settle the in-place adoption before the DCO section so the park sees the post-yield record (the settle only needs prevRec, obs, policy):

@@ func (c *Engine) ApplyStageLabels
 		dcoRead := false
+		if !verdict.Terminal && hadPrev && prevRec.AdoptedInPlace() {
+			// Settle the in-place adoption first: the sign-off park below
+			// must see a head the contributor just yielded as unadopted.
+			n, err := c.settleInPlaceAdoption(ctx, store, key, obs, prevRec, policy)
+			result.Comments += n
+			if err != nil && firstErr == nil {
+				firstErr = err
+			}
+			prevRec, _ = store.Get(key)
+		}
 		if !verdict.Terminal && verdict.Stage != stagelabels.None {
@@
 		} else {
-			if hadPrev && prevRec.AdoptedInPlace() {
-				// In-place adoption: ...
-				n, err := c.settleInPlaceAdoption(ctx, store, key, obs, prevRec, policy)
-				result.Comments += n
-				if err != nil && firstErr == nil {
-					firstErr = err
-				}
-				prevRec, _ = store.Get(key)
-			}
 			if hadPrev && prevRec.AdoptionLive(obs.HeadSHA) && verdict.Stage.YieldsToAdoption() {

Plus a test in automerge_signoff_attribution_085_test.go with a prior record AdoptMode: in-place, AdoptedHead: <old> and a mixed head the hive did not push, asserting 085 and no SignoffAttributionComment/nudge.

2. (low, advisory) signoffHiveCaused (automerge_merge_commit.go:96-105) treats any total > squashUnsafeHive as hive-caused without checking the hive ever pushed. A contributor who made one commit under the App identity (pluk#315 shape) and one normal commit gets parked at 085 and told they "did not make those commits and have nothing to fix" (:160). Requiring rec.HivePushedHead(head) for the mixed case too, when a record exists, would keep the pluk shape author-facing; if the structural signal is intentional as the body says, a note in the comment text that the hive may be wrong about authorship would do.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 647dbea into hivecommons:v6 Oct 25, 2026
64 of 69 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#14303334023f` sha256:d6204f0bf2c0365c426ba59346c30156b502062cc28106d38402669004d5e26a β€” download from the dashboard or `hivectl review evidence #14303`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at 334023f.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant