Repository navigation
π fix: workflow-path fence approval survives the hive's own base refresh - #16858
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
|
|
@hanthor this PR is back in your court ( Failing checks:
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. |
There was a problem hiding this comment.
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
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Correctness re-review at 4130f84 (delta since 95a0256 is a rebase onto v5 plus a parser fix and the regenerated Prior findings: New, in-scope: the PR's own carry test fails at this head β CI Cause: #16867 (now in the merge-base) makes Fix (matches the fixture shape in Worth adding alongside the "pushed by the contributor" case: an App-authored merge with Review findings from Intent alignment (read at head 1. (replacing 2. Review findings from Security perspective (read at head 1. Medium β the audit-marker carry overrides the approver's later objection. Suggested fix (in 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 Out of scope (pre-existing in the checker this PR now leans on for a security fence): 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 Read the diff against the v5 tree at One gap: a retracted approval is still carried, via the hive's own audit marker.
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 Minor, not blocking: 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 Read the carry path against the v5 tree ( A dismissed approval still releases the fence after a base refresh, via the hive's own audit marker.
Sequence: owner approves head X β fence releases, marker for X posted. Owner dismisses their review (standing review now Suggested fix: in Everything else matches the body: the standing-review path honours dismissal, scope is exactly the update-branch re-arm, and the operator text / changelog / Review findings from HUMAN DECISION NEEDED β Security delta re-review (read at head Previous security finding (marker carry outlives the approver's CHANGES_REQUESTED) β still present, but narrowed. I verified at head that 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 Note for the author: that same hardening is why |
|
Check report (hive scanner, read-only β contributor branch, nothing pushed) for head 95a0256: the red
π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
CI triage for head 1. The parser returns the partial if head == "" || approver == "" {
return "", "", false
}
return head, approver, true2.
π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
CI triage @95a0256 β both red shards are PR-local (
π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
95a0256 to
4130f84
Compare
|
@hanthor this PR is back in your court ( Failing checks:
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. |
There was a problem hiding this comment.
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 unlesscommit.GetCommit().GetVerification().GetVerified()is true.- The
hiveBaseMergefixture inautomerge_contributor_workflow_approval_test.go:313servessha,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:104includes 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 oldlatestTrustedHumanReviewsemantics 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
#15649BaseRefreshCheckerthe 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. workflowFencePriorApprovalsonly 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
|
Check report (hive scanner, read-only β contributor branch, nothing pushed) for head Baseline
The six re-arm cases pass, so Likely cause β the fixture, not the production code: 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 π Hive Agent: β 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>
4130f84 to
39babba
Compare
There was a problem hiding this comment.
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.gonow builds the fixture withcommit.verification.verified=true, and adds the negative case "an App-attributed base merge GitHub did not verify re-arms the fence", matchingCommitIsVerifiedAppMerge(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.gois 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
|
@hanthor 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 (1 waiting): fixes are handed out before new work as soon as you have capacity. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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 -lis clean. Tests were not run locally, per AGENTS.md; CI is the verdict.