Skip to content

πŸ› fix(automerge): only re-sign the hive's own commits in in-place DCO repair - #16698

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16685
Nov 5, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16685

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

#16648 stopped the hive from superseding its own PRs for sign-off. To get there, it let a hive-authored PR on a pushable base-repo head be amended in place no matter who the unsigned commits were linked to. That bypass was needed only because commits the hive's agents push as project.ai_author counted as "other": only App-bot linkage made a commit the hive's. As a side effect, resignAdoptionCommits appended the App's Signed-off-by to a collaborator's unsigned commit pushed onto a hive branch. The App ended up asserting a DCO for someone else (security review finding).

Decision taken by hive: the hive/other split is made identity-aware (App bot or a hive identity by GitHub login linkage) and in-place repair again requires every unsigned commit to be the hive's; a hive-authored PR carrying someone else's unsigned commit waits for a person instead of being superseded (#16648 contract kept).

  • Only GitHub's author-login linkage counts. Git author name/email still never makes a commit the hive's.
  • stageDCO passes policy.HiveAuthor into the split. Existing dcoCommitStats* signatures keep the App-only behaviour.
  • Records cached before this change may still count ai_author commits as "other". Such a PR now waits instead of being signed, which is the conservative direction.
  • resignAdoptionCommits is unchanged. It is shared with the supersede path, and the mode guard now keeps the in-place path from reaching non-hive unsigned commits.

Tests: a stats test for the identity-aware split (with the nil-predicate and old-function behaviour unchanged), and the adoptionDCORepairMode case updated so a hive-authored head with a non-hive unsigned commit returns "" (never supersede).

Closes #16685

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

…epair

#16648 let a hive-authored PR on a pushable base-repo head be amended in
place whatever its unsigned commits were linked to, because commits the
hive's agents push as project.ai_author counted as "other" (only App-bot
linkage made a commit the hive's). As a result a collaborator with push
access who added an unsigned commit to a hive branch got a Signed-off-by
asserted for them by the App.

The hive/other split now also counts commits GitHub links (by author
login) to one of the hive's identities (StageLabelPolicy.HiveAuthor), so
#16648's case still amends in place, and in-place repair again requires
every unsigned commit to be the hive's. A hive-authored PR carrying
anyone else's unsigned commit waits for a person; it is still never
superseded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 5, 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 clubanderson 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 5, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

hive/awaiting-ci: CI pending β€” sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

Review findings from adjudicator-4 (folded here because this head already carries its hive review):

Security perspective (read at head 9ff1f6d): no in-scope blocker. The guard change is sound β€” adoptionDCORepairMode now requires DCOUnsignedOther == 0 for the in-place branch (automerge_contributor_adopt.go:314-316), and that is the only route to repairAdoptedDCOInPlace (automerge_contributor_adopt.go:1370-1372); the ref re-read at :1318-1320 pins the rewrite to the head the stats were computed for.

One advisory, out of scope for #16685 (pre-existing class, filed for backlog): the PR body says "git author name/email still never makes a commit the hive's", but dcoCommitOwnedByHive (automerge_stage_dco.go:108-117) trusts commit.Author.Login, which GitHub derives from the commit's author email. A collaborator with base-repo push access can author a commit with project.ai_author's email and it will be linked to that login (no Verification check β€” commitByApp at automerge_contributor_adopt.go:1870-1881 has the same property for the App bot, so this widens an existing surface rather than opening a new one). Consider requiring Commit.Verification.Verified for the ai_author linkage, or accept and reword the body/changelog claim.

Review findings from adjudicator-2 (folded here because this head already carries its hive review):

docs-currency β€” one in-scope doc that now contradicts the behaviour this PR ships.

src/docs/labels-and-control-signals/stage-labels.md:1167-1178 (unchanged at head 9ff1f6d) still describes the hive/other split as App-only: "an unsigned commit is the hive's own only when GitHub links its author or committer to the App bot" and "When every unsigned commit is App-linked and the head lives in the base repo, an in-place adoption stays in place … any head with a contributor-authored or unknown unsigned commit converts to mode=supersede".

After this PR:

  • automerge_stage_dco.go:107-116 (dcoCommitOwnedByHive) also counts a commit whose GitHub author login is one of the hive's identities (policy.HiveAuthor / project.ai_author), and stageDCO now uses that split (automerge_stage_dco.go:150), so the cached dco_unsigned_hive the doc cites no longer means "App-linked".
  • automerge_contributor_adopt.go:311-321: a hive-authored PR carrying a non-hive unsigned commit returns "" (waits for a person) β€” it is never superseded, which the doc's "converts to mode=supersede" sentence still claims.

Requested change: reword that paragraph to (a) say "App bot or a hive identity by GitHub author-login linkage" (names/emails still never count), and (b) note that a hive-authored PR with someone else's unsigned commit is parked for a person rather than re-homed (#16619/#16685). The changelog fragment already states this correctly; the operator doc should match.

Review findings from adjudicator (folded here because this head already carries its hive review):

Style review (head 9ff1f6d) β€” approve, advisory only.

The fix matches #16685: the in-place gate now requires DCOUnsignedOther == 0 (automerge_contributor_adopt.go:315) and stageDCO splits with policy.HiveAuthor (automerge_stage_dco.go:150). Two readability notes:

  1. Dead disjunct in allHive (automerge_contributor_adopt.go:315): Detail.DCOUnsigned{Hive,Other} are only ever set from dcoStats where unsigned == unsignedHive + unsignedOther (automerge_stage_labels.go:1025-1026; cached path automerge_stage_dco.go:139 computes unsignedOther: u - rec.DCOUnsignedHive). So DCOUnsignedOther == 0 already implies DCOUnsignedHive == DCOUnsigned, and (hiveAuthored || …) can never change the result. A reader will infer hiveAuthored still relaxes the gate, which is exactly the πŸ› fix(automerge): never supersede a hive-authored PR for a missing sign-offΒ #16648 behaviour this PR removes. Suggest allHive := obs.Detail.DCOUnsignedOther == 0 with a one-line comment; the updated test at automerge_contributor_adopt_test.go:636-645 passes unchanged.

  2. Stale doc comments: dcoCommitByHive (automerge_stage_dco.go:93-97) still says "Anything else is 'other' and re-homes", and the stageDCO doc (:120) still says the cache records "how many unsigned commits are the App's own" β€” both now describe the pre-dcoCommitOwnedByHive world.

Out of scope (backlog): the squashUnsafeHive branch in the same loop (automerge_stage_dco.go:86) still uses App-only dcoCommitByHive, so a signed ai_author commit on a human-authored PR is not squash-unsafe while the same commit unsigned is now the hive's β€” the two halves of the loop disagree on ownership.

Evidence bundle `#166989ff1f6d` sha256:cb3bfb5d175ef2f239772583222083fbe2fafdb2c922acdc7b16fd7047e8b814 β€” download from the dashboard or `hivectl review evidence #16698`.

@github-actions

github-actions Bot commented Nov 5, 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.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR 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 Nov 5, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness review (head 9ff1f6d) β€” no blocker; one advisory.

The guard change is sound: adoptionDCORepairMode now requires DCOUnsignedOther == 0 before AdoptModeInPlace (automerge_contributor_adopt.go:315-317), and repairAdoptedDCOInPlace only runs on that mode via adoptedHeadNeedsDCORepair (:343-344), re-checking the head SHA before resignAdoptionCommits rewrites every unsigned single-parent commit (:1271-1272). Detail.DCOUnsignedOther is fed from dcoCommitStatsForHive / the cached u - rec.DCOUnsignedHive (automerge_stage_dco.go:141, :150), so the split the guard reads is the one the stats produced.

Advisory (low, in-scope): stale split records stall, not just "wait". A hive-authored PR whose head was cached before this change has DCOUnsignedHive=0, DCOUnsignedOther=u for its project.ai_author commits; DCOSplitKnown is true for it (stagelabels/store.go:490-492), so stageDCO keeps serving the cached split (automerge_stage_dco.go:137-141) and never re-reads commits for that head. Under the new allHive test the PR returns "" on every sweep until a new push. The body acknowledges the conservative direction; just noting there is no self-heal for the existing head short of a push or a person. If you want to close that gap, re-read once when hiveAuthoredPR && rec.DCOUnsignedOther > 0 && !rec.DCOSplitKnownForHive (a new flag set by NoteDCO from this version on) rather than every sweep.

Note the hiveAuthored || branch of allHive (:315) is now unreachable-as-distinguishing: both producers maintain unsigned == hive + other, so Other == 0 already implies Hive == Unsigned. Harmless.

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

@github-actions

github-actions Bot commented Nov 5, 2026

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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[reviewer] Review backlog (security): In-place DCO repair now appends the App's Signed-off-by to non-hive commits on hive-authored PRs

0 participants