Skip to content

πŸ› [v6] stage 085: a workflow PR that touches a human-merge path routes to 090, not "approve and the hive merges" - #17622

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/085-human-merge-path-fence
Nov 11, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/085-human-merge-path-fence

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

With auto_merge.contributor_lane.owner_approval_releases_workflow_fence on, a contributor PR whose workflow edit also matches auto_merge.human_merge_paths was told that an owner's Approve review "releases the fence and the hive merges it". That is false: the approval only takes the lane to the human-merge-path gate, which adds hold and never merges. Under workflow_fence_scope: human_merge_paths that is every fenced PR. This PR makes the stage treat such a head as a person's merge from the start. It never asks for the approval, it names the human-merge path as the cause, and it parks the head at stage/090-ready-for-human-merge under the human-merge-path reason once the head is reviewed, green and soaked. It adds no GitHub call per sweep, no comment emitter and no raw write.

What happened

Seen on a live v6 hive (build 6246fc6):

  • 00:23:52Z: the 085 comment said "awaiting owner approval … releases the fence and the hive merges it". The reviewer had approved, checks were green, the soak was done.
  • 00:27:30Z: the owner approved that head.
  • 00:27:45Z: the hive added hold with "Hive will not merge this PR: it changes path(s) listed in auto_merge.human_merge_paths … A maintainer should review and merge this PR by hand".
  • 00:29Z: the 085 comment was rewritten. It listed the hold and still asked for the approval that releases the fence.
  • 01:21Z: still at 085. A maintainer merged it by hand.

The maintainer followed the hive's instructions and was left with no next step.

Cause

  • workflowFenceManual (automerge_stage_human.go) returns true only when the toggle is off or the App was refused workflows: write. It never asks whether the head touches a human-merge path. So the cause was CauseWorkflowPathAwaitingApproval and ApprovalReleasesFence was true.
  • Why the hold stayed at 085: the live build predates ✨ activity monitor: show sentinel and hold as pills on the PR's real stage instead of forcing needs-decisionΒ #17334, the v5 top-up that made hold a gate riding the head's real stage instead of a forced 085. On the v6 tip the held PR already lands at 090, but as a generic held 090. Its reason is label:hold, and it tells the person to "lift the hold, then /lgtm /approve", which is wrong for a human-merge-path hold. The 090 route only reaches the manual-merge branch when the evidence carries a manual-merge rule, and nothing on a hold-gate route set one for the human-merge-path provenance.

Fix

  • New automerge_human_merge_path_fence.go:
    • humanMergePathFencePersonMerge answers "is this head a person's merge because of human_merge_paths?". It returns yes for the hive's own human-merge-path hold (provenance from the stage pass's existing hold read), for the lane reason human-merge-path, or when the contributor head's complete file list matches human_merge_paths (with intent.HumanMergePathMatches, the gate's matcher) and the pin-only exception cannot admit the PR.
    • applyHumanMergePathFenceRoute drops the approval ask. Where the hand-off is about the fence, the human-merge path itself or a gate, it sets the human-merge-path cause as a manual-merge rule with no decision owed. RouteHuman already sends such evidence to 090 once the head is reviewed, green and soaked (the same path breaking-change PRs use). An unanswered requires_human verdict still asks for its decision at 085.
  • humanEvidence and headManualMergeRule OR the check into workflowFenceManual. workflowFenceManual itself is unchanged.
  • Data source, no extra call: the contributor lane already lists every head's complete changed-file list for its diff fence. It now records the match per head in the StageTracker (noteHumanMergePathFenceHead). The stage pass's own cached diff-fence read (headDiffFence) records it the same way when the lane stopped earlier (a label or sentinel), and re-reads only when no record exists for the head under the current human_merge_paths / pin-only config. adoptionMergeFence now also returns the PR and files it judged, for that.
  • Pin-only: humanMergePinOnlyExempt is split into humanMergePinOnlyCandidate (the checks that read nothing from GitHub) plus the existing commit and upstream checks. Its behaviour is unchanged. A PR the candidate check accepts keeps today's route, and the gate still decides.
  • A person's hold (or any hold-class label the hive's human-merge-path hold does not explain) keeps today's route. Only the approval ask is dropped.

How it fits with #17609

Refs #17609. It merged after this work started, so this branch sits on top of it. The two touch different functions:

This PR reads the provenance #17609 keeps current, so a stale hold never routes as human-merge-path. It has no shared helper and no dedupe to do later.

Parity

