Skip to content

✨ feat(automerge): workflow fence can be limited to release-critical workflows - #17484

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:feat/workflow-fence-scope
Nov 10, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:feat/workflow-fence-scope

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

This adds an opt-in setting so the contributor lane's workflow fence covers only each repository's release-critical workflows. Today every edit to .github/workflows or .github/actions waits for an owner's GitHub Approve on the exact head, and every push resets it. With the new setting, routine workflow edits (pin bumps, permission tightening) go through the normal review, CI and soak instead. The workflows an operator already lists in auto_merge.human_merge_paths keep the full fence. The default is unchanged.

What changes for an operator: nothing until they set auto_merge.contributor_lane.workflow_fence_scope: human_merge_paths (Settings → Features → Auto Merge → Contributor-lane auto-merge → Workflow fence scope). Sentinel still labels these PRs by default; see "Sentinel" below.


Why

On knuckle (hosted-projectbluefin-knuckle), about 30 open contributor-lane PRs touch .github/workflows or .github/actions. Each one waits for an owner Approve on the current head. Agents push often, so the approval keeps resetting. Most of these PRs are pin bumps or permission tightening.

The repositories already name their release-critical workflows in auto_merge.human_merge_paths, for example utah's build.yml, execute-release.yml, promote-testing-to-main.yml and post-testing-e2e.yml. The fence ignores that list.

What changes

  • New key auto_merge.contributor_lane.workflow_fence_scope:
    • all (default) is today's behaviour;
    • human_merge_paths fences a workflow or action file only if it also matches the repository's human_merge_paths, using the human-merge hold's own matcher.
    • Any other value is rejected on save (config load and PUT /api/config/auto-merge) and read as all.
  • Fails closed. The full fence stays when:
    • the repository has no human_merge_paths entry;
    • a workflow or action file was renamed (GitHub's file list gives only the new name, so a listed file renamed away would otherwise slip through);
    • GitHub refused the head's merge because the App lacks workflows: write. The head is marked hive:unauthorized (merge-workflow-path) and parks for a person, the same as an owner-released head. The durable marker is re-read after a restart, so the lane does not retry.
  • One helper for every merge decision. The lane, the stage engine's 085 notes and merge asks, and /hive approve replies all read the same scoped fence, so they cannot disagree.
  • Dashboard. A Workflow fence scope select (with help mark) in the contributor-lane settings, the GET/PUT field, and docs: hive-merge, operator reference and stage labels.

Safety

Sentinel

Sentinel's default sensitive_path list includes .github/workflows/** and .github/actions/**. It labels a contributor's PR sentinel-alert, and the contributor lane will not merge until a person clears that label. This PR does not change Sentinel. On a hive that keeps the default list, scoped workflow PRs still wait for a person, at the Sentinel label instead of the fence. The docs name sentinel.sensitive_paths as the second setting an operator would change, and what that costs.

Files

  • pkg/config/review_config.go: the key, values, EffectiveWorkflowFenceScope, validation.
  • cmd/hive/merge_eligibility.go: passes it into the lane policy.
  • pkg/github/automerge/automerge_workflow_fence_scope.go (new): contributorLaneMergeFence, workflowFenceCovers, contributorLaneTouchesWorkflowFiles, workflowFenceScopeKey, workflowMergeRefusedOnRecord.
  • automerge_contributor_lane.go: the lane uses the scoped fence.
  • automerge_contributor_workflow_approval.go: the permission-refusal fallback also covers an unfenced workflow edit.
  • automerge_contributor_held_runs.go: unscoped workflow check.
  • automerge_contributor_adopt.go: adoptionDiffRefusal (unscoped, for publication guards) and adoptionMergeFence (scoped). The in-place adoption note uses the scoped fence.
  • automerge_stage_human.go: headDiffFence uses the scoped fence; the cache key includes the scope.
  • pr_approve_command.go: /hive approve uses the scoped fence.
  • pkg/dashboard/api_config_automerge.go, static-src/js/config-features.js, static-src/js/config-helpers.js, static/index.html: the setting and its control. The same edit was made in both the sources and index.html; concatenating the manifest's files matches index.html byte for byte.
  • Docs: hive-merge.md, operator-reference/README.md, labels-and-control-signals/stage-labels.md.
  • changelog.d/added-workflow-fence-scope.md

Tests

None were run locally (AGENTS.md:7). CI is the verdict. Only gofmt -l and node --check were run.

  • TestContributorLaneWorkflowFenceScope:
    • all, unset or unknown scope keeps the fence;
    • scoped with an unlisted workflow or action merges;
    • a listed workflow is fenced;
    • a repository without an entry is fenced;
    • a renamed file is fenced;
    • tests removed still wins.
  • TestContributorLaneWorkflowFenceScopeMergeUnauthorized: a workflows: write refusal marks the head and stops at workflow-path. Neither a second tick nor a restart that sees the marker retries the merge.
  • TestContributorLaneWorkflowFenceScopeKeepsHeldRunsRefused: a registry-trusted fork PR whose workflow edit the scope lets through still has no held runs approved.
  • TestWorkflowFenceScopeStageNoteAgreesWithLane: the 085 note behind a sentinel alert does not call an unlisted workflow edit a manual merge, but does for a listed one.
  • TestPRApproveReplyWorkflowFenceScope: /hive approve gives the ordinary acknowledgement for an unlisted edit, says a person merges a listed one, and keeps today's wording under all.
  • TestContributorLaneMergeFenceHelpers, TestContributorLaneAutoMergeConfigWorkflowFenceScope, and new assertions in TestAutoMergeGet_ContributorLaneDefaults / TestAutoMergePut_ContributorLaneValidation: GET/PUT round-trip and rejection of unknown values.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…workflows

Add auto_merge.contributor_lane.workflow_fence_scope. "all" (default)
keeps today's fence on every .github/workflows / .github/actions edit.
"human_merge_paths" fences only workflow / action files that also match
the repository's auto_merge.human_merge_paths, so routine workflow edits
go through review, CI and soak without an owner Approve on every head.

The scoped fence fails closed: no human_merge_paths entry, a renamed
workflow file, or a head GitHub refused to merge for want of
workflows: write keeps the fence. One helper (contributorLaneMergeFence)
feeds the lane, the stage notes and merge asks (headDiffFence) and
/hive approve. The held-run approval guard and adoption's refusal to
publish workflow edits upstream stay unscoped. The tests-removed fence,
Sentinel and the human-merge hold are unchanged.

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 10, 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 nicholasjackson 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 10, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 9e36158 into hivecommons:v6 Nov 10, 2026
74 of 78 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Evidence bundle `#17484120672b` sha256:eecacba1085ade92fc17ff58fb18fd9d5fcaeac0d2ed93d4eab200545ac6ce49 — download from the dashboard or `hivectl review evidence #17484`.

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

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