Skip to content

πŸ› stageengine: classify repo-auto-merge-disabled from head evidence instead of handing off - #17568

Merged
hivecommons-hive[bot] merged 1 commit into
v6from
scanner/fix-17565
Nov 10, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v6from
scanner/fix-17565

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #17565
Part of #17552 (lane half remains in #17566)

Why

ClassifyStage listed repo-auto-merge-disabled in stageHandoffReasons. That meant "not this lane's PR", so any observation with that reason produced the zero verdict and was thrown away. prstage.HumanMergeReason already maps the reason to the 090 Β· auto-merge off code, but no classification could ever reach it. This PR, the engine half, changes the classifier first. The lane child (#17566) can then start producing these observations, and the goldens only change once.

Change (src/pkg/stageengine/derive_pr_classify.go)

repo-auto-merge-disabled is no longer a hand-off. It is now classified from the head's evidence, reusing the same helpers as the rest of the classifier:

  • needs-rebase label, a human change request, a blocking verdict (changes_requested / reject), or a red check β†’ the author's fixing stage (070/071/072). SharedCIDeferredStage, BaseBranchRedStage and ForkGuardStage keep their usual priority.
  • requires_human (RequiresHumanStage), a decision-requested verdict with no human approval on the head, a sentinel alert (Detail.SentinelAlert), or a hold label (stagelabels.Holds) β†’ 085.
  • No approve verdict yet β†’ 050.
  • Approve (or a trusted human's approval of a requires_human head) and green β†’ 090 owned, recorded under the lane reason, so HumanMergeReason returns auto-merge-off.
  • It never classifies as 080, 095 or 100.

The lane-reason-{authorkind,modifier,verdict}.json goldens were edited by hand, and only the repo-auto-merge-disabled rows changed. Each new row was derived from the existing row of an equivalent path (something-unmapped, contributor-lane:no-verdict, held/needs-rebase, an admission reason's approve route) and checked against it. The err rows are unchanged, and no other reason's rows changed.

Test

TestClassifyStageRepoAutoMergeDisabledFromHeadEvidence (derive_pr_repo_automerge_off_test.go) covers 9 cases Γ— 3 lanes: no verdict, approve+green, approve+red, changes_requested, requires_human, decision requested, needs-rebase label, sentinel, and hold. It also checks that the 090 case's human-merge reason is auto-merge-off. Every case fails without the fix, because the tip returns the zero verdict for this reason. Per AGENTS.md, CI is the only verdict; nothing was run locally.

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@Danathar

…17565)

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 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 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 10, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 10, 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):

Correctness perspective β€” read head 2b33dc9 (diff + derive_pr_classify.go, prstage/reasons.go, goldens). CI green, goldens verified by stage_goldens_test.go. No blocker.

Low (in-scope, advisory): body claim vs. recorded reason on the human-approved 090 path. The PR body says a trusted human's approval of a requires_human head lands at 090 "recorded under the lane reason, so HumanMergeReason returns auto-merge-off". It does not: WithHumanApprovalReason (derive_pr_classify.go:238-243) sets Reason to reviewer-verdict:requires_human:human-approved@<user>, and HumanMergeReason (prstage/reasons.go:229, :254-255) strips the suffix and maps that to reviewer-deferred, not auto-merge-off. The golden contributor-lane/repo-auto-merge-disabled/verdict=requires_human-human-approved (lane-reason-verdict.json, +line 302) encodes exactly this. Behaviour is consistent with every other 090 path, so no code change needed β€” only the PR body/changelog overstates it. The new unit test only asserts auto-merge-off for the plain-approve case.

Out-of-scope (pre-existing): err+approve still classifies as 080. The o.Err branch (derive_pr_classify.go:362-381) runs before the new reason == "repo-auto-merge-disabled" block, so an errored observation with an approve verdict returns AwaitingMergeAdmission at role rank β€” see the unchanged */repo-auto-merge-disabled/mod=err+approve rows in lane-reason-modifier.json. That contradicts #17565's "never 080" in spirit, but it is generic err handling untouched by this PR and the opinion is weak (rank 1), so any owned opinion outranks it. Worth a follow-up once the lane half (#17566) produces these observations.

Evidence bundle `#175682b33dc9` sha256:c1413c0a31b34ba166324929eead121e5c8c2167506227336ee4b13f2cac5c3e β€” download from the dashboard or `hivectl review evidence #17568`.

@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#17506 🌱 Top up v6 with v5 (durable hosted hive.yaml, shared-CI deferral naming and 118 more) same files src/pkg/stageengine/derive_pr_classify.go
src/pkg/stageengine/testdata/stage_goldens/lane-reason-authorkind.json
src/pkg/stageengine/testdata/stage_goldens/lane-reason-modifier.json
src/pkg/stageengine/testdata/stage_goldens/lane-reason-verdict.json

@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 10, 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 classifier and goldens against the v6 tree; this looks correct to me.

  • stageHandoffReasons has a single consumer (derive_pr_classify.go:390), so dropping repo-auto-merge-disabled from it only lets control reach the new branch β€” nothing else keyed on the map.
  • The new branch's precedence (needs-rebase β†’ HumanChangeRequestStage β†’ VerdictBlocks β†’ RequiresHumanStage β†’ decision-requested β†’ SharedCIDeferredStage β†’ BaseBranchRedStage β†’ ForkGuardStage β†’ RedCheck β†’ sentinel/hold β†’ 050/090) is the same order the generic path uses at derive_pr_classify.go:536-595, and the structure matches the sibling autoMergeReasonHumanMergeRequired branch directly above it.
  • The test's "recorded reason falls back to the lane reason when the verdict's is empty" assumption is what production does: derive_pr.go:241-244 sets obs.Reason = verdict.Reason only when non-empty, so the approve+green 090 row records repo-auto-merge-disabled and prstage.HumanMergeReason (prstage/reasons.go:246) maps it to auto-merge-off.

One note on the body, not a defect: "a trusted human's approval of a requires_human head β†’ 090 recorded under the lane reason" is half right. The golden row */repo-auto-merge-disabled/verdict=requires_human-human-approved records reviewer-verdict:requires_human:human-approved@clubanderson, because WithHumanApprovalReason (derive_pr_classify.go:238) fills Reason with the approval reason; HumanMergeReason of that string is not auto-merge-off. That is identical to how the autoMergeReasonHumanMergeRequired branch behaves, so I would leave the code alone β€” just flagging that the 090 "auto-merge off" rule only reads back for the plain-approve path.

No findings. CI test shards are green on this head, so the hand-edited goldens match the engine's output.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Review follow-ups (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line are listed here instead of as issues, one comment per PR, updated in place. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

  • P3 low correctness β€” err+approve observation under repo-auto-merge-disabled still yields 080 at role rank (src/pkg/stageengine/derive_pr_classify.go:362): The o.Err branch (derive_pr_classify.go:362-381) runs before the new reason block, so an errored observation with an approve verdict returns AwaitingMergeAdmission (080, rank role), as the unchanged …

@hivecommons-hive
hivecommons-hive Bot merged commit 6246fc6 into v6 Nov 10, 2026
85 of 92 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-17565 branch November 10, 2026 17:46
@github-actions

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 10, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] [v6] Stage engine: classify repo-auto-merge-disabled from head evidence instead of treating it as a hand-off

0 participants