The dashboard chip and the admin MCP stage_tracker_read both read /api/stage-tracker. Its human_merge_reason is derived server-side from the stored stage reason by prstage.HumanMergeReason, and human-merge-path already maps to manual-merge-policy, which agent-now.js already words. Neither side hard-codes the reason, so the engine tests here are enough. No JS changed, and static/index.html still cmps equal to the static-src concatenation.

Tests

None of these were run locally: per AGENTS.md, CI is the verdict. Only gofmt -l was run, and it is clean. They are in automerge_human_merge_path_fence_test.go, next to the existing fence tests, which are not edited:

  • TestHumanMergePathFenceEvidenceNeverAsksForApproval: under scopes all and human_merge_paths, ApprovalReleasesFence is false and the cause is CauseHumanMergePath. This fails on the tip, where it is true and the cause is the awaiting-approval text.
  • TestHumanMergePathFenceRoutesTo090AfterVerdictChecksAndSoak: under both scopes the PR goes 050 β†’ 060 (soak) β†’ 090, with the reason mapping to manual-merge-policy, and no comment asks for an approval. This fails on the tip, which stays at 085.
  • TestHumanMergePathFenceRequiresHumanStaysAManualMergeDecision: an unanswered requires_human verdict stays at 085 as a manual merge with no approval ask.
  • TestHumanMergePathFenceLeavesUnlistedWorkflowAwaitingApproval: a workflow file outside human_merge_paths keeps "awaiting owner approval" (unchanged).
  • TestHumanMergePathFenceHiveHoldRoutesTo090WithTheHumanMergePathReason: the hive's hold, on a workflow path and on a non-workflow path, gives a 090 with the human-merge-path reason and "click Merge". This fails on the tip, which gives a generic label:hold 090.
  • TestHumanMergePathFencePersonHoldRoutesAsBefore: a person's hold keeps the label:hold 090 and its text.
  • TestHumanMergePathFenceHeadRecord and TestHumanMergePathFencePinOnlyCandidateRoutesAsBefore: a pin-only candidate keeps today's route, an untrusted author does not, and a config change re-judges the head.
  • TestHumanMergePathFenceLaneRecordsTheHeadsFiles: the lane records the match from the list it already read.

Stage goldens: none changed and none added. The golden corpus builds its evidence with its own goldenHumanEvidence, which models no human_merge_paths config and no hold provenance, and RouteHuman is unchanged. A golden case would mean extending the generator, which only -update can regenerate.

Docs: hive-merge.md, stage-labels.md and the owner_approval_releases_workflow_fence row of the operator reference now say a human-merge-path head is a person's merge either way. Changelog: changelog.d/fixed-085-human-merge-path-fence.md.

Out of scope

  • The human-merge-path rule itself (humanMergePathGate, its hold and its comment).
  • The pin-only exception's rules (only split, not changed).
  • Sentinel.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…s to 090, not "approve and the hive merges"

With auto_merge.contributor_lane.owner_approval_releases_workflow_fence
on, a contributor PR whose workflow edit also matches
auto_merge.human_merge_paths was told an owner's Approve review "releases
the fence and the hive merges it". The approval only led the lane to the
human-merge-path gate, which holds the PR and never merges it.

The human routing now treats a head that touches a human-merge path as a
person's merge: workflowFenceManual is OR'd with the new
humanMergePathFencePersonMerge check, so ApprovalReleasesFence is false,
and applyHumanMergePathFenceRoute gives the head the human-merge-path
cause and routes it to 090 once reviewed, green and soaked. The hive's own
human-merge-path hold routes the same way; a person's hold keeps its
route; a pin-only candidate keeps today's route.

