Skip to content

🐛 fix: preserve owner intent through PR decision paths (adopted) - #15233

Merged
clubanderson merged 4 commits into
v5from
adopt/14822-decision-path
Oct 29, 2026
Merged

clubanderson merged 4 commits into
v5from
adopt/14822-decision-path

Conversation

@clubanderson

@clubanderson clubanderson commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #14816
Supersedes #14822

Adopted from @thatguywob's #14822 — original commits preserved with authorship (63634feda, 637dc265e — content unchanged; adopter Signed-off-by added alongside the author's so the squash-attribution gate passes, as hive's adopt flow does), rebased onto current v5 and finished per the operator's adopt-supersede decision.

What the fix does (unchanged from #14822)

  • /hive decision approve <rationale> on a hive-authored PR is an approval, not a change request; the rationale is kept in the durable decision record. The sweep reads /hive decision at stage/070-fixing as well as stage/085-needs-decision.
  • A later trusted APPROVED review on the same head supersedes a standing changes-kind request, so a metadata-only fix needs no cosmetic commit. latestTrustedHumanApproval now uses each reviewer's latest opinion across all review pages (an approval later superseded by the same reviewer's CHANGES_REQUESTED no longer counts).
  • EnsureIssueStagePRLink never upgrades Refs→Fixes on a PR carrying a recorded human decision (hive:decision-head marker in body or hive comment), and leaves an edited Refs body alone.
  • Contributor lane: a trusted head-scoped CHANGES_REQUESTED is read before the admission / requires_human early returns, so the PR yields to 072 and the author nudge.

Dropped from #14822

Review points addressed (commit d095cb13c)

  • @hanthor P2 — reconcile persisted review-backed approvals after dismissal: new reconcileReviewBackedApproval drops an approval-kind record whose Source == review when the reviewer's latest trusted opinion on the head is no longer that APPROVED review (dismissed / changes requested again). Runs in humanChangesRequestedForHead and in trustedHumanApprovalForRequiresHuman after the live lookup fails, so neither recordedHumanApprovalForHead nor stage folding keeps treating requires_human as answered, and the earlier instruction reaches the fixer again. Comment/dashboard decisions are durable and never revalidated. Adds HumanChangeRequestStore.Forget. Covered by TestReviewBackedApprovalRevokedOnDismissal (approve → dismissed, approve → changes requested, unchanged head) and TestCommentApprovalSurvivesReviewDismissal.
  • reviewer / reviewer-2 — yes as a prefix swallows conditional answers: yes approves only when bare; yes, but rename the flag stays changes_requested.
  • reviewer — trailing comma defeats the rule: trim set is now .:,;!, so approve, the body change is applied and lgtm; ship it approve.
  • Changelog fragment moved to repo-root changelog.d/ (the guard rejects src/changelog.d/); maintainer-commands.md updated for the above.

Validation: gofmt -l clean on changed files; go build ./...; go test ./pkg/review ./pkg/github ./pkg/github/automerge.

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

github-actions Bot commented Oct 29, 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
#15216 🐛 Sentinel: a dashboard Approve releases the head for good; skip Prow-rejected /lgtm + /approve CONFLICT src/pkg/github/automerge/automerge_contributor_lane_test.go
#15226 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files src/pkg/github/automerge/automerge_contributor_lane.go
src/pkg/github/automerge/automerge_contributor_lane_test.go
#15104 🐛 Activity Monitor: Rebase, then merge as maintainer; fixer owns parked conflicting PRs; dismiss self-inflicted changes_requested same files src/pkg/github/issue_unpark_command.go
src/pkg/github/pr_unpark_decision.go
src/pkg/github/pr_unpark_decision_test.go
src/pkg/review/human_change_request.go
#15186 🐛 Activity Monitor: one coherent post-decision state for Let hive decide rows; 060 reviewed in CI / Review same files src/pkg/github/issue_unpark_command.go

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply.

1 similar comment
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply.

@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves 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 Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • Sign-off survives the squash

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@clubanderson
clubanderson force-pushed the adopt/14822-decision-path branch from 6623c40 to 528b448 Compare October 29, 2026 01:55
@hivecommons-hive hivecommons-hive Bot added stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • Sign-off survives the squash

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

thatguywob and others added 4 commits October 28, 2026 22:01
Recognize approval rationale, preserve intentional non-closing issue links, release metadata-only fixes on same-head approval, and route trusted contributor change requests before requires_human admission returns.

Hive-Run: #14816
Hive-Plan: issue-14816/decision-path
Hive-Spec: issue-14816#1-4
Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <clubanderson@users.noreply.github.com>
Include the automated author kind when checking contributor stage routing, and keep the ignored-stage regression outside both supported decision stages (070 and 085).

Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <clubanderson@users.noreply.github.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
… as instructions

Address review on #14822:
- A same-head APPROVED review persisted as an approval-kind decision is
  dropped again when that review is dismissed or the reviewer's latest
  opinion on the head is no longer APPROVED, so a revoked approval cannot
  keep answering requires_human or shadow the earlier instruction.
  Comment/dashboard decisions stay durable. Adds HumanChangeRequestStore.Forget.
- `yes` approves only when bare; `yes, but …` stays an instruction.
- Trailing punctuation after the approval word (approve, / lgtm;) no longer
  defeats the first-word rule.
