Skip to content

πŸ› adoption: operator Adopt now takes over any PR, owners included - #16483

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
fix/adopt-now-owner-authored
Nov 4, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
fix/adopt-now-owner-authored

Conversation

@clubanderson

@clubanderson clubanderson commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #16482

An operator's Adopt now on a PR whose author is one of this hive's owners (dashboard.authorized_users: …:owner) recorded a forced adoption that adoptContributorPR refused on every sweep as person-authored (#15202) without ever consuming it. The row sat at adopting… (queued) with the action spent and no way out.

Live evidence on #16469 (every ~60s):

stage labels: adoption refused, a person pushed this PR themselves; asking the author instead  pr=16469 author=Danathar author_kind=clanker reason=operator-forced forced=true

Decision

Operator ruling: a person may take over anyone's PR β€” owner, maintainer, contributor, bot. The #15202 rule stays for the hive's own initiative (automatic adoption) and for an adoption/supersede request; only an explicit, forced Adopt now by an authorized dashboard user bypasses it.

Changes

  • adoptContributorPR: the person-authored refusal applies only when !forced. A forced adoption over a person-authored PR logs operator-forced adoption over a person-authored PR with by=<actor>, author, author_kind, then proceeds through the normal forced path (maintainer policy, admission and presence already bypassed). MarkAdopted at the attempt consumes the forced mark as for any other author, so the row reads queued β†’ adopting β†’ adopted (or copy-failed / workflow-path refusal with its note) β€” never a permanent "queued".
  • handleRepoItemAdoptNow: the audit entry names author=<login> and author_owner=<bool> so an owner takeover stays attributable.
  • No UI change needed: the chip already reads takeover.forced_by β†’ adopted_by/adopted_by_state; the adopted copy's lineage keeps the original author (Lineage.FromAuthor, adopted_from.author).
  • Tests: TestAdoptNowTakesOverOwnerAuthoredPR (request label refused, forced adoption schedules the copy and consumes the mark), TestRepoItemAdoptNowOnOwnerAuthoredPR (200 + audit attribution). TestDelegatedSupersedeRefusesPersonAuthoredPR still passes (non-forced rule intact).

After deploy, the next stage-labels sweep adopts #16469 (forced mark is still pending on its record) and the fixer lane picks up the hive's copy.

@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 nicholasjackson 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.

An operator's Adopt now on a PR whose author is one of this hive's owners
recorded a forced adoption the stage engine refused on every sweep as
person-authored (#15202) without ever consuming it, so
the row sat at "adopting… (queued)" with the action spent.

The hive still never adopts a person's own PR on its own initiative, and
an adoption/supersede request is still refused for one; an explicit
forced Adopt now now bypasses that refusal and proceeds. The attempt
record (MarkAdopted) consumes the forced mark as for any other author,
so the row reads queued β†’ adopting β†’ adopted. The dashboard audit entry
names the author and whether they are a hive owner.

Fixes #16482

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the fix/adopt-now-owner-authored branch from 6898db6 to 25ec3e3 Compare November 4, 2026 00:19
@clubanderson clubanderson changed the title πŸ› adoption: refuse Adopt now on a hive owner's PR instead of queueing forever πŸ› adoption: operator Adopt now takes over any PR, owners included Nov 4, 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.

Correctness review (head 6898db6) β€” no blockers; the fix matches #16482's expected behaviour.

Verified: handleRepoItemAdoptNow refuses before NoteAdoptionForced (api_repo_item_decision_reroute.go:96-101), the engine clears the forced record on the person-authored refusal (automerge_contributor_adopt.go:653-658), and the dashboard's isAuthorizedUserLogin (delegated_pr_context.go:209-221) matches the engine's OwnerAuthor = dashboardOwnerLogin (src/cmd/hive/merge_eligibility.go:146-158) β€” both match any authorized_users entry, so the two guards cannot disagree.

Advisory (non-blocking): issue root cause 3 says the tracker "offers adopt_now: true on owner-authored rows". The new ownerAuthored case (stage_tracker_takeover.go:120) keys off it.Adoption.BlockedBy, which stageTrackerAdoption only sets after the engine has recorded a refusal at the current head (stage_tracker_adoption.go:118). So an owner's row that has not yet been swept (or just got a new push) still offers Adopt now; the press now returns 409 with the owner reason, so nothing sticks β€” just a button that cannot succeed.

Out of scope / pre-existing: on the live #16469 the adopt-supersede label the handler added stays on the PR, so after the forced record is consumed requested remains true and the refusal log line keeps firing each sweep (automerge_contributor_adopt.go:609,659), now with forced=false. Same as any requested refusal today.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

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 reviewer (folded here because this head already carries its hive review):

Read adoptContributorPR and the store at 25ec3e3; this looks correct to me and the blast radius is smaller than the title suggests.

  • src/pkg/github/automerge/automerge_contributor_adopt.go:647-648: the person-authored refusal is now gated on !forced, and forced (line 612) is only true for a pending AdoptForcedBy mark on a head not yet adopted β€” the automatic sweep and the adoption/supersede label still hit the πŸ› Owner/human-authored PR was adopt-superseded by hive after Let hive decide (contributor-offline rule)Β #15202 refusal unchanged (TestDelegatedSupersedeRefusesPersonAuthoredPR covers that and still passes in CI).
  • The forced takeover never pushes to the person's branch: canPushInPlace stays false when forced (line ~700, policy.AdoptInPlace && !requested && !forced), so the hive only opens a superseding copy with the original author in its lineage.
  • No permanent "queued" is possible after this: store.MarkAdopted (src/pkg/stagelabels/store.go:1550-1562) clears AdoptForcedBy/AdoptForcedAt and AdoptBlocked* on the attempt, so even a copy-failed outcome consumes the click.
  • author_owner in the audit uses isAuthorizedUserLogin, which matches any dashboard.authorized_users entry regardless of role β€” same definition dashboardOwnerLogin (src/cmd/hive/merge_eligibility.go:146) feeds to policy.OwnerAuthor, so the two sides agree on who counts as a "person".

Nothing to change from my side.

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

Read adoptContributorPR at 25ec3e3 (src/pkg/github/automerge/automerge_contributor_adopt.go:611-680). Looks correct to me.

  • The gate change is minimal and in the right place: forced is derived at :613-614 (and already cleared once the head is adopted), the person refusal at :649 now only fires for !forced, and the forced path falls through to the existing store.ClearAdoptionBlocked(key) at :678 β€” so the author-is-person note left by earlier sweeps is removed on the same sweep that adopts. TestAdoptNowTakesOverOwnerAuthoredPR pins both halves (request label still refused, forced mark consumed, no block survives).
  • personAuthored (:1573) is unchanged, so the non-forced rule from πŸ› Owner/human-authored PR was adopt-superseded by hive after Let hive decide (contributor-offline rule)Β #15202 is intact for automatic adoption and for adoption/supersede requests, as the body says.
  • Audit: handleRepoItemAdoptNow (src/pkg/dashboard/api_repo_item_decision_reroute.go:123) adds author/author_owner from facts, already fetched at :87.

One observation, not a defect: personAuthored also covers AuthorKind.Human, and TestRepoItemAdoptNowOnOwnerAuthoredPR exercises the endpoint as role writer. So after this lands any dashboard writer, not only an owner, can force-supersede an external human contributor's PR. The body's ruling ("an authorized dashboard user") reads as intending that, so no change requested β€” flagging only because the title says "owners included" and the reach is wider than owners.

CI was still running at the time of this read.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • mobile-shots

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Evidence bundle `#1648325ec3e3` sha256:dfd762e5ae6a3c93ec9a802f478007e439c8ac3816196081db89202c7d54eea6 β€” download from the dashboard or `hivectl review evidence #16483`.

@hivecommons-hive
hivecommons-hive Bot merged commit 5a73e1e into v5 Nov 4, 2026
79 of 82 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/adopt-now-owner-authored branch November 4, 2026 00:29
@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

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 25ec3e3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› Operator Adopt now on a hive owner's PR is refused every sweep and stays at adopting (queued)

1 participant