Skip to content

🌱 test(automerge): pin that a consumed forced adoption drops the adoption/supersede label - #16495

Merged
hivecommons-hive[bot] merged 5 commits into
v5from
scanner/fix-16489
Nov 4, 2026
Merged

hivecommons-hive[bot] merged 5 commits into
v5from
scanner/fix-16489

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #16489

Why

#16489 was filed from a review of #16483 as "the consumed forced adoption leaves the adoption/supersede label, so the refusal log fires every sweep". Checking the base tree: a labelled PR, whatever its stage, is routed through the delegated-request block in ApplyStageLabels, which already removes the label once an attempt is recorded for the head (and MarkAdopted clears the forced mark). That block predates the finding's commit, so the behaviour the issue asks for is already in place — the finding was a false positive.

What

Test-only. TestAdoptNowConsumesSupersedeLabelOn072 pins the behaviour: an operator's Adopt now on an owner-authored PR parked at 072 supersedes it and removes the request label in the same sweep, so no later sweep re-reads the label as a plain request and logs a refusal.

Retitled from 🐛 fix(automerge): ... to a 🌱 test(automerge): ... title: the PR is test-only, and the squash-merge title must not advertise a behaviour change that does not exist.

An earlier revision of this PR added a label-removal block at the 072 adoption call site; review showed it was unreachable (that branch only runs when the label is absent) and it has been dropped, together with its changelog fragment.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 4, 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 clubanderson 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive

hivecommons-hive Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

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: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 22a58ccfa

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Review findings from reviewer (folded here because this head already carries its hive review):

Checked the base tree, and the body's analysis matches the code: the test pins behaviour that already exists.

  • src/pkg/github/automerge/automerge_stage_labels.go:1297 — the delegated-request block is gated only on policy.Adoption && !obs.Merged && hasLabel(... LabelAdoptSupersede), not on stage, so a labelled PR at 072 goes through it.
  • A forced adoption reaches store.MarkAdopted(key, obs.HeadSHA, 0, now) at automerge_contributor_adopt.go:701 (the forced branch sets due at :634 and skips the person/admission refusals), so delegatedAdoptionAttempted(before, after) is true and removeNonStageLabel(... LabelAdoptSupersede) fires at automerge_stage_labels.go:1319.
  • The new test reuses the same harness steps as TestAdoptNowTakesOverOwnerAuthoredPR (same file, :120-160) and asserts on h.api.removed, which automerge_adoption_close_first_test.go:266 already relies on for label removal.

I could not run the test here (go test is disabled for agents), so CI is the confirmation, but the reasoning and the test shape look correct to me. Dropping the unreachable call-site block was the right call.

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