- Changelog fragment lives at repo-root changelog.d/.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the adopt/14822-decision-path branch from 528b448 to 3715f54 Compare October 29, 2026 02:01
@hivecommons-hive hivecommons-hive Bot removed the stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added the stage/050-review-pending Review swarm requested; awaiting a verdict for the current head label Oct 29, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read the full diff against v5 (b127931) plus the callers in automerge_contributor_lane.go, automerge_review_gate.go, pr_issue_link.go and the un-park sweep. go build ./... is clean on the head (3715f54); go test is disabled on this host, so CI is the test verdict. The change does what it says and I found no defect — two low-severity notes a maintainer may want to weigh, neither blocking.

Verified

  • /hive decision approve <rationale> → Approval() (src/pkg/github/issue_unpark_command.go:110-120): first word approve|approved|lgtm with .:,;! trimmed approves; yes only when bare. Sweep now also reads PRs at stage/070-fixing (:326).
  • latestTrustedHumanApproval (automerge_review_gate.go:314-321) now goes through latestTrustedHumanReview, which keeps each reviewer's latest opinion across all pages before filtering (automerge_human_changes_requested.go:36-76), so an APPROVED later superseded by the same reviewer's CHANGES_REQUESTED no longer counts. noteStageReviews is still called once with the full page set (:60), same as before.
  • Contributor lane: the head-scoped trusted CHANGES_REQUESTED check sits before the claim.Reason/requires_human early returns (automerge_contributor_lane.go:1272-1276), so it yields to 072 as the body claims.
  • EnsureIssueStagePRLink skips the Refs→Fixes upgrade when hive:decision-head appears in the body or in a hive comment (pr_issue_link.go:317-328), and rewriteRefsIssueLinkToClosing refuses on the marker too (:368).
  • HumanChangeRequests.Forget (src/pkg/review/human_change_request.go:232-254) is the only store implementation — no test fakes implement the interface, so the new method is safe to add.
  • Body ↔ diff: every bullet in the description maps to a hunk; the dropped v2-ci.yml timeout commit is indeed absent from the file set.

Low — reconcileReviewBackedApproval keys on "is the latest approval", not "does this review still stand" (automerge_human_changes_requested.go:160-163). With two trusted approvers A then B on the same head, the record persisted for A's review has SourceID != live.GetID() (B is newer), so A's still-valid approval is Forget-ted on the next sweep. Behaviourally harmless today — the live lookup in trustedHumanApprovalForRequiresHuman runs first (automerge_review_gate.go:328), and the standing path in humanChangesRequestedForHead re-records B when an older instruction surfaces (:103-115) — but the store ends without an approval record for a head that has two live ones, and only live API reads cover it. If you want the record to survive, compare against the set of APPROVED reviews on head (latest[login] state check) rather than the single newest one.

Low — pr.LastEditedAt == "" guard disables the Refs→Fixes repair after any body edit, including the hive's own (pr_issue_link.go:333). pr_supersession_resolve.go:322 edits hive-authored bodies, so a superseding PR whose body carries Refs #N will keep it and fall to partial-reference. This is the conservative direction and the stage comment still links the issue, so it is a judgment call rather than a bug — but it is broader than the "edited Refs body" wording in the description suggests.

Looks correct to me; the two notes above are optional follow-ups, not blockers. CI on this head currently shows cancelled/queued runs from the rebase, so the test gate is still pending.

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

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 29, 2026
@clubanderson
clubanderson merged commit 601beea into v5 Oct 29, 2026
78 of 83 checks passed
@hivecommons-hive hivecommons-hive Bot added the stage/095-pre-merge-soak Lane admitted; the pre-merge soak window is running before the merge is attempted label Oct 29, 2026
@kubestellar-prow
kubestellar-prow Bot deleted the adopt/14822-decision-path branch October 29, 2026 02:25
@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

@hanthor hanthor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the full adopted diff at 3715f54aa609e758a2a5b6a113316df6b7327970, including the durable store, review-gate consumers and stage folding. My P2 on superseded #14822 is addressed: reconcileReviewBackedApproval removes the review-sourced approval when the live approval no longer stands, reveals the preceding instruction, and is called before the recorded-approval fallback in trustedHumanApprovalForRequiresHuman. Explicit comment/dashboard decisions are not revoked by review reconciliation.

The added regression is meaningful rather than just checking the helper: TestReviewBackedApprovalRevokedOnDismissal first persists a same-head approval, then changes its live state to DISMISSED / CHANGES_REQUESTED and asserts that requires_human is no longer approved, the lane is held, the planner receives the correct instruction, and the approval-kind record is gone. TestCommentApprovalSurvivesReviewDismissal protects the durable /hive decision approve distinction. The remaining tests cover same-head metadata release, approval ordering/trust/head exclusions, approval text, and edited Refs preservation.

Existing exact-head CI evidence (no local build/test/lint run by me): v2 Tests test and coverage passed, v2 CI build-and-test and overlayfs-exec-guard passed, security/lint passed, and DCO plus squash attribution passed. The arm64 image build was still in progress when inspected; this review does not substitute for its result or any required check. No workflow timeout change is carried into this adoption.

Approval is for this code/head only. Keep branch protection, Prow/owner approval, soak, CI, security and any runtime/sentinel holds intact; do not treat this as authorization to bypass them.

@kubestellar-prow kubestellar-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 29, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 24dcf0b05601838d0e7007a4248533c18ea78934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/human A person pushed this PR themselves conflicts-with-open-pr Open PR has a merge conflict with another open PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. stage/095-pre-merge-soak Lane admitted; the pre-merge soak window is running before the merge is attempted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 decision path: approve-with-rationale reads as changes_requested, Refs→Fixes rewrite overrides owner decision, 070 deadlock without a new head

3 participants