The match reuses the file list the contributor lane already reads (and
the stage pass's cached diff-fence read), so there is no new GitHub call
per sweep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@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 11, 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, 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.

Read the diff against the v6 tree at 64c562d (merge-base) and the callers it wires into. This looks correct to me, and it is strictly more conservative than the tip: every head it reclassifies goes to a person, none to the hive.

What I verified, in the tree rather than from the description:

  • The 090 claim holds. applyHumanMergePathFenceRoute (automerge_human_merge_path_fence.go:168) sets CauseReason=CauseHumanMergePath, ManualMergeRule=true and flips CauseDecisionβ†’CauseTrust only when no requires_human decision is still owed. stagelabels.RouteHuman (src/pkg/stagelabels/human.go:684) already routes CauseTrust && ManualMergeRule && CauseReason != "" to ReadyForHumanMerge once wait is empty β€” the same branch breaking-change PRs use. The unanswered-requires_human case keeps CauseDecision, so decide at human.go:612-625 still carries the reviewer's question at 085.
  • Person's hold is left alone. automerge_human_merge_path_fence.go:171-174 returns before touching ManualMerge/cause whenever any hold-class label is present that the hive's own human-merge-path provenance (stagelabels/hold.go:49,60) does not explain; only ApprovalReleasesFence=false is applied first, which is the one thing that is wrong for such a head regardless of who holds it.
  • "No extra GitHub call per sweep" holds in the steady state. The lane records the match from the file list it already has (automerge_contributor_lane.go:1570). headDiffFence (automerge_stage_human.go:128) now re-reads only when the cached fence entry has no matching human-merge-path record; since tracker.fences[key] is written at :147 only after noteHumanMergePathFenceHead at :142, the two records are always set together, so the only re-read trigger is a human_merge_paths/pin-only config change β€” the intended re-judge. The re-read is also gated to stageLaneContributor (:137), and a repo with no human_merge_paths is known=true with no read.
  • Pin-only split is behaviour-preserving. humanMergePinOnlyExempt (automerge_human_paths.go:93-105) runs the same checks in the same order; humanMergePinOnlyCandidate only factors out the GitHub-free prefix.
  • headManualMergeRule (automerge_contributor_adopt.go:654-668) agrees with humanEvidence, so DerivePR and the stage pass route identically.

Tests: TestHumanMergePathFenceEvidenceNeverAsksForApproval asserts ApprovalReleasesFence=false + CauseHumanMergePath under both fence scopes, which is false on the tip β€” so the regression is covered. Docs/changelog match the implemented behaviour.

One honest open question, not a defect: humanMergePathFenceEntry.config embeds fmt.Sprintf("%+v", policy) of the pin-only exception; if that struct ever gains a field with unstable formatting (a map), every sweep would re-judge. Fine today, worth a note if PinOnlyException grows.

I have not approved or changed anything; patch-coverage and overlayfs-exec-guard were still running when I read it.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 11, 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 review at c19debd5 (current head 429b2507 only merges v6 in; none of this PR's files changed). No blocker; two advisory edge cases.

1. Adopted head keeps 085 instead of 090 β€” automerge_human_merge_path_fence.go:176-181. applyHumanMergePathFenceRoute matches e.CauseReason exactly against the workflow/human-merge-path causes, but humanEvidence (automerge_stage_human.go:531) has already prefixed an adopted head's cause with "the hive adopted this PR to repair CI, but ". For a hive-adopted contributor head that touches a human-merge path the switch hits default and returns with ManualMerge=true but no ManualMergeRule/CauseHumanMergePath, so it parks at 085 rather than routing to 090 like the un-adopted case. Low impact (adopted + human-merge-path is rare), but the fix is small:

	cause := strings.TrimPrefix(e.CauseReason, "the hive adopted this PR to repair CI, but ")
	switch cause {
	case "", prstage.CauseWorkflowPathManual, prstage.CauseWorkflowPathAwaitingApproval, prstage.CauseHumanMergePath:
	default:
		return
	}

(and keep the prefix when rewriting e.CauseReason below, or hoist the prefix string to a shared const).

2. Repeated reads when the head can't be judged β€” automerge_human_merge_path_fence.go:143 + automerge_stage_human.go:132-139. humanMergePathFencePersonMerge now calls headDiffFence for every contributor-lane human observation in a repo with human_merge_paths whose head has no record, where before (automerge_stage_human.go:535-542) the read only ran when !e.ManualMerge. When adoptionMergeFence returns contributorLaneReasonFilesEvidence (incomplete file list) or adoptionReasonHeadChanged, nothing is recorded in either fences or humanMergePathFence, so the two GitHub calls repeat every sweep for that head β€” the "no GitHub call per sweep" claim in the body holds only once a complete list has been read. Head-changed is transient; the incomplete-list case is persistent for very large PRs. Consider recording a known, non-person-merged entry on contributorLaneReasonFilesEvidence so the read is not retried each pass.

Tests cover both scopes, hive vs person hold, pin-only candidate, config re-judge and the lane record; the adopted-head and incomplete-list paths above are untested.

Evidence bundle `#17622429b250` sha256:6bbb602df1994a41bf270aedccd955d9afd35062ba8c3bed4e8d74765380847d β€” download from the dashboard or `hivectl review evidence #17622`.

@hivecommons-hive
hivecommons-hive Bot merged commit e983ea7 into hivecommons:v6 Nov 11, 2026
68 of 69 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant