Skip to content

πŸ› fix: workflow-path fence approval survives the hive's own base refresh - #16858

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
fix/fence-survives-update-branch
Nov 7, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
fix/fence-survives-update-branch

Conversation

@hanthor

@hanthor hanthor commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

The contributor lane's workflow-path fence released only on an approval
bound to the current head, so the update-branch the lane itself runs on a
BEHIND PR under a strict up-to-date rule re-armed the fence and parked the
PR for a fresh approval every time the base moved.

When no approval is bound to the current head, the lane now looks for an
approval on an earlier head (a trusted merger's standing APPROVED review,
a dashboard approval marked for that head, or the hive's own audit marker
for it) and carries it over when BaseRefreshChecker proves the hive's own
base refresh is all that moved the head: App-authored merges of the base
branch whose three-dot diff against the base is file-for-file the approved
head's. A contributor commit (whether or not it touches the workflow
files), a rebase, a base merge by anyone but the App, or a base merge that
changed the PR's diff still re-arms the fence. A carried release logs
"workflow-path fence approval carried over hive base refresh" and leaves
the per-head audit marker with from=.

Evidence: projectbluefin/utah#1111 (fence released by /hive decision
approve, hive's note "A new push re-arms the fence" while the PR sat
BEHIND under strict required checks) and projectbluefin/utah-packages#877
(the same maintainer approved three successive heads).

Found by auditing why hive stalls on projectbluefin/utah and projectbluefin/utah-packages. One concern per PR.

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

@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 danathar 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/L Denotes a PR that changes 100-499 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.

PR Title Relation Files
#16607 ✨ feat(github): enforce pin-only exception in merge-request relay same files src/docs/hive-merge.md
src/docs/operator-reference/README.md

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@hanthor this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • test (rest 3/4)

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 (2 waiting): fixes are handed out before new work as soon as you have capacity.

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

docs-currency β€” read at head 95a0256.

Generated dashboard document not regenerated (blocks CI). src/pkg/dashboard/static-src/js/config-features.js:385,388 gain the new carry-over wording, but src/pkg/dashboard/static/index.html:62160,62163 β€” the committed artifact the spoke dashboard actually serves (//go:embed static) β€” still reads "Approval on an earlier head does not count." / "a stale approval re-arms the fence on the next push." Per src/docs/dashboard-source-layout.md:10 ("Edit static-src/**, run make dashboard-gen, commit both"), TestIndexHTMLIsGenerated fails on this; CI run 42146867665 test (rest 3/4) shows pkg/dashboard/webstatic.TestIndexHTMLIsGenerated: 3 runs, 3 failures, and make dashboard-gen-check at this head prints pkg/dashboard/static/index.html is out of date with pkg/dashboard/static-src. Only those two lines differ once regenerated.

Fix: run make dashboard-gen and commit src/pkg/dashboard/static/index.html. Equivalent patch:

--- a/src/pkg/dashboard/static/index.html
+++ b/src/pkg/dashboard/static/index.html
@@ -62160 +62160 @@
-                <label>Owner approval releases the workflow-path fence ${settingHelpMark('hive-merge', 'contributor-lane-auto-merge', 'Owner approval releases the workflow-path fence', `When on (the default), a trusted merger's GitHub Approve review on the current head β€” or a dashboard /hive decision approve bound to it β€” lets the contributor lane merge a PR that edits .github/workflows/** or .github/actions/** itself once CI, soak and the other gates are clear. Approval on an earlier head does not count. Needs the App's Workflows: Read and write; without it the merge is refused, the PR is marked hive:unauthorized and parks at 090 for a person's Merge click. Off keeps every workflow-path PR a person's merge.`)}</label>
+                <label>Owner approval releases the workflow-path fence ${settingHelpMark('hive-merge', 'contributor-lane-auto-merge', 'Owner approval releases the workflow-path fence', `When on (the default), a trusted merger's GitHub Approve review on the current head β€” or a dashboard /hive decision approve bound to it β€” lets the contributor lane merge a PR that edits .github/workflows/** or .github/actions/** itself once CI, soak and the other gates are clear. Approval on an earlier head does not count, except across the hive's own merge of the base branch that leaves the PR's diff unchanged. Needs the App's Workflows: Read and write; without it the merge is refused, the PR is marked hive:unauthorized and parks at 090 for a person's Merge click. Off keeps every workflow-path PR a person's merge.`)}</label>
@@ -62163 +62163 @@
-                  <span class="config-toggle-label">Merge owner-approved workflow-file PRs ${settingHelpMark('hive-merge', 'contributor-lane-auto-merge', 'Merge owner-approved workflow-file PRs', `YAML: auto_merge.contributor_lane.owner_approval_releases_workflow_fence. If you approved it, the hive merges it; a stale approval re-arms the fence on the next push.`)}</span>
+                  <span class="config-toggle-label">Merge owner-approved workflow-file PRs ${settingHelpMark('hive-merge', 'contributor-lane-auto-merge', 'Merge owner-approved workflow-file PRs', `YAML: auto_merge.contributor_lane.owner_approval_releases_workflow_fence. If you approved it, the hive merges it; a stale approval re-arms the fence on the next push, but the hive's own update-branch keeps it.`)}</span>

Everything else this perspective checked is current: the five-hop cap in src/docs/hive-merge.md:905 matches baseRefreshMaxHops = 5 (src/pkg/github/pr_decision_base_refresh.go:30); the documented log line and from= marker match automerge_contributor_workflow_approval.go:104,326; causes.go:26, automerge_stage_human.go:501, pr_approve_command.go:97, the operator-reference row and the changelog fragment all carry the new rule, and no other doc still says an earlier head never counts.

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

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

Correctness re-review at 4130f84 (delta since 95a0256 is a rebase onto v5 plus a parser fix and the regenerated static/index.html).

Prior findings: parseWorkflowApprovalMarker partial return β€” fixed (automerge_contributor_workflow_approval.go:247-249 now returns zero values; TestParseWorkflowApprovalMarker case 3 agrees). static/index.html not regenerated β€” fixed (now in the diff, +2/-2). Carried-approval acceptance across base refreshes β€” still the PR's design; the rebase picked up #16867 so the checker now also demands a GitHub-verified App merge; that policy call stays with the security perspective.

New, in-scope: the PR's own carry test fails at this head β€” CI test (rest 1/4) job 127848274008:

--- FAIL: TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh
    .../review_on_the_approved_head_carries_over_the_hive's_base_merge
    .../the_hive's_audit_marker_for_the_approved_head_carries_over_the_base_merge
    .../dashboard_approval_marked_for_the_approved_head_carries_over_the_base_merge
automerge_contributor_workflow_approval_test.go:412: reason="contributor-lane:workflow-path" merges=0, want ""/1

Cause: #16867 (now in the merge-base) makes mergeIsBaseRefreshOf reject any merge commit that is not GitHub-verified β€” src/pkg/github/pr_decision_base_refresh.go:146 β†’ CommitIsVerifiedAppMerge at :261-262 checks commit.GetCommit().GetVerification().GetVerified(). The hiveBaseMerge fixture at automerge_contributor_workflow_approval_test.go:315 has author/committer/parents but no commit.verification, so every positive carry case is refused and the fence re-arms. The production path is unaffected (real App update-branch merges are web-flow-signed), but the three cases that prove the feature works are red.

Fix (matches the fixture shape in pr_decision_base_refresh_test.go:47):

	hiveBaseMerge := map[string]any{"sha": "sha7", "parents": []map[string]string{{"sha": approvedHead}, {"sha": baseTip}}, "author": map[string]string{"login": testHiveAppBotLogin}, "committer": map[string]string{"login": "web-flow"}, "commit": map[string]any{"verification": map[string]any{"verified": true}}}

Worth adding alongside the "pushed by the contributor" case: an App-authored merge with verified: false β†’ wantReason: contributorLaneReasonWorkflowPath, so the fence's dependence on the signature check is pinned by this test rather than only by pr_decision_base_refresh_test.go.

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

Intent alignment (read at head 95a0256): the diff does what the title/body say β€” workflowFenceCarriedApproval (automerge_contributor_workflow_approval.go:163-178) delegates to BaseRefreshChecker.HeadIsBaseRefreshOf, whose contract (src/pkg/github/pr_decision_base_refresh.go:48-56, 126-159) is exactly the App-authored base merge + unchanged three-dot diff rule the body describes, and only App-authored unedited comments or GitHub reviews seed prior approvals (:195-200). Scope is tight. Two in-scope CI failures, both caused by this diff:

1. TestParseWorkflowApprovalMarker fails (automerge_contributor_workflow_approval_test.go:449): for <!-- hive:workflow-approval head=abc123 --> the parser returns ("abc123", "", false) but the test wants ("", "", false). parseWorkflowApprovalMarker (automerge_contributor_workflow_approval.go:232-247) returns the partial fields on failure. Zero them so a !ok result carries nothing:

	if head == "" || approver == "" {
		return "", "", false
	}
	return head, approver, true

(replacing return head, approver, head != "" && approver != "")

2. TestIndexHTMLIsGenerated fails (pkg/dashboard/webstatic/indexgen_test.go:28): static-src/js/config-features.js was edited (:385,388) but the generated static/index.html was not regenerated. Run make dashboard-gen (go generate ./pkg/dashboard/webstatic/) and commit the result alongside the source.

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

Security perspective (read at head 95a0256)

1. Medium β€” the audit-marker carry overrides the approver's later objection. workflowFencePriorApprovals (automerge_contributor_workflow_approval.go:188-228) lists the hive's own hive:workflow-approval marker for an older head before the reviews, and dedups per head, so a marker for head A wins over whatever that person's review says now. workflowFenceCarriedApproval (:169-172) then checks only isTrustedMerger and HeadIsBaseRefreshOf. Sequence: trusted merger X approves A β†’ hive posts the marker β†’ X submits CHANGES_REQUESTED (or dismisses) on A β†’ the lane's update-branch produces B. standingTrustedHumanReviews correctly reports X's standing opinion as CHANGES_REQUESTED (so the review path would not carry), but the marker path never consults it, and latestTrustedHumanChangesRequested is head-bound by design (automerge_human_changes_requested.go:12-22: a CR on an older head is "outdated"). Result: the workflow-path fence releases on B against the approver's standing objection β€” a state the pre-PR head-bound rule could not reach. The new tests cover forged markers and untrusted logins, not a revoked approval.

Suggested fix (in workflowFenceCarriedApproval; reviews is already the per-login standing set, so one pass suffices). I would not also exclude DISMISSED, since a "dismiss stale approvals" branch rule dismisses on the hive's own update-branch β€” the very case this PR is for:

 	for _, prior := range workflowFencePriorApprovals(headSHA, appLogin, reviews, comments) {
 		if trusted, configured := c.isTrustedMerger(prior.login); !configured || !trusted {
 			continue
 		}
+		if standingChangesRequested(reviews, prior.login) {
+			continue
+		}
 		if !c.baseRefresh.HeadIsBaseRefreshOf(ctx, c.gh.Repositories, owner, repo, number, baseRef, prior.carriedFrom, headSHA, appLogin) {
 			continue
 		}
@@
+// standingChangesRequested reports whether login's standing review is
+// CHANGES_REQUESTED: an approver who has since objected carries nothing,
+// whatever the hive's audit marker for the earlier head says.
+func standingChangesRequested(reviews []*gh.PullRequestReview, login string) bool {
+	for _, rv := range reviews {
+		if rv != nil && strings.EqualFold(strings.TrimSpace(hgithub.SafeGetLogin(rv.GetUser())), login) && strings.EqualFold(rv.GetState(), "CHANGES_REQUESTED") {
+			return true
+		}
+	}
+	return false
+}

plus a table case in TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh with the marker for sha6 and a CHANGES_REQUESTED review by clubanderson on sha6, expecting contributorLaneReasonWorkflowPath.

Out of scope (pre-existing in the checker this PR now leans on for a security fence): CommitByGitHubLogin (pr_decision_base_refresh.go:222-229) says it reads "never the forgeable git name or email", but GitHub derives author.login from the commit's author email, so a contributor can attribute a merge commit to the App bot with its noreply address. The merge-base and file-for-file diff checks (:150-160, :187-215) keep that from smuggling content; the residual is compareAllFiles (:162-185), which paginates but GitHub caps a compare's files at 300, so a >300-file PR is compared on a truncated list. Low; noting it for backlog, not blocking.

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

Read the diff against the v5 tree at 994cea1 plus pr_decision_base_refresh.go (the BaseRefreshChecker this reuses), pr_decision_operator.go (ParsePRApprovalCommandComment) and the callers of latestTrustedHumanReview. The carry mechanism itself looks correct to me: HeadIsBaseRefreshOf already requires a GitHub-verified App merge whose other parent is the merge-base and whose three-dot file list (name, status, sha, additions/deletions) matches the approved head's, so a base merge that touched a file the PR also edits re-arms the fence. The standingTrustedHumanReviews split preserves the old latestTrustedHumanReview semantics (nil on read error, latest opinion per login, bots filtered). Prior-approval sources are limited to App-authored, unedited comments, so the forgery path is closed β€” and the tests cover that.

One gap: a retracted approval is still carried, via the hive's own audit marker.

  • automerge_contributor_workflow_approval.go:208 β€” workflowFencePriorApprovals treats the audit marker (head=A by=X) as a standing approval for head A, independent of what X's review on A says now.
  • On the current head the marker is not an approval source (workflowApprovalCommentActor, lines 259–293, only reads dashboard /approve comments and typed commands), and standingTrustedHumanReviews (automerge_human_changes_requested.go:76) keeps only each login's latest opinion, so a DISMISSED/CHANGES_REQUESTED review correctly re-arms the fence on the head it was given on.
  • Sequence: X approves head A β†’ hive posts the marker for A β†’ X dismisses the approval (or submits CHANGES_REQUESTED on A) β†’ the lane's update-branch produces head B. workflowFencePriorApprovals yields {X, A} from the marker, isTrustedMerger(X) holds, HeadIsBaseRefreshOf(A, B) holds, and the fence releases on B with a comment saying X approved it. The same dismissal re-arms the fence on A but not on B.

Severity: medium β€” it needs a prior trusted approval, so it is not an outsider's path, but it silently inverts a maintainer's retraction, which is exactly the signal the fence exists for. A small fix would be to skip a marker-derived prior when reviews holds a standing review by that login whose state is not APPROVED (submitted after the marker), and to add that case to TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh. Typed/dashboard approvals have no retraction path either way, so this only concerns GitHub reviews.

Minor, not blocking: standingTrustedHumanReviews still warns "could not read PR reviews for human changes_requested" though the fence path now calls it too.

PR body claims match the diff: the body's "a base merge by anyone but the App, or a base merge that changed the PR's diff still re-arms the fence" is implemented and tested.

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

Read the carry path against the v5 tree (automerge_contributor_workflow_approval.go, automerge_human_changes_requested.go, pkg/github/pr_decision_base_refresh.go) and the new table test. The mechanism is sound: HeadIsBaseRefreshOf (pr_decision_base_refresh.go:73) only accepts GitHub-verified App merges with a file-for-file identical three-dot diff, and the test table covers contributor commits, unverified merges, forged markers and de-trusted logins. One gap, medium:

A dismissed approval still releases the fence after a base refresh, via the hive's own audit marker.

  • automerge_contributor_workflow_approval.go:188-213 β€” workflowFencePriorApprovals reads the App's <!-- …workflow-approval head=X by=L --> marker (and a dashboard /approve for X) as approval evidence for head X. The only check applied to it is isTrustedMerger(prior.login) at :169.
  • automerge_human_changes_requested.go:65 β€” standingTrustedHumanReviews already models revocation: a login's latest review may be DISMISSED or CHANGES_REQUESTED, and newestReviewOnHead correctly refuses it. But workflowFenceCarriedApproval (:163-178) never consults reviews for the marker/dashboard priors β€” reviews only feeds the review-derived priors at :226.

Sequence: owner approves head X β†’ fence releases, marker for X posted. Owner dismisses their review (standing review now DISMISSED). On X the fence correctly re-arms (review path rejects, marker is skipped because seen[headSHA]). The lane then runs update-branch β†’ Y. Now the marker head=X by=owner is a prior approval, HeadIsBaseRefreshOf(X, Y) is true, and the fence releases on Y β€” the revocation is lost. Before this PR, Y needed a fresh approval, so this is new. Same for a /hive decision approve on X followed by a dismissal.

Suggested fix: in workflowFenceCarriedApproval, skip a prior whose login has a standing review in reviews that is not APPROVED (one map lookup by lowercased login); add the dismissed case to TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh.

Everything else matches the body: the standing-review path honours dismissal, scope is exactly the update-branch re-arm, and the operator text / changelog / causes.go wording all moved together. This is the contributor-lane trust fence, so a maintainer should still own the call to land it; I have not approved or changed anything.

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

HUMAN DECISION NEEDED β€” hanthor / clubanderson: confirm that the hive's own <!-- hive:workflow-approval … --> audit marker and a dashboard /approve on an earlier head may act as the credential that releases the workflow-path fence across a hive base refresh (automerge_contributor_workflow_approval.go:188-231); the previous head's decision question is still unanswered on this PR.

Security delta re-review (read at head 4130f84, delta vs 95a0256). The only PR-side code change since the last head is the parseWorkflowApprovalMarker not-ok path (:233-251 now returns "", "", false) β€” previous correctness finding fixed. Everything else in the 70-file compare is v5 base churn from the rebase.

Previous security finding (marker carry outlives the approver's CHANGES_REQUESTED) β€” still present, but narrowed. I verified at head that hasOutstandingChangesRequested runs right after the fence in the contributor lane (automerge_contributor_lane.go:1384-1388) and is not head-bound: any login whose latest review is CHANGES_REQUESTED parks the PR (automerge_sweep_trusted.go:960-992). So the carry cannot merge against a standing objection; the consequence is that the fence still "releases" and posts a carried audit comment saying the approval "still releases" the fence (:103-109, :330-333) while the approver's standing review is CHANGES_REQUESTED, and a plain DISMISSED retraction is caught by neither gate. Low; still worth closing in workflowFenceCarriedApproval:

 	for _, prior := range workflowFencePriorApprovals(headSHA, appLogin, reviews, comments) {
 		if trusted, configured := c.isTrustedMerger(prior.login); !configured || !trusted {
 			continue
 		}
+		// An approver whose standing review is no longer APPROVED has retracted;
+		// the hive's own marker or dashboard approval for an older head carries nothing.
+		if rv := standingReviewOf(reviews, prior.login); rv != nil && !strings.EqualFold(rv.GetState(), "APPROVED") {
+			continue
+		}
 		if !c.baseRefresh.HeadIsBaseRefreshOf(ctx, c.gh.Repositories, owner, repo, number, baseRef, prior.carriedFrom, headSHA, appLogin) {

What checks out from this perspective: (1) an armed fence returns before any updateBranchAndSkip (automerge_contributor_lane.go:1373-1375 vs :1397, :1535), so no App base-merge of an unreleased head ever exists for a forged marker to ride; (2) the carry's only comment sources are App-authored, unedited bodies (:201-214), the same boundary the pre-existing dashboard /approve path already rests on (:259-281); (3) the v5 rebase picked up CommitIsVerifiedAppMerge + the 300-file fail-closed cap (pr_decision_base_refresh.go, #16860), which hardens the checker the fence now leans on.

Note for the author: that same hardening is why TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh's three positive carry cases now fail in v2 Tests (…workflow_approval_test.go:412, reason="contributor-lane:workflow-path"): the hiveBaseMerge fixture needs Commit.Verification.Verified=true and a web-flow/App committer login to satisfy CommitIsVerifiedAppMerge. Fails closed, so not a security regression β€” but CI is red.

Evidence bundle `#1685839babba` sha256:2de63e4f701230d7fdc088da0e72462bb435a888fe271cdecf54ddf160d4abdf β€” download from the dashboard or `hivectl review evidence #16858`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Check report (hive scanner, read-only β€” contributor branch, nothing pushed) for head 95a0256: the red test (rest 1/4) / test (rest 3/4) / coverage checks are caused by this diff, not a shared baseline (v6 tip is green).

  1. TestParseWorkflowApprovalMarker (automerge_contributor_workflow_approval_test.go:449):
    parseWorkflowApprovalMarker("<!-- hive:workflow-approval head=abc123 -->") returns "abc123", "", false but the test wants "", "", false β€” i.e. the test says a legacy marker with no base= field must be rejected outright, while the parser still returns the head. Either make the parser return "" for the head when the marker is not fully formed, or change the expectation to "abc123", "", false if a head-only marker should still be readable (then the fence relies on the ok=false flag alone).

  2. TestIndexHTMLIsGenerated (pkg/dashboard/webstatic): static-src/js/config-features.js changed but the committed artifact src/pkg/dashboard/static/index.html was not regenerated. Run make dashboard-gen and commit the regenerated index.html.

coverage only aggregates the shards and will go green once both pass.


🐝 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

CI triage for head 95a0256 (baseline v5 is green; both failures are in this PR's diff):

1. test (rest 1/4) β€” pkg/github/automerge.TestParseWorkflowApprovalMarker

parseWorkflowApprovalMarker("<!-- hive:workflow-approval head=abc123 -->") = "abc123", "", false; want "", "", false

The parser returns the partial head when by= is missing; the test (rightly) expects empty fields on a non-OK parse. Fail closed in automerge_contributor_workflow_approval.go:

	if head == "" || approver == "" {
		return "", "", false
	}
	return head, approver, true

2. test (rest 3/4) β€” pkg/dashboard/webstatic.TestIndexHTMLIsGenerated
static-src/js/config-features.js changed but static/index.html was not regenerated. Run make dashboard-gen (in src/) and commit the regenerated src/pkg/dashboard/static/index.html alongside the source edit.

coverage and test are downstream of those two shards. The branch is also 1 commit behind v5 (non-conflicting). Not pushing to a contributor branch β€” leaving the fix here for the author.


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

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

CI triage @95a0256 β€” both red shards are PR-local (v5 test (rest 1/4) and test (rest 3/4) are green at ad756b4), so this is a FIX_DIFF, not a shared incident. Two concrete fixes:

  1. test (rest 1/4) β€” TestParseWorkflowApprovalMarker (automerge_contributor_workflow_approval_test.go:449): the table expects a head-only marker (<!-- hive:workflow-approval head=abc123 -->) to parse as "", "", false, but parseWorkflowApprovalMarker returns the partial head even when ok is false. Either make the parser return zero values on an incomplete marker:

    if head == "" || approver == "" {
        return "", "", false
    }
    return head, approver, true

    or set head: "abc123" on that test row. The first keeps callers from acting on a half-parsed marker, so I'd take that one.

  2. test (rest 3/4) β€” TestIndexHTMLIsGenerated (indexgen_test.go:28): the PR edits src/pkg/dashboard/static-src/js/config-features.js but not the generated static/index.html. From src/, run make dashboard-gen (go generate ./pkg/dashboard/webstatic/) and commit the regenerated static/index.html alongside the source change. The style-ratchet warnings in the same shard are informational and will settle once the generated file matches.

coverage and test are downstream of those shards. Not pushing to your branch β€” hive does not push to non-App-authored PRs.


🐝 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

@hanthor
hanthor force-pushed the fix/fence-survives-update-branch branch from 95a0256 to 4130f84 Compare November 6, 2026 10:41
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@hanthor this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • test (rest 1/4)

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 (2 waiting): fixes are handed out before new work as soon as you have capacity.

@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 production change looks correct to me; the PR's own new test is red, and the fix is one fixture field.

Why test (rest 1/4) fails

All three positive cases of TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh fail with reason="contributor-lane:workflow-path" merges=0 (log line automerge_contributor_workflow_approval_test.go:412); the five negative cases pass.

  • workflowFenceCarriedApproval β†’ BaseRefreshChecker.HeadIsBaseRefreshOf β†’ mergeIsBaseRefreshOf β†’ CommitIsVerifiedAppMerge (src/pkg/github/pr_decision_base_refresh.go:262), which returns false unless commit.GetCommit().GetVerification().GetVerified() is true.
  • The hiveBaseMerge fixture in automerge_contributor_workflow_approval_test.go:313 serves sha, parents, author, committer β€” but no "commit": {"verification": {"verified": true}}. So the carry is rejected before the compare is ever read, and the fence stays armed exactly as the assertion reports.
  • The sibling fixture in base_preparation_observation_test.go:104 includes that field for the same reason.

Adding "commit": map[string]any{"verification": map[string]any{"verified": true}} to hiveBaseMerge should turn the three cases green; the coverage check is red only because the rest shard failed. (Tests weren't run locally per the PR body, which is why this slipped β€” but CI being the verdict means this needs one more push before it can land.)

What I checked and found fine

  • standingTrustedHumanReviews / newestReviewOnHead (automerge_human_changes_requested.go:40-100) preserve the old latestTrustedHumanReview semantics for the two remaining callers (automerge_review_gate.go:259,328, humanChangesRequestedForHead): per-login latest opinion, bot/App filtered, trust-checked, then state+head filter. No behaviour change on the existing paths.
  • The carry reuses the #15649 BaseRefreshChecker the decision carry already uses (automerge_decision_carry.go:24), so the trust reasoning β€” App-authored, verified, base parent is the merge-base, three-dot files identical β€” is the one already accepted for recorded decisions.
  • workflowFencePriorApprovals only reads App-authored, unedited comments for markers and /approve; the forged-marker test covers that.

One open consideration (not blocking)

The marker and dashboard-/approve prior paths (automerge_contributor_workflow_approval.go:201-215) carry an approval by login without consulting that login's standing review, whereas the review path does implicitly (a later CHANGES_REQUESTED or DISMISSED replaces the login's entry in standingTrustedHumanReviews). So: owner approves head A via dashboard β†’ marker posted β†’ owner dismisses/requests changes on A β†’ hive base-refreshes to C β†’ the marker still carries to C. The same-head path already had this shape before this PR, so it is an extension rather than a new hole, but since the fence guards workflow files it may be worth skipping a prior whose login has a standing non-APPROVED review newer than that approval. Your call.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Check report (hive scanner, read-only β€” contributor branch, nothing pushed) for head 4130f84.

Baseline v5 (ad46955) is green on test (rest 1/4), so this is PR-local (FIX_DIFF), not a shared incident. coverage / test are downstream of the red shard.

test (rest 1/4) β€” job 127848274008: TestContributorLaneWorkflowFenceApprovalCarriesOverHiveBaseRefresh fails in exactly the three carry-over cases (review on the approved head…, the hive's audit marker…, dashboard approval marked…), all with:

automerge_contributor_workflow_approval_test.go:412: reason="contributor-lane:workflow-path" merges=0, want ""/1

The six re-arm cases pass, so workflowFencePriorApprovals and the trusted-merger gate look fine; the carry is being refused by BaseRefreshChecker.HeadIsBaseRefreshOf.

Likely cause β€” the fixture, not the production code: hiveBaseMerge (test file, const approvedHead, baseTip block) builds the GET commits/sha7 payload with sha, parents, author.login and committer.login=web-flow but no commit.verification.verified: true. pkg/github.CommitIsVerifiedAppMerge (pr_decision_base_refresh.go:261) returns false unless commit.GetCommit().GetVerification().GetVerified() is set, so mergeIsBaseRefreshOf bails before ever comparing the diffs. The sibling fixture in automerge_decision_carry_test.go:60 sets "commit": {"verification": {"verified": true}} for the same reason.

Suggested fix (test only):

hiveBaseMerge := map[string]any{
    "sha": "sha7",
    "parents": []map[string]string{{"sha": approvedHead}, {"sha": baseTip}},
    "author":    map[string]string{"login": testHiveAppBotLogin},
    "committer": map[string]string{"login": "web-flow"},
    "commit":    map[string]any{"verification": map[string]any{"verified": true}},
}

The "base merge pushed by the contributor" case should stay red-armed either way (author login check), so no other case needs to change. If the three cases still fail after that, the next thing to check is that the fixture's compare/<base>...sha7 response returns merge_base_commit.sha == base9 (that is fx.compareMergeBase["sha7"]), since mergeIsBaseRefreshOf compares it to the non-approved parent.


🐝 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

The contributor lane's workflow-path fence released only on an approval
bound to the current head, so the update-branch the lane itself runs on a
BEHIND PR under a strict up-to-date rule re-armed the fence and parked the
PR for a fresh approval every time the base moved.

When no approval is bound to the current head, the lane now looks for an
approval on an earlier head (a trusted merger's standing APPROVED review,
a dashboard approval marked for that head, or the hive's own audit marker
for it) and carries it over when BaseRefreshChecker proves the hive's own
base refresh is all that moved the head: App-authored merges of the base
branch whose three-dot diff against the base is file-for-file the approved
head's. A contributor commit (whether or not it touches the workflow
files), a rebase, a base merge by anyone but the App, or a base merge that
changed the PR's diff still re-arms the fence. A carried release logs
"workflow-path fence approval carried over hive base refresh" and leaves
the per-head audit marker with from=<approved head>.

Evidence: projectbluefin/utah#1111 (fence released by /hive decision
approve, hive's note "A new push re-arms the fence" while the PR sat
BEHIND under strict required checks) and projectbluefin/utah-packages#877
(the same maintainer approved three successive heads).

Signed-off-by: James Reilly <jreilly1821@gmail.com>
@hanthor
hanthor force-pushed the fix/fence-survives-update-branch branch from 4130f84 to 39babba Compare November 7, 2026 03:20

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

Security re-review at head 39babba (delta since 4130f84).

Prior findings

  • Carry-over test fixture lacking a verified merge (correctness / intent-alignment): fixed β€” automerge_contributor_workflow_approval_test.go now builds the fixture with commit.verification.verified=true, and adds the negative case "an App-attributed base merge GitHub did not verify re-arms the fence", matching CommitIsVerifiedAppMerge (src/pkg/github/pr_decision_base_refresh.go:261-267, called at :146).
  • Carried approval ignores the approver's retraction: still present β€” the Go logic in automerge_contributor_workflow_approval.go is unchanged in this delta (only the doc comment moved to "GitHub-verified").

Still present (in-scope): a dismissed approval survives the base refresh via the hive's own audit marker

standingTrustedHumanReviews keeps only each login's latest review (automerge_human_changes_requested.go:64-67), so once a trusted merger dismisses their APPROVED review (or an admin dismisses it), the reviews path correctly no longer finds it. But workflowFencePriorApprovals also reads the persisted hive:workflow-approval head=<A> by=<X> marker (automerge_contributor_workflow_approval.go:208) and workflowFenceCarriedApproval only checks isTrustedMerger + HeadIsBaseRefreshOf on it (:168-176). Sequence: X approves head A β†’ fence releases, marker posted β†’ X dismisses β†’ hive update-branch β†’ head B. At B the fence is released by the carried marker although the only human approval was withdrawn. A CHANGES_REQUESTED retraction is parked by the downstream gate, but a DISMISSED one is not (automerge_human_changes_requested.go:65 treats it as a standing state, not a request), so this path is unmitigated.

Concrete fix β€” require the approver's standing review (if any) to still be APPROVED before carrying:

--- a/src/pkg/github/automerge/automerge_contributor_workflow_approval.go
+++ b/src/pkg/github/automerge/automerge_contributor_workflow_approval.go
@@ func (c *Engine) workflowFenceCarriedApproval(
 	for _, prior := range workflowFencePriorApprovals(headSHA, appLogin, reviews, comments) {
 		if trusted, configured := c.isTrustedMerger(prior.login); !configured || !trusted {
 			continue
 		}
+		// A marker or /approve records a grant the person may since have
+		// withdrawn; their latest standing review (reviews is one per
+		// login) must not be DISMISSED or CHANGES_REQUESTED.
+		if rv := latestStandingReviewBy(reviews, prior.login); rv != nil && !strings.EqualFold(rv.GetState(), "APPROVED") {
+			continue
+		}
 		if !c.baseRefresh.HeadIsBaseRefreshOf(ctx, c.gh.Repositories, owner, repo, number, baseRef, prior.carriedFrom, headSHA, appLogin) {
 			continue
 		}
@@
+func latestStandingReviewBy(reviews []*gh.PullRequestReview, login string) *gh.PullRequestReview {
+	for _, rv := range reviews {
+		if rv != nil && strings.EqualFold(strings.TrimSpace(hgithub.SafeGetLogin(rv.GetUser())), strings.TrimSpace(login)) {
+			return rv
+		}
+	}
+	return nil
+}

plus a table case in TestContributorLaneWorkflowFenceCarriedApproval: marker for approvedHead by the trusted merger, reviews = that merger's DISMISSED review, verified App base merge β†’ wantReason: contributorLaneReasonWorkflowPath.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@hanthor this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the review swarm requested changes

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 (1 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive
hivecommons-hive Bot merged commit a2500ce into v5 Nov 7, 2026
85 of 86 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/fence-survives-update-branch branch November 7, 2026 03:29
@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 39babba.

@github-actions

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

1 participant