Skip to content

πŸ› dco: re-home unsigned commits on adopted PRs so the gate can clear - #14787

Merged
hivecommons-hive[bot] merged 4 commits into
v5from
fix/dco-rehome-adopted
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
v5from
fix/dco-rehome-adopted

Conversation

@clubanderson

@clubanderson clubanderson commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Problem

#14666 was closed by #14688, which re-signs commits on the supersede re-home path. A gap remained, seen live on #14710 (fork head, stage/074-adopted-by-hive, no-dco, probot dco red): the hive logged reason=dco-missing on every pass and never re-signed anything.

Root cause:

  1. adoptionDCORepairMode returns AdoptModeInPlace when every unsigned commit is the hive's own and the branch is pushable β€” but nothing ever executed that repair. The in-place "rewrite" was a decision without an implementation, so the PR held at 074 indefinitely. (The old test TestAlreadyAdoptedInPlaceAppAuthoredDCOFailureStaysInPlace codified the no-op.)
  2. resignAdoptionCommits bailed on any head containing a merge commit. The update-branch recovery (Adopted PRs red only from a since-fixed shared-CI flake are escalated instead of updated/re-runΒ #14500) adds a Merge branch 'v5' into … commit, so even the supersede path would have pushed hive/adopt-<n> with the unsigned commit intact.
  3. The stage engine's installation token can only use the git-data API on the base repo; it cannot rewrite a fork branch, so an in-place repair of a fork head is impossible.

Fix

  • In-place repair (base-repo heads): repairAdoptedDCOInPlace replays the PR commits via git-data (author/message/tree/parents preserved, Signed-off-by of the App appended), then UpdateRef(force) only if the ref still points at the observed head (lease check). Once per head (dco_repair_head in the stage record), under the effects mutation wrapper, logged as reason=dco-rehomed.
  • Fork heads always convert to mode=supersede / reason=dco-rehome, even when all unsigned commits are hive-authored.
  • resignAdoptionCommits maps parents inside the PR to their rewritten SHAs, so merge commits are replayed instead of aborting.
  • Observation.HeadRef added so the engine knows which ref to update.

Tests

  • TestAlreadyAdoptedInPlaceAppAuthoredDCOFailureOnForkRehomesResigned
  • TestAlreadyAdoptedInPlaceAppAuthoredDCOFailureInBaseRepoResignsInPlace
  • TestInPlaceDCORepairRefusesWhenHeadMoved
  • TestDCORehomeReplaysMergeCommitWithMappedParents

No new time.Sleep. Docs (labels-and-control-signals.md) and changelog fragment updated.

Of the PRs cited in the row audit, this unblocks #14710 (fork head β†’ re-homed with re-signed commits incl. the merge replay). #14715/#14716/#14761 are already DCO-green.

Fixes #14927
Refs #14666 (closed by #14688)

The in-place DCO repair mode was decided by adoptionDCORepairMode but
never executed, so an adopted PR whose unsigned commits were the hive's
own sat at stage 074 with reason=dco-missing forever. The supersede
replay also refused any head containing a merge commit, which the
update-branch recovery adds.

- In-place repair is now implemented for base-repo heads: replay the
  PR commits through the git-data API with Signed-off-by appended,
  preserving author/message/tree/parents, and force-update the ref only
  if it still points at the observed head (once per head).
- Fork heads always convert to supersede (dco-rehome): the installation
  token cannot rewrite a fork branch.
- resignAdoptionCommits maps parents inside the PR to their rewritten
  SHAs so merge commits are replayed instead of aborting the re-sign.

Fixes #14666

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added 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. labels Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 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
#14821 πŸ› fix: preserve supersession decisions across stage reconciliation same files src/pkg/github/automerge/automerge_stage_labels.go

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply.

@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersession sweep found that this PR's claimed issue is already closed by another merged PR.

  • Claimed issue: hive#14666
  • Closing PR: #14688

Decision needed (@hivecommons): #14688 already merged and closed the claimed issue, but this PR touches files the merged PR did not. Recommended: keep open until the extra changes are reviewed, or close as superseded if they are not wanted. Another option: merge anyway.

Files the merged PR did not touch: changelog.d/fixed-dco-rehome-adopted.md, src/docs/labels-and-control-signals.md, src/pkg/github/automerge/automerge_stage_labels.go, src/pkg/github/automerge/automerge_stage_labels_test.go, src/pkg/stageengine/prstage/types.go and 1 more.

This comment is edited in place by the supersession sweep; it is not duplicated.

@hivecommons-hive hivecommons-hive Bot added needs-human stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Failing checks:

  • coverage
  • test
  • test (rest 1/4)

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.

…test covers fork vs base head

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

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

The direction is right β€” the base genuinely decides AdoptModeInPlace and then never executes it β€” but the PR's own regression tests fail on this head, and the new repair path has a one-shot latch that recreates the "holds at 074 forever" symptom on a transient error.

Verified on head ff3166c, CI run 40614835301 (test (rest 1/4), job 122577845351):

  • --- FAIL: TestAlreadyAdoptedInPlaceAppAuthoredDCOFailureInBaseRepoResignsInPlace β€” automerge_contributor_adopt_test.go:1255: in-place repair must not supersede or comment: res={Items:1 Writes:0 Comments:1 …}. Writes:0 with Comments:1 means settleAdoption never entered repairAdoptedDCOInPlace; it took the nudge/comment branch instead. The guard it must pass is adoptedHeadNeedsDCORepair β†’ adoptionDCORepairMode, which now additionally requires headInBaseRepo(obs) (automerge_contributor_adopt.go:~297, obs.HeadRepo != "" and equal to owner/repo). I could not confirm from the diff alone whether the harness observation sets HeadRepo; that is the first thing I would check. Open question, not a verdict.
  • --- FAIL: TestAdoptionDCORehomeDecisionAndRendering β€” same job, same new HeadRepo requirement is the likely cause for the canPush=true fixtures around automerge_contributor_adopt_test.go:520, since every pre-existing fixture that reached AdoptModeInPlace did so without HeadRepo.

One defect in the new code, independent of the tests (repairAdoptedDCOInPlace, automerge_contributor_adopt.go new block):

  • store.MarkDCORepair(key, obs.HeadSHA) runs before effects.Execute, and the function starts with if rec.DCORepairAttempted(obs.HeadSHA) { return 0, nil }. So a GetRef failure, a CreateCommit failure or an UpdateRef failure (all returned as NotApplied) leaves the head permanently marked attempted; the next sweep returns 0 for the same head and the PR sits at stage/074 with dco red β€” exactly the live symptom on #14710 the body describes, now with a different cause. The "head moved" case is fine (new SHA, new attempt); the transient-API case is not. Move the mark after a successful UpdateRef, or mark only on NotApplied errors that are not retryable. Severity: medium β€” operator-visible stall, no data loss.

What I checked and found correct: resignAdoptionCommits now maps in-PR parents to rewritten SHAs and adds the trailer only to single-parent commits, which matches the DCO checks' merge-commit exemption; the GetRef == obs.HeadSHA pre-check before rewrite closes the race the old supersede path had; forcing fork heads to supersede is right because the App token cannot write a fork ref (canPushToPRBranch at :1071-1079 already encodes this, so headInBaseRepo duplicates rather than contradicts it).

Docs row in src/docs/labels-and-control-signals.md reads consistent with the new dco-rehomed reason. I have not approved or closed anything.

β€” hive: agent=reviewer 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.

Two tests in this PR's own package fail at ff3166c (test (rest 1/4), run 40614835301; the coverage red is downstream of it). Both are the diff's, not infra.

1. TestAdoptionDCORehomeDecisionAndRendering β€” automerge_contributor_adopt_test.go:525. The fixture obs (lines 507-514) sets Number/Author/Title/BaseRef/Body/Detail but no Owner, Repo or HeadRepo. The new guard at automerge_contributor_adopt.go:295 is canPushInPlace && headInBaseRepo(obs) && …, and headInBaseRepo (:303-305) returns false for an empty HeadRepo, so adoptionNeedsDCORehome(obs, true) now re-homes and the assertion "branch push permission with only hive-authored unsigned commits allows in-place repair" trips. The guard itself looks right β€” resignAdoptionCommits + Git.UpdateRef write to obs.Owner/obs.Repo, which only reaches the branch when the head lives in the base repo β€” so the fixture needs Owner: "acme", Repo: "widget", HeadRepo: "acme/widget" (and the "without push permission" sibling assertion still holds with it).

2. TestAlreadyAdoptedInPlaceAppAuthoredDCOFailureInBaseRepoResignsInPlace β€” :1255. Failure text: res={Items:1 Writes:0 Comments:1 …} pulls=[] edits=[] comments=[]. The rewrite itself succeeded (the newCommits == 2 and refs == "signed2" assertions above it passed), so the repair path works; something after repairAdoptedDCOInPlace returned (1, nil) still counted one comment on the same observation. I could not run the suite from this pod to pin which writer β€” open question for you: is it the normal 074/nudge comment continuing after settleAdoption returns, in which case the in-place branch should short-circuit the rest of the sweep for that PR?

No findings on the rewrite logic: the multi-parent replay (resignAdoptionCommits, inPR/rewritten maps) correctly leaves merge commits unsigned and only maps parents that are inside the PR; the GetRef == HeadSHA check before UpdateRef(force) closes the race with a contributor push. go build ./pkg/github/automerge/... ./pkg/stagelabels/... passes.

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

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 28, 2026
…before the fork case

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

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

Style (delta re-review at 43ef1f5) β€” both previous findings are fixed (fixture now sets HeadRepo at automerge_contributor_adopt_test.go:527; in-place repair asserts res.Comments != 0 at :1265). One leftover from the delta:

src/pkg/github/automerge/automerge_contributor_adopt.go:859 β€” the doc comment still says "Returns 1 when the branch moved", but the body now returns 0 on success (:906). The comment contradicts the code.

// and the DCO gate clears. Returns 0: a branch push is not a comment, so
// nothing is added to the caller's count.

β€” hive: agent=adjudicator-4 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 β€” no findings from this perspective.

β€” hive: agent=adjudicator 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 β€” no findings from this perspective.

β€” hive: agent=adjudicator-3 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 (docs-currency, delta ff3166c β†’ 43ef1f5) β€” operator doc (src/docs/labels-and-control-signals.md) still matches the behavior; both prior correctness findings (test fixture HeadRepo at automerge_contributor_adopt_test.go:525-527, comment count at :1265) are fixed at this head.

One advisory nit introduced by the delta: src/pkg/github/automerge/automerge_contributor_adopt.go:859 still says the function returns 1, but :906 now returns 0 unconditionally.

// and the DCO gate clears. Returns 0: a branch push is not a comment, so
// it adds nothing to the caller's count.

β€” hive: agent=ci-maintainer 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 β€” 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 β€” no findings from this perspective.

β€” hive: agent=ci-maintainer 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.

Read the diff against v5 plus settleAdoption, supersedeAdoptedPR (automerge_contributor_adopt.go:704), and the effects.Execute/KindBranchPush call sites in automerge_bot_takeover.go. The two root causes the body names are both closed by the diff, and the new path follows the existing adoption idioms (mark-before-call, NotApplied on refusal, MarkHivePushedHead after the ref moves). Looks correct to me.

What I verified:

  • headInBaseRepo (automerge_contributor_adopt.go:302-304) is the right gate: the git-data API can only rewrite a ref in the base repo, so a fork head with only hive-unsigned commits now goes to AdoptModeSupersede instead of silently matching InPlace and doing nothing.
  • resignAdoptionCommits merge handling: parents inside the PR map through rewritten, parents outside are kept, and a non-topological listing returns "" rather than detaching (:818-830). Merge commits keep their message untouched, which matches what the DCO checks exempt.
  • repairAdoptedDCOInPlace is tried before adoptedHeadNeedsDCORehome (:931-934), so the in-place case no longer falls through to "nothing", and the once-per-head mark is set only after HeadRef is known (:862-868), so a store record without a ref is retried once the sweep has one.

One low-severity dead end, not a blocker:

  • automerge_contributor_adopt.go:862 β€” once MarkDCORepair has run, every later sweep returns at this line before :934 is reached. If the first attempt is refused for a reason that will not change on the same head (cannot be replayed with sign-off at :889, or an UpdateRef error), the PR sits DCO-red with a warn log and nothing visible on the PR β€” unlike the re-home path, which escalates to 085 with a comment (:946-958). Suggest letting an already-attempted head fall through to the re-home/escalation path, or noting the refusal the way the workflow-path fence does.

Info only: GetRef β†’ UpdateRef(force) is not atomic (the git-data API has no expected-SHA), so the "head moved" guard narrows the race rather than closing it. Acceptable given the adoption context, just worth knowing when reading the log line.

β€” hive: agent=reviewer-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 β€” no findings from this perspective.

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

@hivecommons-hive hivecommons-hive Bot added stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge: the automerge lane will not merge this unattended.

Head: verdict approved @6e385de, 61/62 checks green, 1 pending, DCO yes, soak 0s of 30m0s.

How to release it:

  • Answer the needs-human ask β€” the hive note that added the label says what it needs (a supersession decision, a workflow approval, …) β€” then have a maintainer remove that label; the hive takes its own needs-human off when the cause clears, and /hive approve does not remove it.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/hive decision supersede now: adopt #14787 in supersede mode, preserving the author's commits and sign-off; do not wait for the grace deadline

Rationale: the contributor is offline; adoption in supersede mode keeps the work moving (#13975).

Decided by the hive at @clubanderson's request as the owner's delegate under the owner-delegate policy (rule contributor-offline).

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@hivecommons-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/approve

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hivecommons-hive[bot]
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

hivecommons-hive Bot pushed a commit that referenced this pull request Oct 28, 2026
#14930)

The hover's Trail clause read h.stage from the stage-tracker history
entries, but StageTrackerHop emits number/slug β€” so every hop stringified
to "undefined" (#14787 hovered as "Trail: undefined β†’
undefined β†’ undefined β†’ undefined"). The renderer now names hops by the
stage table's short word (slug before the table loads), skips hops it
cannot name, and omits the clause when fewer than two remain. Go and node
tests pin the wire shape on both sides; the UI fixtures use the live shape.

Fixes #14928

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@hivecommons-hive
hivecommons-hive Bot merged commit bccbd25 into v5 Oct 28, 2026
83 of 87 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/dco-rehome-adopted branch October 28, 2026 13:31
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#147876e385de` sha256:ebe64e057cd65b1caabb701c69bd6f10b6bdea8bd0fecfead661518c0ba78937 β€” download from the dashboard or `hivectl review evidence #14787`.

@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 6e385de.

@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 removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adoption/supersede Owner-delegate request: adopt now in supersede mode author/human A person pushed this PR themselves dco All commits are DCO signed-off 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.

πŸ› adoption: DCO in-place repair never executes; merge commits and fork heads abort the re-sign

1 participant