Skip to content

✨ feat(config): stage bounded human-merge pin-only policy and classifier - #16300

Merged
hivecommons-hive[bot] merged 13 commits into
v5from
hive/adopt-16297
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 13 commits into
v5from
hive/adopt-16297

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #16297 (adopted after CI went red and the contributor was unavailable; original commits by @mendezr preserved).

Closes #16262
Refs #16242

This branch is #16297's head 2b90d73dacde as pushed by @mendezr (fork mendezr/hive), unchanged. Last lane reason on the original: required-check-failing:coverage.

Hive fix agent: rebase this branch on v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 2, 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 kellyaa 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 2, 2026
@github-actions

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

No conflicting open PRs or same-file overlaps were found.

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 2, 2026
@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/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 2, 2026
mendezr and others added 3 commits November 2, 2026 16:02
Implement the shared foundation from #16262 for #16242 without loosening any merge admission gate. Carry complete patch evidence, reject unsupported or mixed diffs, and make the remaining trust, review and exact-head obligations explicit.

Hive-Run: #16242
Hive-Plan: ordered-children/16262-config-and-classifier
Hive-Spec: issue-16242#required-behavior
Co-authored-by: hanthor <5840441+hanthor@users.noreply.github.com>
Signed-off-by: mendezr <mendezr@users.noreply.github.com>
Signed-off-by: mendezr <mendezr@users.noreply.github.com>
…parity

The settings parity test treats every new hive.yaml leaf as a Settings
UI gap unless it is allowlisted; the pin-only policy is yaml-only.

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

