Skip to content

✨ feat(automerge): enforce the human-merge pin-only exception in the sweep gate and /approve - #16377

Merged
hivecommons-hive[bot] merged 5 commits into
v5from
scanner/fix-16266
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 5 commits into
v5from
scanner/fix-16266

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #16266
Closes #16326
Part of #16242

Why

#16262 / #16300 added the auto_merge.human_merge_pin_only schema and a classifier, but no merge lane used them. Every SHA or digest bump on a guarded path still waited for a person. A routine pin bump from a trusted bump bot is the kind of change the opt-in exists to let through. Wiring only one lane would make that lane a bypass, and wiring a lane without /approve would let the two give contradictory answers. This PR adds the exception to every automerge sweep lane (self-authored, trusted-author, queued and contributor, all through humanMergePathGate). /hive approve uses the same helper, so the gate and the command cannot diverge. The relay side (#16265) is claimed separately and is not touched.

The gate reuses the changed-file list it already fetches for the path check, so it makes no extra API call. A repo without an enabled entry behaves exactly as it does today. The exception applies only when all of these hold:

  • the PR author is in trusted_authors
  • GitHub's reported changed-file count is present and equals the fetched list
  • ClassifyPinOnly accepts the diff

In every other case the PR is held as before. The exception never clears an existing hold; that is #16269.

Options.HumanMergePinOnly returns config.PinOnlyException, not the intent.PinOnlySpec named in the issue text. The spec carries no trusted_authors, which the gate needs. The value comes straight from the existing HumanMergePinOnlyFor accessor and is read live through cfg / b.cfg on every evaluation, so a config reload takes effect without a restart. This follows the HumanMergePaths wiring in main.go and main_sweeps.go.