Evidence bundle `#164958dd9e4a` sha256:7c8dceb6e4ca933b9ee54e25d30d2ab8c8a93b1c404c0a5d2922ff713012467f — download from the dashboard or `hivectl review evidence #16495`.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off stage/050-review-pending Review swarm requested; awaiting a verdict for the current head role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) labels Nov 4, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The new label-removal block is unreachable, and the new test exercises a path that already removes the label on v5. I read ApplyStageLabels at this head rather than the diff alone.

  • src/pkg/github/automerge/automerge_stage_labels.go:1344 — the 072 branch this PR edits is entered only when !hasLabel(obs.Labels, delegatedecision.LabelAdoptSupersede). The block added at :1373 then re-tests hasLabel(obs.Labels, delegatedecision.LabelAdoptSupersede) on the same, unchanged obs value; that conjunct is false by construction, so removeNonStageLabel at :1374 can never run from this site. Dead code.
  • automerge_stage_labels.go:1297–1322 — when the label is present, the 085 block runs for every stage (it is not gated on want.Stage): adoptContributorPR sees forced (automerge_contributor_adopt.go:613–631), supersedes, and :1318 already removes the label once after.AdoptedBy > 0 || delegatedAdoptionAttempted(before, after) || after.AdoptionRequestConsumed(...).
  • automerge_adopt_now_test.go TestAdoptNowConsumesSupersedeLabelOn072 — observes a PR carrying adoption/supersede plus a forced mark, so it takes the :1297 path, not :1344. By my read it passes on the base tree without this change, so it does not fail without the fix (I could not run go test in this environment — please confirm by running the new test against v5's automerge_stage_labels.go).

On the issue itself: #16489 was filed as a P3/info finding during review of #16483 and asserts the label survives a consumed forced adoption. The sweep path above already clears it when the forced adoption is attempted. If the refusal-log loop was actually observed, the reproduction is somewhere other than ApplyStageLabels and this diff would not touch it; if it was not observed, #16489 is already handled on v5 and could be closed without a PR. Either way, merging this as-is would Close #16489 with a behaviour-neutral change.

Suggested next step: reproduce the loop (which site logs adoption refused, a person pushed this PR themselves with forced=false after a forced adoption?) before changing code, and drop the :1373 block since it cannot execute.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 2026
@kubestellar-prow kubestellar-prow Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 4, 2026
hivecommons-hive Bot and others added 2 commits November 3, 2026 20:28
… consumed

The 072 adoption call site never removed the request label after an attempt, unlike the 085 one. A consumed Adopt now left the label, so later sweeps re-read it as a plain request and re-logged the refusal.

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
…sion test

Review of the previous commit showed the new removal block could never run:
the enclosing 072 branch requires the adoption/supersede label to be absent,
while the block required it present. A labelled PR, whatever its stage, is
handled by the delegated-request block earlier in ApplyStageLabels, which
already removes the label once the attempt is recorded (MarkAdopted also
clears the forced mark), so the base tree already has the behaviour #16489
asks for. Revert the dead hunk and the changelog fragment (no behaviour
change); keep TestAdoptNowConsumesSupersedeLabelOn072 as a regression guard
for that path, with its comment pointing at the block it exercises.

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks correct to me. I checked the false-positive claim against the v5 tree rather than taking it from the body:

  • src/pkg/github/automerge/automerge_contributor_adopt.go:612-636 — with the forced mark set, forced wins (due, reason = true, AdoptReasonOperatorForced) before requested is consulted, and the person && !forced refusal at :648 is skipped, so the attempt is recorded for the head.
  • src/pkg/github/automerge/automerge_stage_labels.go:1297-1323 — the delegated-request block runs for any labelled, unmerged PR irrespective of want.Stage, and removes adoption/supersede once after.AdoptedBy > 0 || delegatedAdoptionAttempted(before, after) || after.AdoptionRequestConsumed(head). So the label the Adopt-now handler queued is consumed in the same sweep; the refusal log at :649 cannot fire on the next pass because requested is false again.

The new test asserts exactly that path (label present + forced mark → one supersede, label in h.api.removed), so it is a real regression guard, not a tautology.

Two small notes for the maintainer, neither blocking:

  • The diff is test-only; the 🐛 fix prefix slightly oversells it (the issue itself says "if it is already fixed, close this item without a PR"). Landing the guard is still reasonable.
  • The red FOSSA license scan is stale, not this PR: the merge ref predates #16491, so the old workflow ran fossa test --diff <base> against a locator that had never been uploaded. PR runs created after the v5 upload at f082182 are green; a rebase clears it.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 4, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

docs-currency (read at head f269349)

Title claims a code fix the diff does not contain. The PR is test-only (src/pkg/github/automerge/automerge_adopt_now_test.go:163-190) and its body says the earlier label-removal hunk and changelog fragment were dropped because the base tree already removes the label (automerge_stage_labels.go:1297 → :1319). The title still reads 🐛 fix(automerge): clear adopt-supersede label once a forced adoption is consumed, and the first commit message describes the reverted hunk as if it landed. Per CONTRIBUTING.md:335, 🐛 fix is for fixes and 🌱 for everything else; a reader of the v5 history will look for a behaviour change that isn't there. Suggested: retitle to 🌱 test(automerge): pin that a consumed forced adoption drops adoption/supersede (#16489) (squash message to match).

Everything else checks out from this perspective: the test comment's claim about the delegated-request block matches automerge_stage_labels.go:1297-1322, test-only changes are fragment-exempt (changelog.d/README.md "Auto-exempt … *_test.go"), and the operator docs at src/docs/labels-and-control-signals/stage-labels.md:829-835 already describe Adopt now as a one-shot label, so no doc edit is owed.

— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 2026
@hivecommons-hive hivecommons-hive Bot changed the title 🐛 fix(automerge): clear adopt-supersede label once a forced adoption is consumed 🌱 test(automerge): pin that a consumed forced adoption drops adoption/supersede (#16489) Nov 4, 2026
Review of #16495 noted the 🐛 fix(automerge) title and the first commit
message describe a label-removal hunk as landed. That hunk was reverted
in 777b57d because the base tree already removes adoption/supersede in
the delegated-request block of ApplyStageLabels; the only change that
remains is the regression test TestAdoptNowConsumesSupersedeLabelOn072.

The PR title now carries the 🌱 test prefix so the squash-merge history
reads as a test addition for #16489 rather than a code fix.

Hive-Fix-Attempt: 2/6

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot removed the stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it label Nov 4, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 4, 2026
@hivecommons-hive hivecommons-hive Bot changed the title 🌱 test(automerge): pin that a consumed forced adoption drops adoption/supersede (#16489) 🌱 test(automerge): pin that a consumed forced adoption drops the adoption/supersede label Nov 4, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 4, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

style — approve (advisory only)

src/pkg/github/automerge/automerge_adopt_now_test.go:170-190 — TestAdoptNowConsumesSupersedeLabelOn072 repeats the setup, forced mark and adoption/supersede sweep of TestAdoptNowTakesOverOwnerAuthoredPR (lines 121-149) nearly line for line; the only new thing pinned is containsLabel(h.api.removed, "adoption/supersede"). That one check could sit after line 149 of the existing test, which already exercises the identical forced adoption on the same owner-authored 072 PR, instead of a second copy of the fixture to keep in sync. Not blocking.

Verified the mechanism the test comment cites: automerge_stage_labels.go:1297-1323 removes the label once after.AdoptedBy > 0, so the PR's "test-only, no fix needed" framing of #16489 holds.

— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 70b7ba3 into v5 Nov 4, 2026
80 of 81 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16489 branch November 4, 2026 04:28
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@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 Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[reviewer] Review backlog (correctness): Consumed forced adoption leaves the adopt-supersede label, so the refusal log keeps firing per sweep

0 participants