Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-pin-only-human-merge-relay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Enforce the configured trusted-author pin-only exception in the GitHub merge-request relay with the same checks as the automerge sweep (complete pin-only diff, verified trusted-author commits, upstream-anchored action pins) plus an exact requested head before and after fetching files, while preserving all other merge gates.
2 changes: 1 addition & 1 deletion changelog.d/added-pin-only-human-merge-sweep.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Enforce the `auto_merge.human_merge_pin_only` exception in the automerge sweep lanes and `/hive approve` (#16266): a PR by a listed trusted author whose complete diff is pin replacements on guarded paths is no longer held for a person. Any other changed file, including an unguarded changelog or doc, keeps the hold (#16326). Repos without an enabled entry are unchanged, and the `hive-merge` relay does not apply the exception yet (#16265).
- Enforce the `auto_merge.human_merge_pin_only` exception in the automerge sweep lanes and `/hive approve` (#16266): a PR by a listed trusted author whose complete diff is pin replacements on guarded paths is no longer held for a person. Any other changed file, including an unguarded changelog or doc, keeps the hold (#16326). Repos without an enabled entry are unchanged; the `hive-merge` relay enforces the same exception as of #16265.
7 changes: 7 additions & 0 deletions src/cmd/hive/notifywire.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ func syncAutoMergePolicyToGitHubClient(cfg *config.Config, ghClient *github.Clie
ghClient.SetMergeRequestNoCIAllowedRepos(cfg.AutoMerge.NoCIOKSet())
// The merge-request relay refuses PRs touching these paths (#11039).
ghClient.SetHumanMergePaths(cfg.AutoMerge.HumanMergePaths)
pinOnly := make(map[string]github.PinOnlySpec)
for repo := range cfg.AutoMerge.HumanMergePinOnly {
if ex, enabled := cfg.AutoMerge.HumanMergePinOnlyFor(repo); enabled {
pinOnly[repo] = github.PinOnlySpec{Enabled: true, Paths: ex.Paths, Kinds: ex.Kinds, TrustedAuthors: ex.TrustedAuthors}
}
}
ghClient.SetHumanMergePinOnly(pinOnly)
ghClient.SetAutoMergeMinHeadAge(cfg.AutoMerge.EffectiveMinHeadAge())
return set, ok
}
19 changes: 10 additions & 9 deletions src/docs/hive-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,11 @@ sweep lanes whatever the intent tier. If the changed-file list for a configured
repo cannot be fetched completely, the merge is withheld (fail closed). See
[operator-reference.md](operator-reference.md).

**Pin-only policy (enforced by the automerge sweep and `/approve`; relay pending).**
**Pin-only policy (enforced by the automerge sweep, `/approve`, and relay).**

`auto_merge.human_merge_pin_only` provides the schema and conservative diff
classifier for #16242 / #16262. **The automerge sweep lanes and `/approve`
enforce it (#16266); the `hive-merge` relay does not yet** (#16265) and still
requires the existing human-merge path policy. The native merge queue is entered
enforce it (#16266), as does the `hive-merge` relay (#16265)**. The native merge queue is entered
only after a lane's human-merge-path gate, so queued PRs inherit the exception. A sweep lane
does not hold a PR on its human-merge-path matches when the repo has an enabled
entry, the PR author is in `trusted_authors` (case-insensitive login match),
Expand Down Expand Up @@ -236,18 +235,20 @@ This classifier proves **syntax only**, not authenticated identity, exact-head
binding, file-list completeness, semantic interpretation or review of upstream
references. The sweep supplies the author (GitHub's PR author login), the
verified-commit provenance of the head, file-list completeness and the
upstream anchoring of each action SHA itself (#16399); the relay integration
remains #16265;
upstream anchoring of each action SHA itself (#16399). The relay applies
the same checks through `Client.SetHumanMergePinOnly` (#16265) and additionally
requires a nonempty requested head SHA matching the PR head before and after
fetching files;
attribution and safe hold release are tracked in #16269. None of the
schema or classifier APIs grants permission to merge or clears a hold. Native
required checks and producer bindings, freshness, current reviews, substantive
objections, unrelated holds and configured soak must remain independent gates.

Operators stage the key in the controller's configured `hive.yaml` seed, not in
the image repository (reload behaviour is documented in the operator reference
linked above). On an image that contains #16266, reloading the seed enables
the sweep and `/approve` exception at once; the `hive-merge` relay still
ignores the key until #16265 lands, so relay merges keep holding matching PRs.
linked above). On an image that contains #16266 and #16265, reloading the seed enables
the sweep, `/approve`, and `hive-merge` relay exception at once. Non-GitHub
forge relays retain the existing fail-closed human-merge-path policy.

There is **no minimum deployable version enabling this lane yet**. Utah rollout
and current-head positive/negative deployment evidence remain tracked by
Expand All @@ -257,7 +258,7 @@ projectbluefin/utah#1082 and #16242; projectbluefin/utah#1068 is not pre-authori
`auto_merge.human_merge_pin_only`; see the
[operator reference](operator-reference/README.md#human-merge-pin-only-rollout)
for its configuration and deployment prerequisites. The schema/classifier
(#16262), relay admission (#16265), and sweep admission (#16266, landed) are
(#16262), relay admission (#16265, landed), and sweep admission (#16266, landed) are
separate changes: this attribution change alone does **not** enable the exception.
New path-hold comments retain `<!-- hive-human-merge-path -->` and append
`<!-- hive-human-merge-path-head: <40-character SHA> -->` only when Hive
Expand Down
10 changes: 5 additions & 5 deletions src/docs/operator-reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Go callers keep reading `cfg.Agents`, `cfg.Governor.Gateways` and so on through
| `config.refuse_gate_regression` | `false` | Safety-gate regression guard ([#16438](https://github.com/hivecommons/hive/issues/16438)). At boot the hive compares the effective config against any previous runtime overlay still on the PVC (`/data/hive.yaml.runtime`, an operator's `hive.yaml.runtime.bak`, `/data/hive.yaml.dashboard`) for `review.require_labels`, `project.issue_filter.require_labels`, `project.paused_repos` and `writeback.per_repo` modes. A gate the overlay carried that the effective config lacks or loosens — typically a boot from the ConfigMap seed after the overlay was moved aside — is logged once per gate as `WARN safety gate dropped: <gate> (was <value>) — effective config has <value>`, listed in `/api/status` under `config.gate_regressions`, and shown as a banner at the top of Settings. `true` makes it fatal: the hive exits (code 21) with the gates named instead of running with weaker gates. Set it in the overlay itself; the ConfigMap seed is the file the regression usually comes from. Legacy `/data/hive.yaml.bak` is not consulted — it is frozen at the rename and would warn forever about gates removed on purpose. |
| `auto_merge.allow_unprotected_base` | Deprecated no-op. | Accepted so older configs keep loading. `hive-merge` now merges into any protected or unprotected branch the App can write, subject to the CI-evidence gate and GitHub's own merge rules. |
| `auto_merge.no_ci_ok` | Empty by default. | Explicit repo list whose zero-CI merge-request verdict may pass; failing or pending CI evidence is still enforced. |
| `auto_merge.human_merge_pin_only` | Unset (off); enforced by the automerge sweep lanes and `/approve` (#16266), **not yet by the `hive-merge` relay** (#16265). | Per-repo schema for `enabled`, `paths`, `kinds` (`action-sha`, `image-digest`, `version-pin`) and `trusted_authors`. Enabled entries require all three lists. The sweep does not place a human-merge-path hold on a PR whose author is in `trusted_authors`, whose complete diff (every changed file, guarded or not) is pin replacements, whose every commit is authored by a `trusted_authors` login with a GitHub-verified signature, and whose every new action SHA resolves in its upstream action repository (the `# vN` tag points at it, or it is on the default branch; #16399); it never clears an existing hold. See [hive-merge.md](../hive-merge.md) for grammar, restrictions and outstanding integration/deployment requirements (#16242). |
| `auto_merge.human_merge_pin_only` | Unset (off); enforced by the automerge sweep lanes and `/approve` (#16266), and by the `hive-merge` relay (#16265), which additionally requires the requested head SHA to match the PR head before and after fetching files. | Per-repo schema for `enabled`, `paths`, `kinds` (`action-sha`, `image-digest`, `version-pin`) and `trusted_authors`. Enabled entries require all three lists. The sweep does not place a human-merge-path hold on a PR whose author is in `trusted_authors`, whose complete diff (every changed file, guarded or not) is pin replacements, whose every commit is authored by a `trusted_authors` login with a GitHub-verified signature, and whose every new action SHA resolves in its upstream action repository (the `# vN` tag points at it, or it is on the default branch; #16399); it never clears an existing hold. See [hive-merge.md](../hive-merge.md) for grammar, restrictions and outstanding integration/deployment requirements (#16242). |
| `auto_merge.human_merge_paths` | Unset (off). | Per-repo map of `owner/repo` to glob patterns (same syntax as `intent.guardrail_path_patterns`) for paths a person must merge. Applies to every merge lane (App self-merge, trusted-author, label-queued, merge-request relay) whatever the intent tier; a matching PR is held with one comment, and an incomplete changed-file list fails closed. Details in the sweep key table below. |
| `auto_merge.human_merge_title_prefixes` | `["⚠️", "⚠"]` | Title prefixes (after trimming) that mark a PR as a breaking change a person must merge. Every auto-merge lane and the merge train skip the PR; the tracker parks it at 090 *Ready for human merge · human merge*. Set to `[]` to disable. |
| `auto_merge.human_merge_labels` | `["needs-owner-merge"]` | Labels (case-insensitive) that mark a PR a person must merge; same effect as the title prefixes. Set to `[]` to disable. |
Expand Down Expand Up @@ -457,7 +457,7 @@ advanced into the merge path.
| `auto_merge.repos.<repo>.required_checks` | inherits default | Per-repo override for heterogeneous hives. `<repo>` may be the bare name from `project.repos` or `owner/repo`; an explicit empty list declares that GitHub has no required contexts, while Hive still requires positive CI evidence from at least one real successful check-run before merge. |
| `auto_merge.allow_unprotected_base` | deprecated no-op | Accepted for compatibility only. [`hive-merge`](../hive-merge.md) no longer refuses solely because a base branch has no GitHub branch protection; it may merge into any branch the App can write after positive CI evidence. |
| `auto_merge.no_ci_ok` | unset (refuse) | **Merge-request watcher key, not a sweep key.** Per-repo opt-in that downgrades only the "unverified" CI verdict (zero statuses, check runs, and workflow runs) to green, for adopted repos with no CI by design. Red and pending verdicts are never downgraded (#6281). See [hive-merge.md](../hive-merge.md). |
| `auto_merge.human_merge_paths` | unset | Per-repo map of `owner/repo` to glob patterns (same syntax as `intent.guardrail_path_patterns`) for paths a person must merge, e.g. `Danathar/goodreads-mcp: [".claude/settings.json", ".claude/hooks/**"]`. Every App merge path honors it: the automerge sweep lanes (App self-merge, trusted-author, label-queued) and the agent merge-request relay refuse a PR that touches a listed path, add `hold`, and post one `<!-- hive-human-merge-path -->` comment naming the path(s); a person must merge it. The sweep lanes skip that hold only for a PR admitted by `auto_merge.human_merge_pin_only` (#16266); the relay does not apply that exception yet. If the changed-file list cannot be fetched completely for a configured repo, the merge is withheld (#11038, #11039). |
| `auto_merge.human_merge_paths` | unset | Per-repo map of `owner/repo` to glob patterns (same syntax as `intent.guardrail_path_patterns`) for paths a person must merge, e.g. `Danathar/goodreads-mcp: [".claude/settings.json", ".claude/hooks/**"]`. Every App merge path honors it: the automerge sweep lanes (App self-merge, trusted-author, label-queued) and the agent merge-request relay refuse a PR that touches a listed path, add `hold`, and post one `<!-- hive-human-merge-path -->` comment naming the path(s); a person must merge it. The sweep lanes and GitHub relay skip that hold only for a PR admitted by `auto_merge.human_merge_pin_only` (#16266, #16265); the relay also requires the exact requested head before and after fetching files. If the changed-file list cannot be fetched completely for a configured repo, the merge is withheld (#11038, #11039). |
| `auto_merge.human_merge_title_prefixes` | `["⚠️", "⚠"]` | PR-title prefixes that mean "breaking change — owner merges" (U+26A0 with or without the VS16 selector by default, matched after trimming leading whitespace). One shared predicate, `automerge.RequiresHumanMerge(pr)`, runs where each lane computes eligibility — App self-merge, label-queued, trusted-author and contributor lanes, plus the refetch before a merge — so a matching PR is never merged by hive and never fronts a merge train, however green and however approved. The PR parks at stage 090 *Ready for human merge* with the `human merge` chip and reason *breaking change — owner merges*; the owner merges it with **Approve & merge as maintainer** or on GitHub. Hive posts one writeback-gated comment saying it will wait for a human. Set to `[]` to turn the title rule off. Added after a ⚠️-titled PR was auto-merged by the trusted-author lane while its owner was still deciding whether to ship it. |
| `auto_merge.human_merge_labels` | `["needs-owner-merge"]` | Labels (case-insensitive, trimmed) that carry the same "a person merges this" meaning as the title prefixes above; either match is enough. Set to `[]` to turn the label rule off. |
| `auto_merge.require_current_base` | unset | Repo list (`owner/repo`) with an explicit **on** override for the current-base merge gate (Settings → Repos → "Merge only on current base"). On a gated repo the App self-merge, trusted-author and contributor lanes only merge a head that contains the current base tip. A green head tested against an older base is updated with GitHub update-branch (a merge commit; no author commit is rewritten) and merges once CI is green on the new head, so a semantic conflict with work merged since turns that PR red instead of breaking the base ([#13634](https://github.com/hivecommons/hive/issues/13634), [#15335](https://github.com/hivecommons/hive/issues/15335)). Costs one compare call per merge candidate. Listing a repo here is also **strict**: a behind head the App cannot update (fork without maintainer edits, branch protection or a missing `contents: write`) is parked (`fork-not-editable` / `update-branch`) rather than merged as tested. Wins over `skip_current_base` and over the default. |
Expand Down Expand Up @@ -498,8 +498,8 @@ hosted spoke changes survive restarts without editing `hive.yaml`.

### Human-merge pin-only rollout

**Availability:** the automerge sweep lanes and `/approve` enforce the
exception (#16266); the relay does not yet. Minimum
**Availability:** the automerge sweep lanes and `/approve` (#16266) and the
GitHub relay (#16265) enforce the exception. Minimum
supported version: the first deployed v5 release containing the schema/classifier
(#16262), relay (#16265), sweep (#16266), and hold-release admission integration
(#16269). No released version is established here; do not assume an existing
Expand All @@ -508,7 +508,7 @@ digest/version and live positive/negative evidence in projectbluefin/utah#1082
before enabling that rollout.

The additive configuration (schema #16262; enforced by the automerge sweep lanes
and `/approve` per #16266, relay pending #16265) is:
and `/approve` per #16266, and the GitHub relay per #16265) is:

```yaml
auto_merge:
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/config/automerge_pin_only.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
// and commit provenance: every commit behind the head must have a trusted
// author login, a committer that is GitHub itself (web-flow) or a trusted
// login, and a GitHub-verified signature (#16399). It does not prove upstream
// review (separate gates handle that). The hive-merge relay does not yet apply
// it (#16265).
// review (separate gates handle that). The hive-merge relay applies the same
// policy through Client.SetHumanMergePinOnly (#16265).
type PinOnlyException struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Paths []string `yaml:"paths" json:"paths"`
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8349,8 +8349,8 @@ type AutoMergeConfig struct {
HumanMergePaths map[string][]string `yaml:"human_merge_paths,omitempty" json:"human_merge_paths,omitempty"`

// HumanMergePinOnly holds the opt-in pin-only exception, enforced by the
// automerge sweep and /approve gates via humanMergePinOnlyExempt (#16266);
// the hive-merge relay does not apply it yet (#16265).
// automerge sweep and /approve gates (#16266), and the hive-merge relay
// (#16265).
HumanMergePinOnly map[string]PinOnlyException `yaml:"human_merge_pin_only,omitempty" json:"human_merge_pin_only,omitempty"`
// HumanMergeTitlePrefixes lists title prefixes (matched after trimming
// the title) that mark a PR as one the owner merges by hand; no lane and
Expand Down
Loading
Loading