Decision taken by hive (#16326)

The callers pass ClassifyPinOnly the full changed-file list, so a PR that bumps a pin and also edits any unguarded file is not treated as pin-only and stays held. This includes a changelog fragment or documentation. Three things already pointed to the strict reading:

The exception exists only for pure pin bumps, and the extra files are exactly what a person should look at. The docs now spell out the changelog/doc caveat: bump tooling must ship such files separately. Code and docs agree. /approve uses the same rule and is not kept stricter than the sweep.

Tests (CI is the verdict; nothing was built or run locally)

  • TestHumanMergePathGatePinOnlyException covers these cases:
    • paths unconfigured: no fetch, no hold
    • exception unconfigured or set for another repo: held as before
    • untrusted author: held
    • trusted pure pin: not held, no labels or comments
    • trusted pin plus an extra non-pin line: held
    • trusted pin plus an unguarded changelog: held
    • matched path outside the exception paths: held
    • missing patch: held
    • changed-file count absent: held
  • TestSetHumanMergePinOnlyNilEngineAndRemoval
  • TestPRApproveReplyPinOnlyMatchesSweep: /approve gives the same verdict as the sweep for a trusted pure pin, an untrusted author and a missing patch.

Docs: src/docs/hive-merge.md and src/docs/operator-reference/README.md now say the sweep and /approve enforce the exception and the relay does not yet. Changelog fragment: changelog.d/added-pin-only-human-merge-sweep.md.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor

…sweep gate and /approve

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@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 3, 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 hanthor 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 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

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

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 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

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

Read against v5 at merge-base. This looks correct to me; it does what #16266 scopes and nothing else.

What I checked:

  • Groundwork exists and is used as-is. intent.ClassifyPinOnly (src/pkg/intent/pin_only.go:34), PinOnlyException.Spec() and AutoMergeConfig.HumanMergePinOnlyFor (src/pkg/config/automerge_pin_only.go:45,67) are already on v5; HumanMergePinOnlyFor fails closed on disabled/invalid/ambiguous keys, so the gate's !ok branch covers those without re-validating.
  • All four lanes go through the one gate. humanMergePathGate is the only human-path check in the sweep (automerge_sweep_trusted.go:196,695, automerge_sweep_queued.go:146, automerge_contributor_lane.go:1462), so inserting the exemption at automerge_human_paths.go:143 covers them uniformly; /approve reuses humanMergePinOnlyExempt, so it cannot diverge.
  • Completeness and SHA binding hold. ListPRChangedFiles already errors when reported > len(files) (src/pkg/github/human_merge_paths.go:64); the new reported <= 0 || reported != len(files) check tightens that to exact. The eventual merge passes SHA: headSHA (automerge_merge_credit.go:26), so the classified files are the ones merged.
  • Unconfigured repos are byte-for-byte unchanged: currentHumanMergePinOnly returns (_, false) when no fn is installed, and humanMergePinOnlyExempt returns (false, "") before any work when matches is empty, so no new log line fires either.
  • Tests cover the held cases that matter (untrusted author, mixed diff, unguarded changelog, missing patch, absent count) and the /approve parity. CI is green.

Scope note for the record: this is opt-in merge policy that weakens a human-merge gate for a configured trusted_authors set, but the design (which lanes, parity with /approve, pure-diff-only per #16326) is spelled out in #16266 and requested by @hanthor, so I am not raising a decision question. The one open item it correctly leaves untouched is the relay (#16265).

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

Security perspective — no in-scope blocker. Read head ae28253 plus the surrounding tree.

Verified: the exception only fires for an enabled, validated policy (src/pkg/config/automerge_pin_only.go:83), requires a single-PR GET payload so changed_files is present (automerge_human_paths.go:109-111; list payloads read 0 and fail closed), the classifier keeps owner/repo@ byte-identical and rejects permission/secret/run text (src/pkg/intent/pin_only.go:18-22,159-170), head re-verification before merge covers a push after evaluation (automerge_sweep_trusted.go:242-257), and /approve stays reply-only (pr_approve_command.go:86-100).

One advisory, out of scope for #16266 (which specifies PR-author login):

  • Trust anchor is the PR opener, not the commits (automerge_human_paths.go:97-105). Any account with push to the trusted bot's head branch can add a pin commit (e.g. an actions/x@<sha> pointing at a fork-network commit) and inherit the exception, bypassing the human-merge hold that would apply to that account's own PR. The classifier contract (pin_only.go:31-33) asks callers to prove "authenticated trusted authorship"; a follow-up could require every head commit's author/committer to be the trusted login (or the PR's commits count to equal the bot's). Suggest tracking as backlog rather than blocking this landing.

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

docs-currency review (read at head ae28253 via local checkout; gh API cap was hit so the diff and tree were read from git, not the API — #16266 issue text could not be re-read).

The code in src/pkg/github/automerge/automerge_human_paths.go:87-113 matches what the new doc text claims (case-insensitive trusted_authors match via strings.EqualFold, GetChangedFiles() must be present and equal the fetched list, full file list passed to ClassifyPinOnly). Two operator-facing lines still disagree with the behavior this PR lands:

  1. src/docs/operator-reference/README.md:509 — the Human-merge pin-only rollout section still introduces the YAML example with "The additive configuration (schema landed in [scanner] human-merge pin-only exception: config schema + pure pin-only diff classifier #16262; not yet enforced) is:". That contradicts the Availability line this PR rewrote nine lines above (README.md:499-500, "the automerge sweep lanes and /approve enforce the exception") and the key table row at README.md:256. An operator reading the example alone would conclude enabling it is still a no-op. Suggested: "(schema [scanner] human-merge pin-only exception: config schema + pure pin-only diff classifier #16262; enforced by the automerge sweep lanes and /approve per [scanner] human-merge pin-only exception: enforce in automerge sweep and /approve #16266, relay pending [scanner] human-merge pin-only exception: enforce in merge-request relay #16265)".

  2. src/docs/hive-merge.md:177 — "the hive-merge relay and native-queue gates do not yet [enforce it]". There is no separate native-queue human-merge-path gate: tryNativeQueue is reached only after humanMergePathGate in every lane (automerge_contributor_lane.go:1462 → :1514, automerge_sweep_queued.go:146 → :167, automerge_sweep_trusted.go:196 → :272 and :695 → :735), so a PR enqueued to GitHub's merge queue already receives the exception introduced here. Only the relay (src/pkg/github/human_merge_paths.go:201-222, mergeRequestHumanMergePathRefusal) still lacks it. Suggested: drop "and native-queue gates", or say the native queue is entered only after the lane gate and so inherits the exception.

Advisory (not blocking): the Go doc comments at src/pkg/config/automerge_pin_only.go:10 ("staged policy") and src/pkg/config/config.go:8343 ("stages opt-in pin-only policy. Admission wiring must …") still describe the schema as unwired; worth a one-line refresh since godoc is generated from them.

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

Security perspective, head 2b0128f. No blocker from this angle; one advisory and one backlog item.

Advisory (in-scope, low): src/pkg/config/automerge_pin_only.go:10-14 and src/pkg/config/config.go:8343-8345 now state the gate "supplies trusted identity, exact-head diff and review evidence". humanMergePinOnlyExempt (src/pkg/github/automerge/automerge_human_paths.go, new helper) checks PR-opener login against trusted_authors and that pr.GetChangedFiles() equals the fetched list — nothing about review, and the files API is not pinned to the evaluated head (the merge is SHA-bound at automerge_merge_credit.go:26, so a race fails closed). pkg/intent/pin_only.go:31-33 still says callers MUST prove review of each upstream change. Please reword the two comments to what is actually proven so nobody later reads this gate as having satisfied that precondition.

Backlog (out-of-scope, medium): identity is hgithub.SafeGetLogin(pr.GetUser()) — the PR opener. Bump-bot branches are in-repo and writable by any collaborator; a pushed commit swapping an action SHA to any well-formed SHA still passes pinReplacement and now merges onto a human-merge path unattended. Same identity model as the existing trusted lane (automerge_sweep_trusted.go:594) and consistent with #16266, so not blocking here; a follow-up should require every head commit author to be the trusted author (as automerge_stage_dco.go already lists commits) before applying the exemption.

Evidence bundle `#163772981766` sha256:b6ba10c48c559c0cdd1f65043956b7a559893af2511624239ae0e8d1b3b51997 — download from the dashboard or `hivectl review evidence #16377`.

@github-actions

github-actions Bot commented Nov 3, 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
#16373 ✨ Add Crux-owned durable event and work lanes same files src/cmd/hive/main.go

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
ae28253

ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blocked

Hive flagged this PR (author @hivecommons-hive[bot], head ae2825305adb) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • remote_code_execution — adds a remote-fetch-and-execute, decoded payload, reverse shell or embedded credential (Adds curl|sh, eval of encoded payloads, reverse shells or embedded private keys)
    • src/pkg/github/automerge/automerge_human_paths_test.go

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the tree at ae28253, not just the diff. This looks correct to me and matches what #16266 specified.

What I verified

  • Every lane funnels through the one gate. humanMergePathGate is the only path-hold entry point for all four sweep lanes (automerge_sweep_trusted.go:196, :695, automerge_sweep_queued.go:146, automerge_contributor_lane.go:1462), and PRApproveReply (pr_approve_command.go:93) calls the same humanMergePinOnlyExempt, so the sweep and /approve cannot disagree.
  • GetChangedFiles() is real in every caller. The reported <= 0 || reported != len(files) check at automerge_human_paths.go:109 would silently disable the exception if any lane handed it a list-endpoint PR (no changed_files). All callers use PullRequests.Get — guardedPR (automerge_destination_merge.go:24), automerge_sweep_queued.go:663, automerge_contributor_lane.go:1301, pr_approve_command.go:40 — so the count is populated and the exactness requirement is meaningful. It also tightens ListPRChangedFiles (human_merge_paths.go:64), which only rejects shorter lists.
  • Fail-closed defaults. No enabled entry → (false, "") → existing hold path unchanged. ClassifyPinOnly (intent/pin_only.go:34-64) receives the full file list and rejects non-modified files, empty patches, and any file outside both the human-merge matches and the exception paths, so a bump that also touches a changelog or doc stays held (#16326).
  • Contributor-lane workflow fence is untouched. In PRApproveReply, the exemption only clears matches; diffReason == contributorLaneReasonWorkflowPath still produces the owner-approval reply, so the exception does not widen that fence.
  • Docs (hive-merge.md, operator-reference/README.md) now say sweep + /approve enforce, relay (#16265) does not — consistent with the code.

No findings. One non-blocking note for whoever lands #16265: humanMergePinOnlyExempt is on *Engine in pkg/github/automerge; the relay will need either the same helper exported or a copy, and a copy is where the two could drift.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

…pprove enforcement

Reword the operator-reference YAML intro, drop the native-queue claim from
hive-merge.md (queued PRs inherit the lane gate), and refresh the config
godoc to point at humanMergePinOnlyExempt (#16266).

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs-currency (read head 2b0128f)

  1. Stale "reload does not enable admission" sentence contradicts the new paragraph above it — src/docs/hive-merge.md:221-222 still says "Reloading this schema alone still does not enable admission. The integration PRs must wire live policy updates into every merge path." After this PR, humanMergePinOnlyFor is read live through cfg on every evaluation (src/cmd/hive/main.go:2197, src/cmd/hive/main_sweeps.go:849, :1447), so a seed reload does enable sweep//approve admission — which is exactly what the operator-reference section (README.md:510, :536-538) now tells operators to verify. Fix: reword to "Reloading this schema enables the sweep and /approve exception once the running image contains #16266; the relay (#16265) still ignores it."

  2. (advisory) src/docs/operator-reference/README.md:459 — the human_merge_paths sweep-key row still says the sweep lanes unconditionally "refuse a PR that touches a listed path, add hold". A one-clause pointer to the human_merge_pin_only exception would keep the two rows consistent.

Verified against code: all four lanes (automerge_sweep_trusted.go:196,695, automerge_sweep_queued.go:146, automerge_contributor_lane.go:1462) route through humanMergePathGate, so the "queued PRs inherit the exception" and "/approve uses the same helper" (pr_approve_command.go:93) claims in the docs are accurate.

— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

… a seed reload enables it

Reword the PinOnlyException / HumanMergePinOnly godoc to name the exported
entry points and the evidence the lanes actually supply (trusted PR author,
complete file list, SHA-bound merge; review stays a separate gate). Update
hive-merge.md so a seed reload is described as enabling the sweep and
/approve exception on an image containing #16266 while the relay (#16265)
still ignores it, cross-reference the exception from the human_merge_paths
sweep-key row, rewrap one long line, and fix the fileEntries fixture comment.

Hive-Fix-Attempt: 2/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read at 52795e3 against v5, tracing the trust claims rather than taking them from the body. Looks correct to me; this is opt-in per repo and the default path is byte-for-byte unchanged.

What I verified:

  • Single enforcement point. humanMergePathGate is the only sweep-side consumer of HumanMergePathMatches; all four lane call sites (automerge_contributor_lane.go:1462, automerge_sweep_queued.go:146, automerge_sweep_trusted.go:196, :695) go through it, so the exemption at automerge_human_paths.go:143-146 cannot diverge between lanes. /approve (pr_approve_command.go:92-95) reuses the same humanMergePinOnlyExempt, as #16266 asked.
  • Fail-closed inputs. ListPRChangedFiles already refuses a list shorter than GitHub's count (pkg/github/human_merge_paths.go:64), and the exemption additionally requires GetChangedFiles() > 0 && == len(files) (automerge_human_paths.go:109-111), so an absent count holds. config.HumanMergePinOnlyFor (automerge_pin_only.go:88) returns false unless Enabled and validate() pass, and refuses duplicate case-variant keys. intent.ClassifyPinOnly (pin_only.go:58-63) rejects any file outside both the matches and the exception paths, so the full-file-list #16326 case (pin + changelog) holds — covered by the test table.
  • Relay unchanged. mergeRequestHumanMergePathRefusal (pkg/github/human_merge_paths.go:200-225) still holds on any match; docs state this honestly (#16265 pending).
  • Policy provenance: parent #16242 is maintainer-filed with the Utah decision linked, so the trust choice here is already made; the sweep only honours an operator-configured enabled: true entry.

One note for the operator who enables this, not a defect: "trusted author" is the PR opener's login (automerge_human_paths.go:98). For *[bot] logins that is unambiguous; for a human login it does not prove who pushed the head commit. The classifier still bounds what can land to pin-string replacements on the configured paths, which is the mitigation #16242 relies on.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

Refresh godoc comments in automerge_pin_only.go and config.go to describe
the wired state and point at humanMergePinOnlyExempt and the sweep gate.

Closes #16381

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Pushed a godoc refresh for #16381 onto this branch (comment-only). hive/awaiting-ci: CI pending — sweep will merge when green.


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

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 v5 tree and the callers; this looks correct to me, and it is fail-closed at every step I could find. Enforcement is the capability @hanthor asked for in #16242 (with the delegated decision recorded there), so I am not raising it as a decision question.

What I verified (at 2981766):

  • automerge_human_paths.go:89-113 — humanMergePinOnlyExempt returns (false, "") unless the repo has an enabled, valid entry: config.HumanMergePinOnlyFor (automerge_pin_only.go:72-93) already rejects disabled, invalid, or case-ambiguous keys, so the sweep cannot be reached by a half-configured policy.
  • automerge_human_paths.go:109 requires pr.GetChangedFiles() to be present and exactly equal to the fetched list. All four lane callers (automerge_sweep_trusted.go:196,695, automerge_sweep_queued.go:146, automerge_contributor_lane.go:1462) get pr from guardedPR → PullRequests.Get (automerge_destination_merge.go:24), so changed_files is populated — the exception can actually fire, and the "count absent → held" test at automerge_human_paths_test.go:389 covers the other direction.
  • pr_approve_command.go:92-97 — the pin-only exemption only clears matches; diffReason == contributorLaneReasonWorkflowPath still produces the workflow-fence reply, so /hive approve does not acquire a new bypass of the owner-approval fence.
  • intent.ClassifyPinOnly (pin_only.go:34-83, pre-existing, now live) walks the full file list, refuses non-modified files, anything with owners in the path, and any line matching unsafePinRE; pinReplacement (:159-175) requires the same prefix on both sides, so an action/image name cannot change under a SHA bump.
  • Config reload: main.go:2194, main_sweeps.go:846,1444 read through cfg on every call, same shape as HumanMergePaths.

Body and diff agree, including the #16326 strict reading (mixed PRs held) — the "trusted pin plus unguarded changelog: held" case at automerge_human_paths_test.go:378-381 exercises it. src/docs/hive-merge.md is updated to say the sweep and /approve enforce while the relay (#16265) does not, which matches the code.

Open note, not a defect: pin_only.go:31-33 still says callers must prove "review of each referenced upstream change"; this PR deliberately substitutes trusted authorship (automerge_pin_only.go:10-13 says so). That is consistent with #16242's scope, just worth knowing when #16265 lands.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit bb7566b into v5 Nov 3, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16266 branch November 3, 2026 05:12
@github-actions

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

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
hivecommons-hive Bot pushed a commit that referenced this pull request Nov 10, 2026
…rd and admin MCP (#17489)

* ✨ feat(adminmcp): change merge settings through preview and confirm

Add auto_merge.update, an admin MCP write operation that wraps
PATCH /api/config/auto-merge, so an owner can change merge settings
without the dashboard.

The endpoint replaces every list and map it is sent whole, so the op
takes changes (add/remove per list, one repository's human-merge paths
set or unset), reads the current settings at preview time and sends the
merged whole value. The preview shows each change before and after and
discloses changes that let the hive merge more on its own.

A new confirmGuardOp hook lets write_confirm re-read that state: the op
fingerprints the before-value of every field it sends, and a changed
setting refuses the confirm with ErrConfirmationStale instead of being
overwritten. The op never merges anything; the endpoint's owner check
and validation still apply to both the read and the write.

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>

* 🐛 fix(adminmcp): use a non-misspelled unknown key in the auto_merge.update test

golangci-lint's misspell check flagged the deliberate typo "squash_onyl".
The test only needs a key the op does not accept; "squash_repos" is one.

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>

* ✨ feat(automerge): the pin-only exception can be set from the dashboard and admin MCP

auto_merge.human_merge_pin_only (#16377) could only be set in hive.yaml,
so a hosted hive needed a seed edit. PUT/PATCH /api/config/auto-merge now
takes it as a whole map, like human_merge_paths: keys are checked against
project.repos and stored as owner/repo, lists are trimmed and de-duplicated,
the map must pass ValidateHumanMergePinOnly, and an enabled entry the write
adds or changes is refused for a repository with no human_merge_paths,
where it would never apply. GET returns it with pin_only_kinds. A write
reaches the running hive at once: the sweep lanes and /approve read the
shared config, and the dashboard's GitHub-client sync now refreshes the
merge-request relay's copy too. A write that cannot be saved is rolled back.

Settings -> Features -> Auto-merge gets a per-repository editor next to the
human-merge paths. The admin MCP op auto_merge.update sets or unsets one
repository's exception and keeps the others, shows it before and after,
fingerprints it for the stale-preview check, and names turning one on or
adding paths, kinds or trusted authors as widening.

What counts as a pin bump, and every other merge gate, is unchanged.

Refs #16377

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>

* 🌱 chore(automerge): prefix the pin-only helpers with the op name

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>

---------

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off 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

0 participants