Skip to content

🐛 fix: keep a contributor PR's security hold when a sibling perspective asks for changes - #16863

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
fix/stage-drift-on-park
Nov 6, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
fix/stage-drift-on-park

Conversation

@hanthor

@hanthor hanthor commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

On a PR the hive did not author, a security finding is the one early exit
to a person while the PR is in CI/Review (#15640), and the
decision-marker path already keeps a security-backed hold beside a change
request. The bare requires_human path did not: any perspective's
changes_requested folded the security perspective's requires_human into
the fix cycle, so the PR went back to its author.

projectbluefin/utah-packages#890 (2026-11-05 21:55): security returned
requires_human on a new Mergeraptor App credential, intent-alignment asked
to change Closes #874 to Refs #874; the aggregate became
changes_requested and the PR sat at stage/072-returned-to-contributor
instead of stage/085-needs-decision.

The aggregate now stays requires_human with the finding recorded when the
contributor rule applies and securityFindingAcross backs the hold; an
unbacked requires_human and hive-authored PRs keep the fix cycle.

Found while auditing why hive stalls on projectbluefin/utah-packages (#890 sat at 072 when its security perspective required a human). The other label drifts from the audit match owner rules or were fixed upstream (#16818).

Verification: gofmt -l is clean. Tests were not run locally, per AGENTS.md; CI is the verdict.

…ve asks for changes

On a PR the hive did not author, a security finding is the one early exit
to a person while the PR is in CI/Review (#15640), and the
decision-marker path already keeps a security-backed hold beside a change
request. The bare requires_human path did not: any perspective's
changes_requested folded the security perspective's requires_human into
the fix cycle, so the PR went back to its author.

projectbluefin/utah-packages#890 (2026-11-05 21:55): security returned
requires_human on a new Mergeraptor App credential, intent-alignment asked
to change `Closes #874` to `Refs #874`; the aggregate became
changes_requested and the PR sat at stage/072-returned-to-contributor
instead of stage/085-needs-decision.

The aggregate now stays requires_human with the finding recorded when the
contributor rule applies and securityFindingAcross backs the hold; an
unbacked requires_human and hive-authored PRs keep the fix cycle.

Signed-off-by: James Reilly <jreilly1821@gmail.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 6, 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 kellyaa 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 6, 2026
@github-actions

github-actions Bot commented Nov 6, 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 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/maintainability review (head 4271e15) — approve; two advisory notes, no blockers.

  1. Finding dropped at the fix-cycle cap — src/pkg/review/review.go:622-641. The new security-hold block sits after the opts.FixAttempts >= maxFix early return, so a contributor PR that hits the cap with a backed security requires_human still parks at 085, but without DecisionFinding, and the 085 comment cannot print the review found: …. The sibling route at review.go:548-556 sets DecisionFinding before the cap check; mirroring that order keeps the two paths consistent and the PR body's "stays requires_human with the finding recorded" true at the edge:
 	if seenVerdicts[VerdictChangesRequested] {
+		var securityBacked bool
+		if seenVerdicts[VerdictRequiresHuman] && contributorHandsFree(agg, opts) {
+			// A security finding is the contributor rule's one early exit
+			// to a person (hivecommons/hive#15640); a sibling change request
+			// does not fold it into the fix cycle (utah-packages#890).
+			var finding string
+			if finding, securityBacked = securityFindingAcross(reports, sensitivePaths); securityBacked {
+				agg.DecisionFinding = finding
+			}
+		}
 		if opts.FixAttempts >= maxFix {
 			agg.Verdict = VerdictRequiresHuman
 			agg.RequiresHuman = true
 			agg.Reasons = []string{fmt.Sprintf("fix cycle cap reached (%d/%d)", opts.FixAttempts, maxFix)}
 			return agg
 		}
-		if seenVerdicts[VerdictRequiresHuman] && contributorHandsFree(agg, opts) {
-			...
-			if finding, backed := securityFindingAcross(reports, sensitivePaths); backed {
-				agg.DecisionFinding = finding
-				agg.Verdict = VerdictRequiresHuman
-				agg.RequiresHuman = true
-				return agg
-			}
-		}
+		if securityBacked {
+			agg.Verdict = VerdictRequiresHuman
+			agg.RequiresHuman = true
+			return agg
+		}
  1. Changelog fragment slug — changelog.d/fixed-stage-drift-on-park.md. The slug describes neither the PR nor the change (no stage drift, no park logic touched); changelog.d/README.md asks for <category>-<pr-or-slug>, e.g. fixed-16863-contributor-security-hold.md. Cosmetic, but the compiled changelog is easier to trace back to the PR.

Test placement and sequential-scenario shape match the neighbouring TestAggregateReportsContributorRequiresHumanNeedsSecurityFinding (review_test.go:775-789). Note: the contract reference #16818 is a merged PR, not an issue, and the body carries no closing keyword for it; I judged intent against the PR body and #15640.

— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

hivecommons-hive Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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

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-2 (folded here because this head already carries its hive review):

Security perspective (read at head 4271e15)

The change only ever adds a hold for a person on a contributor PR, so no new trust surface. One gap in the fix's coverage:

escalate policy still folds the security hold — src/pkg/review/review.go:634 gates the new branch on contributorHandsFree(agg, opts), which src/pkg/review/security_finding.go:150-152 defines as !agg.HiveAuthored && policy != "escalate". With self_authored_decision_policy: escalate the guard is skipped, execution falls to review.go:643-646 (VerdictChangesRequested + markRequiresHumanPerspectivesAsChangesRequested), and a contributor PR with a security requires_human plus a sibling changes_requested still goes to 072 — the exact utah-packages#890 path, but only under the policy meant to send more to a person. The bare-requires_human path at review.go:652-659 parks it under escalate (nothing resolves it), so the two paths disagree only when a change request is present. The hold does not depend on the hands-free opt-out; it only needs the PR to be non-hive-authored:

		if seenVerdicts[VerdictRequiresHuman] && !agg.HiveAuthored {

(review.go:634.) The test's hive-authored leg still passes; consider adding an AggregateOptions{SelfAuthoredDecisionPolicy: "escalate"} leg to TestAggregateReportsContributorSecurityHoldSurvivesSiblingChangeRequest asserting VerdictRequiresHuman.

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

Read aggregateReports and the two existing contributor hands-free branches in the tree at this head; the new branch at src/pkg/review/review.go:628-642 looks correct to me.

What I verified

  • The new check sits inside if seenVerdicts[VerdictChangesRequested] after the fix-cap guard (review.go:622-626), so an exhausted fix cycle still reports fix cycle cap reached rather than the security hold — same ordering the decision-marker path uses at review.go:566-571.
  • It gates on contributorHandsFree (security_finding.go:150) and securityFindingAcross (security_finding.go:135), which is exactly the pair the bare-requires_human branch at review.go:649-657 already uses. For a contributor PR with a decision marker and a backed finding, resolveSelfAuthoredDecisionQuestions returns false (review.go:941, not hive-authored) and the PR already parks with DecisionFinding set — so the three paths now behave the same way, and the PR body's claim that "the decision-marker path already keeps a security-backed hold" matches the code.
  • IsSecuritySensitiveFinding treats PerspectiveSecurity + VerdictRequiresHuman as backed on its own (security_finding.go:76-83), so the utah-packages#890 shape (security requires_human, no marker, intent-alignment changes_requested) now parks at 085 with "the security review withheld approval: …" as the finding — the test's strings.Contains assertion targets that string.
  • An unbacked requires_human beside a change request still falls through to VerdictChangesRequested + FixCycle, and reportsHiveAuthored (review.go:1015) turns the rule off for the hive's own PRs; the test's second and third cases cover both.
  • go build ./pkg/review/ and gofmt -l are clean on this head; the test (hub */4) and test (rest 2-4/4) shards are green.

Nothing to change. Changelog fragment uses the fixed- prefix and review-swarm.md describes the new behaviour next to the existing 085 paragraph.

Evidence bundle `#16863e7d19b3` sha256:6fc3bd9e7f40d2212d6f42ccc6292fe667694c27558d25db6cde3dbbead8735f — download from the dashboard or `hivectl review evidence #16863`.

@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 change against src/pkg/review/review.go and security_finding.go at e7d19b3. Looks correct to me.

  • The new guard (review.go:636-648) sits inside the seenVerdicts[VerdictChangesRequested] branch after the fix-cycle-cap return, so an exhausted cycle still reports the cap, and it mirrors the existing bare-requires_human branch at review.go:651-659 exactly: same contributorHandsFree gate, same securityFindingAcross predicate, same DecisionFinding text. The decision-marker path at review.go:571-574 already kept a backed hold beside a change request, so this closes the one remaining fold.
  • IsSecuritySensitiveFinding (security_finding.go:78-84) treats the security perspective's requires_human as backed on its own, so the #890 scenario (security requires_human, intent-alignment changes_requested) now lands at requires_human — matches the test. Hive-authored PRs are unaffected (contributorHandsFree is false), also covered by the test.

One suggestion, not a defect: contributorHandsFree is also false under self_authored_decision_policy: escalate (security_finding.go:150-152), so an operator who opted into more escalation keeps the old behaviour — a security-backed hold on a contributor PR still folds into the fix cycle when a sibling asks for changes. That is pre-existing, but if the intent is "a security hold always survives", gating this block on !agg.HiveAuthored alone would make escalate strictly more conservative than the default rather than less. Fine to leave for a follow-up.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 4236257 into v5 Nov 6, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/stage-drift-on-park branch November 6, 2026 02:31
@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @hanthor holds role owner and GitHub permission maintain on repo; CI green at e7d19b3.

@github-actions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant