Skip to content

πŸ› Adopt now overrides an earlier Approve; approve no longer deadlocks an unmergeable fork head - #15655

Merged
clubanderson merged 1 commit into
v5from
fix/adopt-overrides-approve
Oct 30, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/adopt-overrides-approve

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15654

Root cause. adoptionRefusedByAdmission refused adoption whenever the head carried an operator admission, even when the contributor lane could not merge that head as-is (fork not editable + behind base) β€” a deadlock between "a maintainer approved this head; the hive merges it as-is" and fork-not-editable. Adopt now then recorded the forced mark but left adopt_blocked_* standing and takeover.adopt_now: true, so the tracker kept the stale blocker caption and re-offered Adopt now until the periodic sweep ran (~3.5 min on hive#15312), while the API response had promised "the pass now running".

Changes

  • automerge_operator_admission.go: admission stands down only when the head is mergeable as-is (headNotMergeableAsIs: fork-not-editable, conflicting, not-mergeable, needs-rebase, dco-missing). Otherwise the hive adopts and carryAdmissionToCopy records the approval on the copy's head; the copy body says Approval carried over.
  • stagelabels/store.go: NoteAdoptionForced clears the adoption blocker.
  • Tracker: adoption.queued_by, takeover.adopt_now=false + adopt_now_reason: adoption already queued while forced is pending; caption Adopting… (queued by @x …); Adopt now dropped from the popover options; no decision popover.
  • SPA (tracker-words.js, bundle regenerated): chip adopting… (queued), Adopt now hidden from the β‹― menu when forced_by/queued_by.
  • API: adoption-queued status/wording when the copy did not open within the wait.
  • Docs: approve-vs-adopt semantics table in src/docs/operator-reference.md; changelog fragment.

Tests

  • Go: TestOperatorAdmissionDoesNotBlockUnmergeableHead, TestHeadNotMergeableAsIs, TestForcedAdoptionOverridesAdmission (automerge); TestStageTrackerTakeoverQueuedAfterAdoptNow, updated TestRepoItemAdoptNowWithoutSweepIsQueuedForm (dashboard).
  • Node: stage_tracker_adopt_queued.test.js (acted state after Adopt now).

… an unmergeable head

A maintainer's Approve on a contributor PR whose fork the App cannot
update (behind the base, fork-not-editable) locked the PR into 'merge
as-is' while the merge itself failed every cycle, and Adopt now left the
row saying 'not adopted … the hive merges it as-is' with the action still
offered until the sweep landed minutes later.

- adoptionRefusedByAdmission stands down only when the head is mergeable
  as-is; otherwise the hive adopts and carries the approval to its copy
  (decision approval on the copy head + body note).
- NoteAdoptionForced clears the adoption blocker; the tracker renders the
  acted state (adoption.queued_by, takeover.forced_by, adopt_now=false,
  no decision popover) and the SPA hides Adopt now and shows
  'adopting… (queued)'.
- Adopt now answers adoption-queued when the copy has not opened within
  the wait instead of claiming the running pass will open it.
- Tests (Go + node), operator-reference docs, changelog fragment.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 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.

PR Title Relation Files
#15657 πŸ› Tracker: chevron column follows the current state, never the highest stage reached same files src/pkg/dashboard/static-src/js/tracker-words.js
src/pkg/dashboard/static/index.html
#15530 πŸ› fix(dashboard): issue-row linked PR passes null when the lineage chip is empty same files src/pkg/dashboard/static/index.html
#15658 πŸ› fix(tracker): PRs at CI / Review ride no merge train; overlap hint instead same files src/pkg/dashboard/static-src/js/tracker-words.js
src/pkg/dashboard/static/index.html
#15662 πŸ› Adopt stuck contributor PRs automatically from the tracker's offer predicate CONFLICT src/pkg/dashboard/stage_tracker_adoption.go
#15637 πŸ“– community: list the Twitch live stream everywhere community links live same files src/docs/operator-reference.md
src/pkg/dashboard/static/index.html
#15664 πŸ› tracker: a PR waiting on its author never leads with Close as superseded same files src/pkg/dashboard/stage_tracker_decision.go
src/pkg/dashboard/stage_tracker_presence.test.js
src/pkg/dashboard/static-src/js/tracker-words.js
src/pkg/dashboard/static/index.html
#15652 ✨ feat(dashboard): Contributors sidebar pill reads online/total same files src/pkg/dashboard/static/index.html
#15633 🌱 refactor: split stage tracker UI tests same files src/pkg/dashboard/static/index.html
#15632 🌱 refactor: split tracker words source same files src/pkg/dashboard/static-src/js/tracker-words.js
#15641 πŸ› review: only a security finding parks an untrusted PR during CI/Review same files src/pkg/dashboard/stage_tracker_decision.go
#15566 🌱 refactor: split stage tracker UI tests same files src/pkg/dashboard/static/index.html
#15516 πŸ“– docs: split the operator reference CONFLICT src/docs/operator-reference.md
#15405 πŸ› fix: require verified signature for email-only hive commit identity match same files src/docs/operator-reference.md
#15565 🌱 refactor: split tracker words source same files src/pkg/dashboard/static-src/js/tracker-words.js

@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 (intent-alignment) β€” the diff covers all three fix points of #15654: forced Adopt clears the admission blocker (src/pkg/stagelabels/store.go:1396) and bypasses adoptionRefusedByAdmission (automerge_contributor_adopt.go:716-718); approve on a non-mergeable-as-is head adopts and carries the approval to the copy (automerge_operator_admission.go:77-80, automerge_contributor_adopt.go:1013-1015); the API answers adoption-queued when no copy opened within the wait (api_repo_item_decision_reroute.go:174). No in-scope gaps found between body and diff.

Advisory (not blocking): in stage_tracker_takeover.go:112-113 the forcedPending case now precedes held, so a row that gets a hold/do-not-merge label after Adopt now was pressed reads "Adopting… (queued …; the hive opens its copy on the next stage pass)" indefinitely, while the engine returns early on adoptionBlocked(obs.Labels) (automerge_contributor_adopt.go:701-704) without consuming AdoptForcedBy. The docs still say "hold still stops it". Consider ordering held first so the reason stays release the hold first:

	switch {
	case held:
		out.AdoptNowReason = takeoverAdoptNowDisabledHold
	case forcedPending:
		out.AdoptNowReason = takeoverAdoptNowQueued
	case !adoptionEnabled:
		out.AdoptNowReason = takeoverAdoptNowDisabledOff

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

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

@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=adjudicator-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.

Reviewed (correctness) at 33bb88a β€” no blockers. Two low advisories:

  1. Carried-approval note wording on a forced adoption β€” src/pkg/github/automerge/automerge_contributor_adopt.go:1142. supersedeAdoptedPR now appends the note whenever admittedBy != "", including the Approveβ†’Adopt-now path on a head that is mergeable as-is (TestForcedAdoptionOverridesAdmission, reason check-failing:unit). There headNotMergeableAsIs(obs) == "", so the copy body says "The hive could not merge that head as-is (check-failing:unit)" β€” or (… as-is ()) when obs.Reason/LaneReason are both empty β€” although the real cause is the operator's Adopt now. Suggest wording the forced case separately:
-				Body:  gh.Ptr(AdoptionPRBody(obs, rec, dcoRehome, resignedTip) + adoptionCopyConflictNote(obs, fixerResolves) + adoptionCarriedApprovalNote(obs, admittedBy)),
+				Body:  gh.Ptr(AdoptionPRBody(obs, rec, dcoRehome, resignedTip) + adoptionCopyConflictNote(obs, fixerResolves) + adoptionCarriedApprovalNote(obs, admittedBy, forcedBy)),
 ...
-func adoptionCarriedApprovalNote(obs stageObservation, login string) string {
+func adoptionCarriedApprovalNote(obs stageObservation, login, forcedBy string) string {
 	if login == "" {
 		return ""
 	}
+	if why := headNotMergeableAsIs(obs); why == "" || forcedBy != "" {
+		return fmt.Sprintf("\n\n**Approval carried over:** @%s approved #%d at head `%s`; @%s chose re-authoring (Adopt now). The approval travels with the content.\n", login, obs.Number, shortSHA(obs.HeadSHA), nonEmpty(forcedBy, login))
+	}
  1. Queued state hides a standing hold β€” src/pkg/dashboard/stage_tracker_takeover.go:112 orders case forcedPending before case held, and stage_tracker_adoption.go:185 promises "the hive opens its copy on the next stage pass". If a hold label is on the row (set before or after Adopt now), the engine returns at automerge_contributor_adopt.go:703 without consuming the forced mark, so the row reads "Adopting… (queued)" indefinitely and adopt_now_reason becomes "adoption already queued" instead of "release the hold first". Suggest keeping the hold reason visible:
	switch {
	case held:
		out.AdoptNowReason = takeoverAdoptNowDisabledHold
	case forcedPending:
		out.AdoptNowReason = takeoverAdoptNowQueued

(and optionally append " β€” held; release the hold first" to the queued text when slices.Contains(it.Modifiers, modHold)).

Verified against #15654: NoteAdoptionForced clears AdoptBlocked* (stagelabels/store.go:1396), MarkAdopted still clears the forced mark (store.go:1197) so the queued state ends when the copy opens, and recordedHumanApprovalForHead (automerge_review_gate.go:342) reads the decision-sourced approval carryAdmissionToCopy records, so the copy's requires_human is released as described. No SPA consumer of the old adoption-forced status string exists at head.

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

@clubanderson
clubanderson merged commit c2a3287 into v5 Oct 30, 2026
81 of 84 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/adopt-overrides-approve branch October 30, 2026 03:54
@github-actions

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

Read the diff against v5 (merge-base ed091b4), the admission/adopt call path, and the store lifecycle; go build of pkg/github/automerge, pkg/dashboard, pkg/stagelabels passes on the head. This looks correct to me.

What I verified

  • automerge_operator_admission.go:77-80 β€” the new headNotMergeableAsIs short-circuit sits after the requested and login == "" returns and before NoteAdoptionBlocked, so the only behaviour change is: admitted + unmergeable-as-is now adopts instead of recording the blocker. The single caller is automerge_contributor_adopt.go:718; nothing else reads the refusal.
  • store.go:1396 clears AdoptBlocked* on NoteAdoptionForced, and MarkAdopted (store.go:1196-1197) already clears both the blocker and AdoptForcedBy, so AdoptionForced() is genuinely "pending until the copy opens" β€” the tracker's takeoverAdoptNowQueued / QueuedBy state (stage_tracker_takeover.go:109-113, stage_tracker_adoption.go:126-135) cannot outlive the adoption.
  • stage_tracker_adoption.go:123-125 moves the already-adopted return nil above the NudgeCount == 0 check; both branches return nil, so ordering is behaviour-preserving for existing rows and only matters for the new forced branch.
  • carryAdmissionToCopy (automerge_operator_admission.go:115-130) keys the approval to created.GetHead().GetSHA(); in the fixerResolves path the fixer pushes a new head afterwards (requestAdoptionCopyRebase, automerge_contributor_adopt.go:1018), so a carried approval goes stale exactly when the content changes. Good β€” that is the conservative outcome.

One thing for a second maintainer's eye (not a defect)

automerge_operator_admission.go:122 records the carried approval with Actor: login, Source: decision β€” i.e. the ledger will show @login approving the hive's copy, a PR they never looked at, at a head they never saw. The Body says "carried from #N head X" so it is auditable, but anything that lists approvals by actor (activity monitor, /hive decision history) will attribute it to the person. If that is acceptable policy, fine; if not, a distinct Source/Kind for carried approvals would keep the audit trail honest without changing the merge outcome. The body states this trade-off was chosen deliberately, so I am noting it rather than asking.

go test is blocked on this host, so the new Go tests are unverified by me.

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

clubanderson added a commit that referenced this pull request Oct 30, 2026
hive's own #15654 (000 New, filed seconds ago) nested the open #15655
drawn as "PR in progress", yet sorted at the bottom among the New rows:
stageTrackerSortKey fell back to the parent's unlabelled stage when the
nested PR had none, while the strip drew it at 040 covered-by-PR.
stageTrackerLead / stageTrackerLeadStage are now the one rule both read.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
clubanderson added a commit that referenced this pull request Oct 30, 2026
hive's own #15654 (000 New, filed seconds ago) nested the open #15655
drawn as "PR in progress", yet sorted at the bottom among the New rows:
stageTrackerSortKey fell back to the parent's unlabelled stage when the
nested PR had none, while the strip drew it at 040 covered-by-PR.
stageTrackerLead / stageTrackerLeadStage are now the one rule both read.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
clubanderson added a commit that referenced this pull request Oct 30, 2026
…t stage reached (#15657)

* πŸ› Tracker: chevron column follows the current state, never the highest stage reached

A PR under repair (070 fixing, 071 needs-author, 072 returned-to-
contributor, 074 adopted-by-hive, or a red required check) lights
CI / Review even while a stale merge-failed gate or a planner-ordered
merge train still rides on its record. Hive's own #15574 read
"Fixing Β· conflicting" under Merge queue after a refused merge:
the merge_gate (merging / merge-failed) promotion still won.

One predicate now decides both the column and train membership:
stageTrackerTrainUnderRepair (Go; stageTrackerItemColumn) and its SPA
mirror stageTrackerUnderRepair (stageTrackerAnchor). left_train is
mirrored onto linked_prs[]. Ratchet tests pin every PR stage Γ— gate
state Γ— train state Γ— reason to its column on both sides, and a
payload test replays #15574.

Fixes #15656

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

* πŸ› Tracker: a covered issue's list place follows its strip's live work

hive's own #15654 (000 New, filed seconds ago) nested the open #15655
drawn as "PR in progress", yet sorted at the bottom among the New rows:
stageTrackerSortKey fell back to the parent's unlabelled stage when the
nested PR had none, while the strip drew it at 040 covered-by-PR.
stageTrackerLead / stageTrackerLeadStage are now the one rule both read.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

---------

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Approve on an unmergeable fork head deadlocks adoption; Adopt now leaves the row offering Adopt now

1 participant