Repository navigation
π Adopt now overrides an earlier Approve; approve no longer deadlocks an unmergeable fork head - #15655
Conversation
⦠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>
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
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
|
Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. |
There was a problem hiding this comment.
Reviewed (correctness) at 33bb88a β no blockers. Two low advisories:
- Carried-approval note wording on a forced adoption β
src/pkg/github/automerge/automerge_contributor_adopt.go:1142.supersedeAdoptedPRnow appends the note wheneveradmittedBy != "", including the ApproveβAdopt-now path on a head that is mergeable as-is (TestForcedAdoptionOverridesAdmission, reasoncheck-failing:unit). ThereheadNotMergeableAsIs(obs) == "", so the copy body says "The hive could not merge that head as-is (check-failing:unit)" β or(β¦ as-is ())whenobs.Reason/LaneReasonare 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))
+ }- Queued state hides a standing hold β
src/pkg/dashboard/stage_tracker_takeover.go:112orderscase forcedPendingbeforecase held, andstage_tracker_adoption.go:185promises "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 atautomerge_contributor_adopt.go:703without consuming the forced mark, so the row reads "Adopting⦠(queued)" indefinitely andadopt_now_reasonbecomes "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
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
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 newheadNotMergeableAsIsshort-circuit sits after therequestedandlogin == ""returns and beforeNoteAdoptionBlocked, so the only behaviour change is: admitted + unmergeable-as-is now adopts instead of recording the blocker. The single caller isautomerge_contributor_adopt.go:718; nothing else reads the refusal.store.go:1396clearsAdoptBlocked*onNoteAdoptionForced, andMarkAdopted(store.go:1196-1197) already clears both the blocker andAdoptForcedBy, soAdoptionForced()is genuinely "pending until the copy opens" β the tracker'stakeoverAdoptNowQueued/QueuedBystate (stage_tracker_takeover.go:109-113,stage_tracker_adoption.go:126-135) cannot outlive the adoption.stage_tracker_adoption.go:123-125moves the already-adoptedreturn nilabove theNudgeCount == 0check; 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 tocreated.GetHead().GetSHA(); in thefixerResolvespath 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
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>
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>
β¦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>
Fixes #15654
Root cause.
adoptionRefusedByAdmissionrefused 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" andfork-not-editable. Adopt now then recorded the forced mark but leftadopt_blocked_*standing andtakeover.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 andcarryAdmissionToCopyrecords the approval on the copy's head; the copy body says Approval carried over.stagelabels/store.go:NoteAdoptionForcedclears the adoption blocker.adoption.queued_by,takeover.adopt_now=false+adopt_now_reason: adoption already queuedwhile forced is pending; caption Adoptingβ¦ (queued by @x β¦); Adopt now dropped from the popover options; no decision popover.tracker-words.js, bundle regenerated): chip adoptingβ¦ (queued), Adopt now hidden from the β― menu whenforced_by/queued_by.adoption-queuedstatus/wording when the copy did not open within the wait.src/docs/operator-reference.md; changelog fragment.Tests
TestOperatorAdmissionDoesNotBlockUnmergeableHead,TestHeadNotMergeableAsIs,TestForcedAdoptionOverridesAdmission(automerge);TestStageTrackerTakeoverQueuedAfterAdoptNow, updatedTestRepoItemAdoptNowWithoutSweepIsQueuedForm(dashboard).stage_tracker_adopt_queued.test.js(acted state after Adopt now).