hivecommons-hive Bot commented Nov 2, 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: branch synced with v5 (picks up the notificationWriteSites entry from #16310 that made test (rest 3/4) red on every PR that ran before it; see #16346). CI pending — sweep will merge when green.


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

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

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

Style review (read at head 185a4189; the dispatched head baaf10db has since been merged forward with origin/v5, no code change since).

No in-scope blocker against #16262; the schema, accessor, validation, Patch plumbing and classifier match the issue. Advisory notes:

  1. Allowed-kind list is spelled out three times. src/pkg/config/automerge_pin_only.go:21-26 (validate switch), src/pkg/intent/pin_only.go:36-43 (ClassifyPinOnly switch) and src/pkg/intent/pin_only.go:160 (pinReplacement ordered slice) each hard-code action-sha/image-digest/version-pin. config already imports intent for PinOnlySpec, so a single exported intent.PinOnlyKinds would keep the wiring children ([scanner] human-merge pin-only exception: enforce in merge-request relay #16265/[scanner] human-merge pin-only exception: enforce in automerge sweep and /approve #16266) from drifting when a kind is added.
  2. Non-deterministic validation message. src/pkg/config/automerge_pin_only.go:30 ranges over a map literal, so when two of paths/kinds/trusted_authors are empty the reported field varies run to run. An ordered slice of {name, values} pairs gives stable operator errors.
  3. Docs overlap. src/docs/hive-merge.md:170-208 ("Staged pin-only policy") and :210-216 ("Pin-only exception rollout") are adjacent and both state the key, the "does not enable the exception" caveat and the [scanner] human-merge pin-only exception: enforce in merge-request relay #16265/[scanner] human-merge pin-only exception: enforce in automerge sweep and /approve #16266 pointers; folding the second into the first would read cleaner.
  4. Out of contract: the // writeback:gated markers added in src/pkg/github/automerge/automerge_stage_labels.go:1529-1543 and src/pkg/github/pr_status_comment.go:61-75 (plus the baseline drop in src/pkg/writeback/testdata/direct-writes-baseline.txt:18) are unrelated to [scanner] human-merge pin-only exception: config schema + pure pin-only diff classifier #16262. The new comment at automerge_stage_labels.go:1501-1505 says the write-back decision is made at postStageNote, but I found no writeback.Gate/Allowed consult in that file (postStageNote at :1477); the ratchet's own guidance (src/pkg/writeback/ratchet_test.go:86-88) reserves the marker for calls that go through the gate. Not blocking here, but worth a separate backlog check that the marker is accurate; pr_status_comment.go raw baseline (direct-writes-baseline.txt:41) was also left at 2 while the file now has 0.

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

docs-currency review (head 7e34ea8)

Docs match the code: the grammar, fail-closed cases and validation rules described in src/docs/hive-merge.md:157-186 line up with src/pkg/intent/pin_only.go:17-22,34-77 and src/pkg/config/automerge_pin_only.go:20-40,49-63; the operator-reference row (src/docs/operator-reference/README.md:256) and settings_parity_allowlist.txt:158-161 are consistent. Issue #16262's "not yet enforced" marker is present in both docs.

One advisory (low):

  • src/docs/hive-merge.md:188-190 tells operators to "stage the key in the controller's configured hive.yaml seed" and says the watcher "reloads the seed". But src/cmd/hive/main.go:657-669 documents that when a persisted runtime config exists it is restored over the ConfigMap seed on pod restart, so edits made only to the seed are silently lost (the boot log says "fixes must land in the live config"). Suggest rewording to point operators at the live/runtime config (or both) rather than the seed alone, so a staged human_merge_pin_only block does not vanish on the next restart.

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

Summary: the pin-only classifier and config schema look correct to me and are not wired into any merge decision (verified: ClassifyPinOnly / HumanMergePinOnlyFor have no non-test callers; the only production reference is ValidateHumanMergePinOnly at src/pkg/config/validate.go:203). One part of this PR should come out before it lands: the two writeback ratchet commits (33a09b7, d4761a6) are unrelated to #16262, are no longer needed to pass CI, and mark three un-gated writes as gated.

Ratchet annotation — should be dropped from this PR (medium)

  • src/pkg/github/automerge/automerge_stage_labels.go:1530,1537,1542 and src/pkg/github/pr_status_comment.go:62,70,74 add // writeback:gated to the engineStatusForge / clientStatusForge EditComment / CreateComment / DeleteComment calls, and src/pkg/writeback/testdata/direct-writes-baseline.txt:18 lowers the automerge_stage_labels.go raw baseline from 5 to 2.
  • TestDirectWriteRatchet treats writeback:gated as "this call consults writeback.Gate.Allowed" (src/pkg/writeback/ratchet_test.go:85-91) and forbids ever raising a baseline (ratchet_test.go:24-25). But nothing on this path consults the gate: pkg/prstatus has no reference to writeback, writeStatusSection (automerge_stage_labels.go:1492) calls prstatus.Write directly, and of the four postStageNote callers only the needs-decision path checks writebackAllowed first (automerge_stage_human.go:679); the un-quiet CreateComment at automerge_stage_labels.go:1481 stays in the raw count as un-gated. So the quiet-mode edit/create/delete of the status comment is the same un-gated decision via a different path, now hidden from the ratchet with the floor lowered so it cannot be un-hidden.
  • The commit message says this was needed because TestDirectWriteRatchet failed on the merge commit. That is no longer true at the current merge-base: origin/v5 has 5 raw matches in automerge_stage_labels.go and 2 in pr_status_comment.go, exactly the baselined values, and this branch has the same totals without the annotations (I counted both). Reverting those two commits leaves the ratchet green and the pin-only work intact.

If the hive does want the forge plumbing out of the ratchet, that is a separate decision for the writeback owner and belongs in its own PR with the gate actually consulted at postStageNote.

What I checked and found correct

  • src/pkg/intent/pin_only.go:36-71 fails closed on every path I could construct: missing/empty patch, counts that disagree with Additions/Deletions, interleaved or unpaired +/- lines, unsupported \ No newline metadata, a guarded match not in the file list, and vice versa. Hunk-count tracking (pin_only.go:95-130) rejects truncated hunks.
  • pinReplacement (pin_only.go:150-206) requires the prefix to be byte-identical, the pin to differ, and quoting/suffix to be unchanged; unsafePinRE rejects anything touching permissions/secrets/cosign/etc. on either side. Quote-mismatch handling ("1.2.3 vs 1.2.3") is right.
  • HumanMergePinOnlyFor (src/pkg/config/automerge_pin_only.go:70-90) fails closed on case-insensitive duplicate keys and returns defensive copies; ValidateHumanMergePinOnly rejects wildcards and empty values.
  • boundedFiles/allFiles (src/pkg/intent/alignment.go:277,288) switch from a struct conversion to an explicit projection, so the new Patch field never leaks into DiffFileSummary; alignment_files_test.go covers it.
  • go build of pkg/intent, pkg/config, pkg/github, pkg/github/automerge passes at 185a418.

Docs in src/docs/hive-merge.md describe the schema as landed-but-not-enforced, which matches the code. Nothing else to flag.

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

Read the PR head against v5, then #16262. Looks correct to me, and it stays inside the scope the issue set ("No gate wiring in this child").

What I verified in the tree, not the diff:

  • Nothing consumes the new policy yet. grep over non-test Go for ClassifyPinOnly / HumanMergePinOnlyFor / HumanMergePinOnly finds only the definition in src/pkg/config/config.go:8342 and the validation hook at src/pkg/config/validate.go:203. No sweep lane, relay, /approve path or native-queue gate reads it, so the docs' "not yet enforced" claim in src/docs/hive-merge.md and operator-reference/README.md is true of the code, not just the prose.
  • Patch population is contained. ListPRChangedFiles (src/pkg/github/human_merge_paths.go:56) now carries f.GetPatch(), and boundedFiles / allFiles in src/pkg/intent/alignment.go:277,288 were changed from a struct conversion to explicit field copies so the patch text does not flow into DiffFileSummary (and from there into intent-alignment comments). duplicate_sweep.prChangedFiles keys on owner/repo#n@head, not on the struct, so fingerprints are unaffected.
  • Classifier fails closed where it should. classifyPinPatch (src/pkg/intent/pin_only.go:86-158) rejects \ No newline at end of file markers, interleaved -/+ runs, hunk-count overruns and any additions/deletions total that disagrees with the files-API counts; ClassifyPinOnly (pin_only.go:36-74) also requires every file in the PR — not just the guarded ones — to be a modified, patched, non-OWNERS file inside both the human-merge matches and the exception paths. Blank context lines ("" from GitHub) are normalised to " " at line 118, which is what the baaf10dbc fix commit addressed.
  • Validation matches the issue's contract. PinOnlyException.validate rejects unknown kinds even when disabled and requires all three lists when enabled; HumanMergePinOnlyFor fails closed on case-ambiguous duplicate keys (automerge_pin_only.go:68-90).

One note for the record, not a defect: the body says the branch is #16297's head 2b90d73dacde "unchanged", but it now carries 10+ fix-agent commits on top (rebase merges, settings-parity allowlist, blank-line fix). The body's own instruction to the fix agent anticipated that; the net diff vs v5 is the 16 files listed.

Evidence bundle `#16300c8d9cb9` sha256:ecb675b6345344f493c675e366294b134f3a88ca34e8256c6234ff4668a820c2 — download from the dashboard or `hivectl review evidence #16300`.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 2, 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.

Code looks correct to me and matches the scope #16262 sets (schema + pure classifier, no gate wiring). Two non-code items need fixing before merge: the body would close the parent tracker early, and this will conflict with #16293.

What I verified:

  • src/pkg/intent/pin_only.go:34-73 — ClassifyPinOnly requires every changed file to be in both the human-merge matches and spec.Paths, status modified, non-empty patch, and requires every match to appear in files; so a PR touching any unguarded file fails closed. classifyPinPatch (76-153) walks hunk headers with explicit old/new counters, rejects \ No newline and any other non-[ +-] line, and cross-checks additions/deletions against the API counts. pinReplacement (155-203) requires an identical prefix (uses: owner/repo@, FROM image@sha256:, version: ), a changed reference, and a byte-identical suffix except the action # vN comment; quote changes on version-pin are rejected. I did not find a way to get a non-pin line through it.
  • ClassifyPinOnly and HumanMergePinOnly have no non-test callers outside config/validate.go:203 — so "not yet enforced" in hive-merge.md is accurate.
  • src/pkg/github/human_merge_paths.go only gains Patch: f.GetPatch(); intent.go/alignment.go keep DiffFileSummary free of the patch body.

Items:

  1. Body closes the tracker prematurely. The body has both Closes #16242 and Refs #16242. #16242 is the parent whose other children (#16265 relay admission, #16266 sweep admission, #16269 attribution) are still open per this PR's own hive-merge.md text. On merge GitHub will close #16242. It should read Refs #16242 (relay/sweep admission and attribution still open) and keep only Closes #16262.
  2. Conflicts with #16293. git merge-tree pr16300 pr16293 → CONFLICT (content): Merge conflict in src/docs/hive-merge.md. Both insert a new section after line 154 (this PR: "Staged pin-only policy"; #16293: "Pin-only exception rollout"). They are complementary, not duplicate — whichever lands second needs a rebase, and ideally the two sections become one. operator-reference/README.md and human_merge_paths.go auto-merge cleanly.

I have not changed or closed anything.

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

@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 and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 2, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 2, 2026
@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 2, 2026
@hivecommons-hive hivecommons-hive Bot removed the stage/050-review-pending Review swarm requested; awaiting a verdict for the current head label Nov 2, 2026
…rite-site inventory)

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed 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 head 52953ce (the v5 merge-in). Two things, one new from the merge, one carried over.

New (low, docs): the merge left clientStatusForge.CreateComment listed twice in the write-site inventory table. v5 222fc9c (#16310) already added the row at src/docs/notifications.md:417; this branch's own row survived the conflict resolution at src/docs/notifications.md:428 with different wording ("under prstatus.Write; attributed to the UpsertPRStatusSection caller"). Nothing checks the table against notificationWriteSites (notification_write_sites_test.go only asserts the Go map, line 112), so CI will not catch it. Drop one — the branch's wording is the more specific of the two, so keeping 428 and deleting 417 is fine.

Carried over (medium): the blank-context-line rejection is unchanged. src/pkg/intent/pin_only.go:117 still reads if hunks == 0 || line == "" { return fmt.Errorf("invalid patch line %d", i+1) }, so a GitHub patch whose hunk context includes an empty line — the common case in .github/workflows/*.yml and Containerfiles — fails closed as invalid patch line N. The mechanism and suggested fix are in the review at 33a09b7; nothing in this head touches that function.

Verified and fine: direct-writes-baseline.txt:18 lowering automerge_stage_labels.go 5→2 matches the three // writeback:gated markers added in automerge_stage_labels.go; the ratchet only logs (never fails) when a file is under its baseline (ratchet_test.go:170-182), so leaving pr_status_comment.go at 2/2 after gating its three calls is loose but not red.

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

@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 and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
GitHub's compare API renders empty context lines as "" rather than
" ", so classifyPinPatch failed closed on most workflow/Containerfile
pin bumps that had a blank line inside the hunk. Treat an empty line
after a hunk header as a context line; a blank line before any hunk is
still rejected.

Also drop the duplicate clientStatusForge.CreateComment row left in
docs/notifications.md by the v5 merge.

Hive-Fix-Attempt: 5/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/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed 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.

Correctness delta re-review @ baaf10d — both prior findings are fixed:

  • src/pkg/intent/pin_only.go:117-124 — blank context lines are now normalised to " " after the hunks == 0 guard, so a leading blank line before any hunk is still rejected. Covered by the new blank context lines / blank line before hunk cases in pin_only_test.go:20-23. CI test shards are green at this head.
  • src/docs/notifications.md — the duplicate clientStatusForge.CreateComment row is gone; one row remains at line 417.

Advisory (non-blocking, fail-closed): pin_only.go:91 does strings.TrimSuffix(file.Patch, "\n") before splitting. If a GitHub patch ends with a blank context line (rendered as a trailing "\n"), that line is dropped, oldLeft/newLeft stay at 1, and the patch is rejected as "incomplete" — i.e. such a pin-only PR falls back to the human path rather than being misclassified as safe. Worth a follow-up test if that shape appears in practice.

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

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

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

Conclusion: the pin-only schema and classifier look correct to me and fail closed as documented. One thing should come out before merge: the writeback:gated annotations in commits 33a09b7/d4761a6 lower the direct-write ratchet baseline without any gate actually being consulted.

Finding (medium): six write sites are marked // writeback:gated but nothing on their path calls writeback.Gate.Allowed.

  • src/pkg/github/automerge/automerge_stage_labels.go:1530,1537,1541 (engineStatusForge.EditComment/CreateComment/DeleteComment) and src/pkg/github/pr_status_comment.go:62,70,74 (clientStatusForge.*) gained the marker.
  • The marker's meaning, per src/pkg/writeback/ratchet_test.go:15-24,85-88, is "migrated to the gate": a call that consults writeback.Gate.Allowed before writing. The existing uses follow that contract — e.g. automerge_adoption_close_first.go:162 checks c.writebackAllowed(...) and the raw calls at :166-173 carry the marker.
  • Here the only entry points are postStageNote (automerge_stage_labels.go:1477-1485) and UpsertPRStatusSection; neither consults the gate, and pkg/prstatus has no reference to Gate/Allowed at all. The new doc comment (:1501-1505) says "the write-back decision … is made (and ratcheted) at that entry point", but postStageNote in non-quiet mode is itself an unannotated raw Issues.CreateComment, so no decision is made anywhere.
  • Consequence: testdata/direct-writes-baseline.txt:18 drops automerge_stage_labels.go from 5 → 2 and pr_status_comment.go falls below its baseline silently. The ratchet forbids raising a line, so these six un-gated writes leave its visibility permanently and a future real migration has nothing to ratchet against.

The pin-only feature does not need this: on v5 the baseline already says 5 and 2 for these files and the PR adds no write calls, so the ratchet passes with the v5 baseline untouched. Suggest dropping the six markers, the two forge doc-comment paragraphs, and restoring direct-writes-baseline.txt to the v5 line. (If the intent was to fold these writes into the gate, that is a separate change that adds the Allowed check.)

What I verified on the pin-only change itself (src/pkg/intent/pin_only.go, src/pkg/config/automerge_pin_only.go):

  • ClassifyPinOnly requires every changed file to be in both the human-merge matches and the spec paths, and every guarded match to appear in the file list (pin_only.go:56-70), so a mixed PR or a truncated file list fails closed.
  • classifyPinPatch cross-checks hunk counts and the API's additions/deletions against the parsed patch (:164), rejects \ No newline metadata (:155), and requires removed/added lines to pair positionally.
  • ValidateHumanMergePinOnly is wired into ValidateWithOptions (validate.go:203); HumanMergePinOnlyFor refuses case-ambiguous keys and disabled/invalid entries.
  • Nothing calls ClassifyPinOnly or HumanMergePinOnlyFor outside tests yet — consistent with the body and hive-merge.md saying this stages policy without enabling an exception. go build ./pkg/intent/ ./pkg/config/ ./pkg/github/... is clean at baaf10d; pkg/config already imported pkg/intent on v5 (intent_defaults.go), so no new import edge.
  • boundedFiles/allFiles were changed from a struct conversion to an explicit projection because ChangedFile gained Patch; DiffFileSummary keeps its four fields, so alignment prompts don't grow.

I have not closed or approved anything.

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

@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 and removed 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

CI triage — docker (hub) red on head 185a4189 is infrastructure, not this diff.

Job 125663227747 fails in the Go build stage of the image with repeated

google.golang.org/grpc@v1.83.2: read "https://proxy.golang.org/google.golang.org/grpc/@v/v1.83.2.zip": stream error: stream ID 239; INTERNAL_ERROR

— a module-proxy download hiccup during go build, not a compile error, and this PR does not touch go.mod/go.sum. v5 HEAD 8e248f29 builds the same image green. A re-run should pass; agents cannot re-run jobs here, so deferring rather than pushing a retrigger commit.


🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

…baseline cut

Revert the status-comment forge annotations in automerge_stage_labels.go
and pr_status_comment.go, and the direct-writes-baseline.txt reduction
(automerge_stage_labels.go 5->2), to their v5 state. The annotated
EditComment/CreateComment/DeleteComment calls are not actually routed
through writeback.Gate.Allowed (prstatus.Write and writeStatusSection
never consult it, and only one of four postStageNote callers checks
writebackAllowed), so marking them gated would let un-gated writes leave
the ratchet permanently. v5 already baselines these files at their
current counts, so the change was unnecessary for CI and unrelated to
the pin-only policy work in this PR.

Hive-Fix-Attempt: 6/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/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed 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 the full diff at 230e529 with one question in mind: does anything here change what the hive will merge? It does not, and that is the main thing a maintainer needs to know about an XL PR under auto_merge.

  • ClassifyPinOnly (src/pkg/intent/pin_only.go:526) and HumanMergePinOnlyFor (src/pkg/config/automerge_pin_only.go:157) have no non-test callers in this diff; the only production wiring is ValidateHumanMergePinOnly in validate.go:203, which can only reject a config, never grant anything. hive-merge.md says the same ("Staged pin-only policy (not yet enforced)") and names the integration children (#16265, #16266).
  • The classifier fails closed on every path I traced: unknown kind, non-modified status, empty patch, hunk-count or API-count mismatch, interleaved -/+, any line outside the three pin grammars, and unsafePinRE on either side (pin_only.go:544-560, classifyPinPatch). Also checks all files in the PR, not just guarded ones, so a mixed PR cannot qualify.
  • ListPRChangedFiles now carries Patch (human_merge_paths.go:56). alignment.go:277-280,288-291 was changed from a struct conversion to a field copy so Patch stays out of DiffFileSummary — good, the per-file patch does not reach the intent prompt.
  • Config accessor returns copies; TestHumanMergePinOnlyConfig proves mutation does not leak back.

Info only (fail-closed, not a safety gap): unsafePinRE uses \benv\b, so an action or image whose name contains env as a hyphen-separated token (e.g. uses: org/env-setup@<sha>) can never classify as pin-only. Fine for a conservative first cut; worth knowing when #16265 wires it in and operators ask why such a bump was held.

Looks correct to me as staged, unenforced schema.

— hive: agent=reviewer 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 merge-base 6355040 plus the callers of intent.ChangedFile and ListPRChangedFiles. Looks correct to me, and it matches the scope #16262 set (schema + accessor + validation, Patch on changed files, pure classifier, docs marked "not yet enforced").

What I verified:

  • src/pkg/config/automerge_pin_only.go:70-90 — HumanMergePinOnlyFor fails closed on case-insensitive duplicate keys, disabled policy, or invalid policy, and returns copies of the slices. validate() rejects unknown kinds even when disabled and requires nonempty paths/kinds/trusted_authors when enabled — exactly the issue's rules. Wired into ValidateWithOptions at validate.go:206.
  • src/pkg/intent/pin_only.go:34-73 — the classifier checks every file in the PR (not only guarded matches), requires each to be both a human-merge match and in spec.Paths, modified, with a non-empty patch; and then requires every guarded match to have appeared. Mixed PRs and truncated file lists are rejected.
  • pin_only.go:75-147 — hunk accounting tracks old/new remaining counts and cross-checks additions/deletions against the API counts, so a truncated or \ No newline patch fails closed. Blank context lines ("" from the files API) are handled at line 117.
  • pin_only.go:149-207 — unsafePinRE is applied to both old and new lines before any kind match; prefix (a[1]) must be identical and only action-sha may vary its trailing # vX comment; version-pin refuses quote-style changes.
  • src/pkg/intent/alignment.go:277-291 — DiffFileSummary is now projected field-by-field, so the new Patch does not leak into alignment summaries / prompts. The other []intent.ChangedFile consumers (automerge_contributor_lane.go:1185, automerge_contributor_held_runs.go:51, cmd/hive/intent_verdicts.go:210) only read filenames/status.
  • No config ↔ intent import cycle (intent does not import config); CI build, tests, coverage and patch-coverage are all green at c8d9cb9.

Nothing is wired into a merge gate here, as the issue intended; a reviewer of the follow-up children should make sure trusted_authors is checked against authenticated login, not the PR body, since ClassifyPinOnly deliberately proves syntax only.

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

@hivecommons-hive
hivecommons-hive Bot merged commit 9ffa937 into v5 Nov 3, 2026
80 of 81 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the hive/adopt-16297 branch November 3, 2026 02:43
@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
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/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.

[scanner] human-merge pin-only exception: config schema + pure pin-only diff classifier

1 participant