Repository navigation
π fix(adoption): never move a fork PR's code into a base-repo branch (re-home ran fork code as trusted) - #14306
Conversation
|
[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 No conflicting open PRs or same-file overlaps were found. |
|
@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. Your relay session received this as a |
|
@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 (0 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 policy change this encodes: fork PRs the hive cannot push to are no longer re-homed to hive/adopt-N under any supersede reason and instead park at 085 for a maintainer.
Conclusion: the code does what the body says and the mechanism it closes is real; I found no defect. It is a merge/trust policy change (fork code never gets promoted to a base-repo branch), so a maintainer other than the author should sign off on the policy itself. It also needs a rebase: v6 has moved past this head in the same file.
Read the PR head 6c9d09b against its v6 merge-base, plus canPushToPRBranch, settleAdoption, adoptionStalledReason, the stage-label observer and the store.
What I verified
supersedeAdoptedPRis the single sink for every re-home path β callers atautomerge_contributor_adopt.go:610(grace/offline),:730(dco-rehome) and:1094(in-place-stalled) β so the guard at:614-619covers all of them.adoptionFromFork(:777-779) treats an emptyHeadRepoas a fork.HeadRepois only empty when GitHub'shead.repois null (automerge_stage_labels.go:391-393, a deleted fork), andcanPushToPRBranch:785already treats that as not-pushable, so the two agree and a base-repo PR cannot be misclassified.- The refusal is keyed per head (
ForkRehomeRefusedHead,store.go), so a new push re-evaluates;adoptionStalledReasonpicks it up before thesupersede-failedcase (:1045-1047) and the existing 085 escape carries the maintainer ask fromadoptionBlockerText:467-469. - Nothing is pushed or opened on the refused path; in-place adoption on the fork's own branch (with
maintainer_can_modify) is untouched, as the body states.
Needs before merge
- Rebase.
mergeable=CONFLICTING:647dbeaa8(#14303) landed on v6 and changedautomerge_contributor_adopt.goandlabels-and-control-signals.md. The intent looks complementary (#14303 parks maintainer-only blockers at 085, which is exactly where this relies on landing), but I could not confirm the merged text β please resolve and re-run the adoption tests. - #14305 (same author) also inserts a guard at the top of
supersedeAdoptedPR; whichever lands second will conflict there too.
Consequence worth stating plainly for the decider
After this, a fork PR whose author did not tick "allow edits by maintainers" can never be finished by the hive β every supersede reason, including a failing DCO, ends at 085 with a note. That is the intended trade (the utah-packages#609 β #626 canary publish shows why), but it is a visible behaviour change for every repo the hive serves, which is why I am routing it rather than calling it fine.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@Danathar the hive has adopted this PR ( |
Superseding an adopted PR (grace, offline, dco-rehome, in-place-stalled) pushes its head to hive/adopt-<n> inside the base repository and opens a same-repository PR from it. For a fork PR that runs the fork's unreviewed code with the repository's trusted CI: secrets, write tokens, and none of its fork-only guards. projectbluefin/utah-packages#609 was re-homed as projectbluefin/utah-packages#626, whose Canary run published and Sigstore-signed ghcr.io/projectbluefin/utah-packages:canary-pr626 from that code. supersedeAdoptedPR now refuses when the head repository is not the base repository (or is unknown), records the refusal per head, and the stalled-adoption escape parks the PR at 085 as adoption-stalled:fork-rehome-refused with a maintainer ask. In-place adoption on the fork's own branch is unchanged; in-repo PRs are re-homed as before. The adoption test fixture now defaults to an in-repo branch so the supersede mechanics stay covered, with forkPR for the fork cases. 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>
6c9d09b to
b99dd02
Compare
|
hive/awaiting-ci: rebased onto π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether the hive must refuse every forkβbase-repo re-home (parking such PRs at 085) rather than keep a maintainer-approval exception; this is a merge/trust-policy change authored by a fellow approver.
Read the code at head b99dd02 against v6; the change does what the body says and I found no defect. Routing to an approver because it changes adoption/trust policy, not because anything is wrong.
What I verified in the tree:
supersedeAdoptedPRreally is the single funnel: all three call sites βautomerge_contributor_adopt.go:616(grace/offline),:735(dco-rehome),:1135(in-place-stalled) β go through it, so the newadoptionFromForkguard covers every re-home path.- The 085 park actually happens. Each caller runs
store.MarkAdopted(key, head, 0, now)first, andMarkAdoptedsetsAdoptMode = AdoptModeSupersede(stagelabels/store.go:990). On the next passinPlaceRehomeReasonreturns""(AdoptedInPlace()is false,:1072), soescapeStalledAdoptionfalls through toadoptionStalledReason, where the newForkRehomeRefusedcheck sits ahead ofAdoptionAttemptedNothingOpened(:1116). The in-place-adopted fork can't loop back into another supersede. - Fail-closed on unknown head repo is consistent with existing code:
obs.HeadRepohas one population point (automerge_stage_labels.go:400) andcanPushToPRBranchalready returns false when it is empty (:822). - Fixture flip (
adoptPRβ in-repo, newforkPR) is the right move; it means the surviving supersede tests exercise the shape that is still allowed.
Not a defect, just for the approver's awareness: with this change a fork PR whose author disallows maintainer edits can never be finished by the hive β it always parks at 085. The body states that trade explicitly ("Not in this PR"), so it is a policy choice, not an oversight. CI on this head was still running when I read it.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @b99dd02, 47/47 checks green, DCO yes, soak 0s of 30m0s. How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
#14354) A PR the hive opens to supersede an adopted contributor PR starts at the contributor's head, unchanged, but Sentinel judged it by its author, the App: a blocking alert on the contributor's PR became an "author is trusted (hive agent)" notice on the App's copy of the same commit, and no merge lane was stopped. Since #14306 forks are no longer re-homed, but every supersede path still runs for a same-repo branch of a non-maintainer. The sweep now reads the adopted PR and its author from the supersede line AdoptionPRBody writes and decides trust by that author. A maintainer's clearance of the same head on the adopted PR carries over; later heads are judged afresh. 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>
β¦or until the 072 dwell (#15018) A fork PR is never superseded or re-homed into the base repository (#14306), so adopting one the hive cannot push to only parked it at stage/085 on the next pass, 15 minutes after the author's relay went offline. Decline that adoption instead: the PR stays at 072 with its nudge and the relay's fix-pr task, and escalateUnadoptableFork parks it at 085 with the same maintainer ask once the head has waited the 072 dwell since the nudge. The stage engine reads the new pass fact ForkEscalationReason so enforce-mode derives the same stage. In-place fork adoption, same-repository adoption and explicit owner-delegated adoption are unchanged. 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>
Summary (security)
When the hive supersedes an adopted PR, it pushes the PR's head to
hive/adopt-<n>inside the base repository and opens a same-repository PR from it. This applies to every path: grace, offline,dco-rehomeandin-place-stalled. For a fork PR, that move runs the fork's unreviewed code with the repository's trusted CI: secrets, write tokens, and none of its fork-only guards. The hive should never raise a change's trust level by moving it.Evidence
All times are 2026-10-25 UTC.
kylerankin, came from the forkkylerankin/utah-packages. Its requiredCanarycheck refuses forks by design ("a fork pull request cannot publish the canary imageβ¦"). The repository has a maintainer-run fork path,.github/workflows/canary-fork-pr.yml.reason=grace-elapsed).reason=dco-rehome mode=supersede) and opened import: codecs-media batch (libultrahdr, svt-vp9-libs)Β projectbluefin/utah-packages#626 fromprojectbluefin/utah-packages:hive/adopt-609. The GitHub compare API reports import: codecs-media batch (libultrahdr, svt-vp9-libs)Β projectbluefin/utah-packages#626's head identical to the fork heada649edc.pull_requestevent, run 40225945814, jobpass1 / publish / publish) publishedghcr.io/projectbluefin/utah-packages:canary-pr626, digestsha256:e1c0b97c88e6a7e97467779e532fdaff75df32b79302159d66e50db1cc056684. It signed it keyless through Sigstore: the log showstlog entry created with index: 3466681712and3466717091, thenPushing signature to: ghcr.io/projectbluefin/utah-packages.Change
supersedeAdoptedPR, the single path every supersede and re-home goes through, refuses when the head repository is not the base repository. An unknown head repository, such as a deleted fork, counts as a fork. It records the refusal for that head (ForkRehomeRefusedHeadin the stage store), pushes nothing and opens nothing.stage/085-needs-decisionasadoption-stalled:fork-rehome-refused. Its one note names the fork, explains why the hive did not move it, and asks a maintainer to review the change and bring it in themselves (or follow the repository's fork process), or to close it.hive-merge.md(adoption section), thestage/074row inlabels-and-control-signals.md, and asecurity-changelog fragment.Testing
go test ./pkg/github/automerge/... ./pkg/stagelabels/... ./pkg/stageengine/... ./pkg/github/ ./pkg/dashboard/... ./cmd/hive/... -count=1(run fromsrc/): allok:pkg/github/automerge1.9s,pkg/stagelabels,pkg/stageengine(+prstage,stageenginetest),pkg/github50.2s,pkg/dashboard106.9s (+collect,theme,webstatic),cmd/hive12.2s.The adoption test fixture (
adoptPR) previously defaulted to a fork head, so every supersede test was a fork supersede. It now defaults to a branch of the base repository, so the supersede and re-home mechanics stay covered on the shape still allowed;forkPRbuilds the fork case. 18 existing tests failed on the new rule before this switch; afterwards, 15 pass unchanged and three were fork scenarios:TestAlreadyAdoptedInPlaceForkDCOFailureIsNotRehomed(wasβ¦AppAuthoredDCOFailureWithoutPushRehomes)mallory/widget, trusted CI and the maintainer ask.TestAdoptionForkWithoutPushIsNotSuperseded(wasβ¦InPlaceFallsBackToSupersede)TestAdoptionOnlineGraceThenAdoptNew tests:
TestAlreadyAdoptedInPlaceInRepoDCOFailureWithoutPushRehomes: the in-repo DCO re-home still happens and the original is shut.TestAdoptionForkWithPushStaysInPlace: a fork with maintainer edits is still adopted in place.TestAdoptionFromFork: in-repo (any case), fork, and unknown head.Guards and checks:
BASE_REF=v6 bash src/scripts/check-changelog-fragment.shis OK,go vetis clean, andgofmtis clean.Not in this PR
governor.labels.stage.adoption.in_placeis off (default on), or a contributor disallows maintainer edits, an adopted fork PR now always parks at 085 instead of being re-homed. That is the intended trade.hive/adopt-*branches and images published from re-homed fork PRs, such ascanary-pr626, are for the repository's maintainers to review; this PR doesn't touch them.Contributor checklist
changelog.d/security-no-fork-rehome-into-base-repo.md.v6.π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1