Repository navigation
π fix(adoption): refuse a fixer push that undoes the adopted PR's change - #16816
Conversation
projectbluefin/utah#1091: the adopted fixer re-added the 25 triage entries the PR removed (a75a567), leaving a docs-only diff, and announced "sweep will merge when green". - automerge: each hive push on an in-place adoption is checked before the head is taken; if the PR's three-dot diff keeps less than half of the lines it changed, park 085 (adoption-fixer-reverts-pr) with one note and refuse the head in the contributor lane; unchecked heads wait (contributor-lane:adoption-intent-pending). - relay: an awaiting-ci note on an unchecked or refused adopted head no longer promises a merge. - dashboard caption/decision text; scanner policy tells the fixer to park instead of pushing such a commit. 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>
|
[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.
Read automerge_adoption_intent.go, both call sites in settleInPlaceAdoption (automerge_contributor_adopt.go:1979-1995), the lane gate at automerge_contributor_lane.go:1410, the escapeStalledAdoption branch at :2310, and adoptedAwaitingCINote at head 49a7da8. Looks correct to me.
What I checked specifically:
- The check cannot be skipped by the push-time path:
MarkHivePushedHead(automerge_contributor_adopt.go:1504,automerge_adoption_recovery.go:269) never setsAdoptedHead, so a hive-pushed head still satisfiesobs.HeadSHA != prev.AdoptedHeadat:1972and reachescheckAdoptedPushIntent. - Failure ordering: on a revert,
MarkAdoptionEscalatedprecedes the note andMarkAdoptedHeadfollows it, so a failed post re-enters next sweep (head still unmarked) andAdoptionEscalationNotedprevents a second note once it lands.adoptionIntentRefusedkeys onAdoptEscalatedHead == head, so an author push clears the refusal without a store reset. CompareCommitsis the three-dot endpoint, so a base merge the hive pushes contributes no+/-units and passes as the body says.prChangeUnitsskips+++/---headers and only readsline[0]after the empty check.
One thing a maintainer may want to be aware of, not a defect: the 50% line-retention rule compares against the last judged hive head, so a fixer that legitimately rewrites the PR's approach (same goal, different lines) also parks at 085. That matches the body's intent ("a fix must keep the PR's change"), just noting it is a content heuristic rather than a semantic one.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
49a7da8
βΉοΈ Sentinel notice β informational; author is trusted (owner), merge is not blockedHive flagged this PR (author @Danathar, head
Hive did not add the |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read this against What I verified
Two open questions on the heuristic, not defects β stating them so whoever merges knows the false-positive shape:
No action needed on either; the change does what it says and the tests fail without it. Review findings from Security perspective (head The fixer-reverts hold can be cleared by stale-red recovery, after which the refused head is admissible. In Suggested fix β keep the recovery release from touching a fixer-reverts verdict (it is a verdict on the head's content, not a CI state): (or move the No injection or trust-boundary issues in the new code paths otherwise: the note interpolates only SHAs and integer counts, the lane change is purely additive refusal, and the compare calls use the hive's own base ref/head SHA. Review findings from docs-currency (delta re-review at adc32cb) β approve from this perspective. The delta's docs track the code: One operator-facing doc the PR does not touch still describes the lane admission without the new gate:
Prior findings (not this perspective): the baseline-erosion items at Review findings from Correctness re-review at Previous findings: the refused-head-becomes-baseline issue is fixed ( 1. (still present) A transient 2. (new) The recovery sweep still reports the refused head as not escalated, so the label flaps 085 β 074 β 085 β if recovery := c.recoverStaleRedAdoption(ctx, store, key, obs, rec); recovery.Attempted {
+ if rec.AdoptionEscalated(obs.HeadSHA) && rec.AdoptEscalatedReason == stagelabels.LaneReasonAdoptionFixerReverts {
+ // A fixer-reverts refusal is a verdict on the head's content, not
+ // its CI: the rerun cannot restore the PR's change, so the PR
+ // stays at 085 while it runs.
+ return adoptionEscape{Escalated: true, Reason: stagelabels.LaneReasonAdoptionFixerReverts}, 0, nil
+ }
- if rec.AdoptionEscalated(obs.HeadSHA) && rec.AdoptEscalatedReason != stagelabels.LaneReasonAdoptionFixerReverts {
+ if rec.AdoptionEscalated(obs.HeadSHA) {
store.ClearAdoptionEscalation(key)and add to the recovery test after the second Review findings from Intent-alignment re-review at adc32cb (delta from 49a7da8; the v6 merge noise was skipped, only the fix commit was judged). Fixed since last head: refused push becoming the next baseline ( Still present β the body's "every hive push is checked before the hive takes it as its head" has one hole. Minor: Review findings from Style re-review at adc32cb (delta since 49a7da8; the ~180-file delta is almost all the v6 rebase β only the adoption-intent files were judged). Previous findings: the refused-head-becomes-baseline pair (correctness/intent-alignment, One advisory on the new guard, not blocking:
--- a/src/pkg/github/automerge/automerge_adoption_recovery.go
+++ b/src/pkg/github/automerge/automerge_adoption_recovery.go
@@ -77,7 +77,10 @@ func adoptionRecoveryCandidate(obs stageObservation, rec stagelabels.Record) bool {
- if rec.AdoptionEscalated(obs.HeadSHA) && rec.AdoptEscalatedReason == adoptionWorkflowRefusedReason {
+ // Verdicts on the head's content: a rerun or rebase cannot change them.
+ if rec.AdoptionEscalated(obs.HeadSHA) && (rec.AdoptEscalatedReason == adoptionWorkflowRefusedReason || rec.AdoptEscalatedReason == stagelabels.LaneReasonAdoptionFixerReverts) {
return false
}
--- a/src/pkg/github/automerge/automerge_contributor_adopt.go
+++ b/src/pkg/github/automerge/automerge_contributor_adopt.go
@@ -2319,7 +2319,4 @@
- // A fixer-reverts refusal is a verdict on the head's content, not
- // its CI: a rerun or rebase cannot restore the PR's change, so the
- // recovery never releases it.
- if rec.AdoptionEscalated(obs.HeadSHA) && rec.AdoptEscalatedReason != stagelabels.LaneReasonAdoptionFixerReverts {
+ if rec.AdoptionEscalated(obs.HeadSHA) {(and flip the test's Review findings from Read at What I verified
Low β a base merge after upstream lands the same change reads as a revert ( Low β Not a defect, just a note: the other compare call sites in this package wrap |
|
@Danathar this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (3 waiting): fixes are handed out before new work as soon as you have capacity. |
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
β¦eep the refusal through recovery Review findings on hivecommons#16816 at 49a7da8: - ci-maintainer/adjudicator: a refused head became the next check's baseline. Record.AdoptedIntentHead (set in MarkAdoptedInPlace, IntentBaseHead falls back to AdoptedHead) is the baseline for every push. - adjudicator-2: stale-red recovery cleared any escalation; it no longer clears adoption-fixer-reverts-pr. - reviewer: the awaiting-ci rewrite now needs a hive push (recorded or App-linked commit); an author's push keeps its note. 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>
|
Fixed all three findings from the status comment at
Mutants for these fixes: 7 of 7 caught. The suites pass: |
There was a problem hiding this comment.
Read automerge_adoption_intent.go in full, the three call sites (settleInPlaceAdoption, escapeStalledAdoption, evaluateContributorLanePR), Store.MarkAdoptedInPlace/MarkAdoptedHead/IntentBaseHead, and adoptedAwaitingCINote, at head adc32cb on top of v6. go build ./pkg/github/... ./pkg/stagelabels ./pkg/dashboard and gofmt are clean; CI on the head is green apart from tide.
The guard does what it says, and the fail-safe paths hold. Verified:
- Both hive-advance branches in
settleInPlaceAdoption(automerge_contributor_adopt.go:1981,:1994) now deferMarkAdoptedHeadtocheckAdoptedPushIntent, so an unreadable compare leaves the head unmarked;adoptedHeadOwnedByHiveadmits onlyAdoptedHead, andadoptionIntentRefusedreturnsadoption-intent-pendingfor a recorded hive push that is not yetAdoptedHead. Nothing merges a head the check has not passed. - On refusal the escalation is recorded before the note and
MarkAdoptedHeadruns only after the note posts, so a failed post is retried next sweep and the second sweep (AdoptionEscalationNoted) does not re-post. The stale-red recovery exclusion and theescapeStalledAdoptionhold both key onLaneReasonAdoptionFixerReverts, so the 085 park survives reruns. prChangeUnitsskips+++/---headers,@@lines and\ No newline, counts a patch-less file as one unit per status, andjudgeAdoptionIntenttakesmin(n, now[unit])per multiset key β a moved hunk is kept, a reworded one is not, which is the intended "lines" semantics the body describes.- Three-dot
CompareCommits(base, head)means a base merge in the fixer push is not counted against the PR (adoptedPushIntent).
One baseline gap (low), worth a look:
AdoptedIntentHead is set only in MarkAdoptedInPlace (stagelabels/store.go:1609). But settleInPlaceAdoption keeps the adoption and advances AdoptedHead on a head the hive did not push in three places β commit lookup failed (automerge_contributor_adopt.go:1989), adoption_strict_attribution off (:1998), and no repo push evidence yet (:2003) β without touching AdoptedIntentHead. In those configurations an author who pushes to their own adopted PR (say, splitting half the change out to a separate PR, as the hive's own notes often ask) leaves the baseline at their original head; the next hive fix push is then judged against a diff the author already narrowed and can be refused as adoption-fixer-reverts-pr for lines the hive never removed. Under strict attribution with repo evidence this cannot happen (an author push yields and a re-adoption resets the baseline), so the default is safe. If the intent is "the contributor's latest head", refreshing AdoptedIntentHead alongside AdoptedHead on those three non-hive paths closes it; TestIntentBaseHead covers the hive-push case but not an author advance.
Threshold being non-configurable is fine by me for a first cut; the body states it plainly.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@Danathar this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (9 waiting): fixes are handed out before new work as soon as you have capacity. |
There was a problem hiding this comment.
Decision needed: @clubanderson should confirm the scanner-automerge.md policy edit (fixer must keep the PR's change; park with needs-human when CI can pass only by undoing it) β it touches hive policy text, which a maintainer signs off rather than the hive.
The code looks correct to me; the only thing left is a maintainer sign-off on the policy text.
What I verified against the tree at b4171e9:
src/pkg/github/automerge/automerge_contributor_adopt.go:1980-1996β both hive-push branches ofsettleInPlaceAdoptionnow go throughcheckAdoptedPushIntentinstead ofMarkAdoptedHeaddirectly. The early return at:1973(obs.HeadSHA == prev.AdoptedHead) still fires on later sweeps becausecheckAdoptedPushIntentcallsMarkAdoptedHeadafter escalating (automerge_adoption_intent.go:150), so a refused head is judged once and the note cannot repost (AdoptionEscalationNoted,store.go:1535).automerge_adoption_intent.go:161-172βadoptionIntentRefusedkeys offAdoptEscalatedReason == LaneReasonAdoptionFixerReverts, andescapeStalledAdoption(automerge_contributor_adopt.go:2321-2325,:2342) now excludes that reason from both the stale-red release and the reason-cleared path, so nothing I could find clears the refusal short of a new head. The gate is wired before any admission path inevaluateContributorLanePR(automerge_contributor_lane.go:1408-1411).store.go:1606-1609βAdoptedIntentHeadis set only inMarkAdoptedInPlaceand never touched byMarkAdoptedHead(:1636-1649), so the baseline really is the contributor's head for the life of the adoption;IntentBaseHeadfalls back toAdoptedHeadfor pre-existing records, which means those (and only those) remain judged push-over-push until they re-adopt. That seems like an acceptable transition.automerge_adoption_intent.go:88-94β three-dotCompareCommitswithPerPage: 300matches the compare API's 300-file ceiling, andjudgeAdoptionIntentrefuses to judge at>= 300rather than scoring a truncated list.issue_request_status_notes.go:63-86β the awaiting-ci rewrite only runs for theawaiting-cikey on a record thatAdoptedInPlace(), and leaves the body untouched on any API error, so it cannot alter other notes.src/policies/scanner-automerge.mdandsrc/pkg/policies/defaults/scanner-automerge.mdare byte-identical after the edit.
One observation, not a defect: prChangeUnits (automerge_adoption_intent.go:44-60) matches lines by exact (trimmed) text, so a fixer push that reformats or rewrites most of a very small PR's lines will read as a revert and park at 085. That is the conservative direction, and the note tells the person what happened, so I would leave it.
I could not run go test on this host; the hub/agent/rest shards and patch-coverage are green on this head.
Routing rather than confirming outright only because the diff edits hive policy text; the edit narrows what the fixer may do, and the author is an approver.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦the reviewer approves it (#17000) The undo guard (#16816) parks an in-place adopted PR at 085 when a hive push keeps less than half of the PR's changed lines. On projectbluefin/utah-packages#943 the hive adopted the PR for the review swarm's requested changes, and its push dropped the two wontfix entries exactly as the review asked. The guard parked it, and the park held until the head moved, so a later verdict was never read. An in-place adoption now records whether it was taken for the review asks with CI not red (adopted_for_review). For such an adoption a push the guard would refuse is taken once the reviewer's verdict on that exact head is approve: at the push check, in the contributor lane gate, and on each stage pass, which releases a park posted before the verdict arrived. An adoption for red CI (the utah#1091 shape) stays refused even with an approve, and any other verdict keeps the park. Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Danathar <Danathar@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Executive summary
On projectbluefin/utah#1091 (fork
thatguywob,maintainer_can_modify), the PR removes 25 resolved entries frombaselines/triage.toml(projectbluefin/utah@b6734c2). The adopted fixer (scanner) pushed projectbluefin/utah@a75a567 at 2026-11-03 21:10:13Z, re-adding all 25. That left a docs-only diff (+10). At 21:10:35Z it posted "hive/awaiting-ci: CI pending β sweep will merge when green". Only the reviewer caught it, at 21:42Z. The right move was to wait for projectbluefin/utah#1074, which the PR body and the hive's own review both named as the dependency.This PR checks every hive push on an in-place adopted PR against the PR's own change before the hive takes it as its head. The check: the PR's diff against its base must still carry at least half of the lines the PR changed at the contributor's head the adoption started from. Every push is judged against that same head, so a push on top of a refused one stays refused and a chain of pushes cannot erode the change. A push that fails is refused:
stage/085-needs-decisionwith reasonadoption-fixer-reverts-prand one "Fixing CI would undo this PR's change" note.What
adoption-fixer-reverts-pr, one note naming kept/total lines, lane refuses that head; a new push re-checkscontributor-lane:adoption-intent-pending; re-read next sweephive/awaiting-ci: β¦ sweep will merge when greenon an unchecked or refused headneeds-humaninsteadWhy
git push; scanner-automerge.md allows that onstage/074-adopted-by-hive. The push-branch relay only publishes same-repo branches, so there is no pre-push hook to intercept. The hive does see the push insettleInPlaceAdoption, which takes a head as the hive's only after this pass. The contributor lane's adoption admission (adoptedHeadOwnedByHive) only admits that exact head. Checking there is therefore checking before anything merges.How
automerge/automerge_adoption_intent.go(new):judgeAdoptionIntentturns each file's patch into a multiset of+/-lines, or one unit for a file with no patch, then counts how many units of the pre-push diff survive in the post-push diff.adoptedPushIntentreads both diffs with three-dotcompare/<base>...<head>, so a base merge is not counted.checkAdoptedPushIntentjudges againstRecord.IntentBaseHead(): the newAdoptedIntentHead, set inMarkAdoptedInPlace, orAdoptedHeadfor older records.MarkAdoptedHead.MarkAdoptionEscalated(LaneReasonAdoptionFixerReverts), then the note (once per head), thenMarkAdoptedHead, so a failed post is retried.adoptionIntentGateis the lane refusal.automerge_contributor_adopt.go: both "advanced by the hive" branches (App-linked commit, recorded hive push) call the check. The escape keeps this escalation until the head moves, like copy-failed, and stale-red recovery never clears it.automerge_contributor_lane.go: the gate runs right after the closing-contradiction gate, before any admission path.github/issue_request_status_notes.go:adoptedAwaitingCINotereads the stage record and the PR head, only for an awaiting-ci note on an in-place adopted PR. It rewrites only a hive push: recorded push evidence or a commit GitHub links to the App. An author's push keeps the note.stagelabels.LaneReasonAdoptionFixerReverts; dashboard caption and decision text.Tests
TestJudgeAdoptionIntentTestAdoptedFixerPushThatRevertsPRIsRefusedTestAdoptedRecordedHivePushThatRevertsPRIsRefusedOnceTestAdoptedFixerPushThatKeepsPRIsAllowedTestAdoptedFixerPushIntentUnreadableHoldsMergeTestTrySweepContributorLanePRAdoptedByHiveAdmission(+2 rows)TestAdoptedFixerPushOnTopOfRefusedHeadStaysRefusedTestAdoptedFixerPushChainCannotErodeChangeTestAdoptedFixerRevertsSurvivesStaleRedRecoveryTestIntentBaseHeadAdoptedHeadTestAwaitingCINoteOnAdoptedPRWaitsForIntentCheckTestStageTrackerAdoptionFixerRevertsSaysWhyOwn > 0is implied byKept*2 < Own)go testgithub/..., stagelabels, policies, writeback, dashboardcheck-docs-citations.py src/docs, writeback ratchet, gofmtNotes
a75a56730dd8has not moved for 2m and the hive has nothing it can push:adoption-stalled:fork-rehome-refusedβ¦ cannot finish it on the fork's own branch" came three minutes after the App pushed to that branch. It means a re-home was attempted on a75a567 and refused (ForkRehomeRefusedon that head), but which re-home reason fired, and why, isn't readable from the PR alone. I didn't guess at a fix. With this change that head would have parked at 085 for the revert first.π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1