Skip to content

🐛 Owner Approve on a parked PR releases the park; 085 chevron hover names its own stage - #14956

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
fix/owner-approve-clears-park
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
fix/owner-approve-clears-park

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #14954

What

The owner's Decide… → Approve on a PR parked at stage/085 now releases the park instead of only posting the /lgtm + /approve comments (which no auto-merge lane reads):

  • RecordOperatorPullRequestApprovalWith (pkg/github/pr_decision_operator.go) records the approval against the PR head in the HumanChangeRequests store — the same record /hive decision approve writes, honoured by withRecordedDecision / recordedHumanApprovalForHead in both lanes and by the stage engine (PRDecided) — lifts needs-human, removes the sentinel label, writes a head-keyed sentinel_acknowledged human action into the review evidence bundle (RecordReviewEvidenceSentinelAck), re-derives the stage (applyPRDecisionStage) and reports what it released. The bare RecordOperatorPullRequestApproval keeps the comments-only behaviour for the delegated Let hive decide path (recommends, never clears a sentinel alert).
  • Dashboard handler (api_repo_item_decision.go) passes the store, LiftNeedsHuman and sentinel.label, drops the tracker cache and adds released / stage to the response and audit detail.
  • Stage tracker (stageTrackerSentinel) reads the acknowledgment: a bundle-only alert (crux#30: findings, no label) now clears, reason suffixed — acknowledged by @login; a label still on remains the live block.
  • SPA: a detoured lit chevron (085 riding the 080 column) names its own stage in the hover rather than borrowing "Awaiting merge admission … Next move: human".

Tests

  • TestRecordOperatorPullRequestApprovalWithReleasesThePark / …WithoutOptionsStaysCommentsOnly (store record, labels, bundle ack, stage fact, idempotence, delegated path pinned)
  • TestRecordReviewEvidenceSentinelAck
  • TestRepoItemDecisionApprovePRReleasesThePark (handler → response, store, labels, cache invalidation, audit)
  • TestStageTrackerSentinelLabelClearsBlockingBundle new ack cases
  • TestStageTrackerRows chevron-hover assertions (fail without the index.html change)

No new time.Sleep. go build ./..., go vet, go test ./pkg/github/ ./pkg/dashboard/ ./pkg/evidence/ ./pkg/review/ green.

Docs

docs/dashboard-sections.md (Decide… Approve semantics, Sentinel alert paragraph, chevron hover), docs/api-reference.md (decision endpoint), changelog.d/fixed-owner-approve-clears-park.md.

Not in this PR

The delegated "supersede now" free-text decision being parsed as changes_requested on contributor PRs and adoption not running (#14816 item 1) — described in #14954.

… names its stage

The dashboard Decide… → Approve on a PR parked at stage/085 only posted the
/lgtm + /approve command comments, which no auto-merge lane reads: the
contributor and self lanes release a requires_human / decision-requested
verdict only through a trusted merger's GitHub Approve review on the head or a
recorded bare approval in the HumanChangeRequests store, needs-human is a
prefilter skip in every tier, and a sentinel alert promoted from the evidence
bundle had no clearing path at all. #14821, #14822 and
crux#30 stayed at 085 after the owner approved them.

RecordOperatorPullRequestApprovalWith now records the approval against the
head, lifts needs-human, removes the sentinel label, writes a head-keyed
sentinel_acknowledged action into the review evidence bundle (the stage
tracker reads it as the human review the alert asked for), submits the approve
decision to the stage engine and drops the tracker cache; the response lists
what was released. The delegated Let-hive-decide path keeps the comments-only
behaviour. The activity monitor's detour chevron (085 on the Merge gate column)
names its own stage in the hover instead of borrowing 080's words and actor.

Fixes #14954

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 28, 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 nicholasjackson 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 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). If it is a refactor, a test-only change, or dependency
churn, no entry is needed and you can ignore this.

This is a reminder, not a gate; it never blocks a merge.

@github-actions

github-actions Bot commented Oct 28, 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
#14821 🐛 fix: preserve supersession decisions across stage reconciliation same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#14524 ✨ feat(hub,agent): Hub-coordinated live CLI session pool for multi-tenant runner capacity same files src/docs/api-reference.md
#14957 🐛 Activity Monitor: name the PR a blocked issue waits on; keep hive's own unblock live same files src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_ui_test.go
src/pkg/dashboard/static/index.html
#14965 🐛 fix(dashboard): name the blocking PR on tracker rows and keep webhook unblocks from being overwritten same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#14807 ✨ dashboard: stream Job pod logs in the terminal pane for sandbox.runtime: job agents same files src/docs/api-reference.md
src/pkg/dashboard/static/index.html
#14953 ✨ hub+spoke: expose scheduled-upgrade progress, drain countdown and upgrade history same files src/docs/api-reference.md

@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 28, 2026
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@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 28, 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:

  • changelog-fragment-guard

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 28, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 0e655a8 into v5 Oct 28, 2026
81 of 84 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/owner-approve-clears-park branch October 28, 2026 14:28
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#14956414e22d` sha256:34d17f6ab175b9d2187f2be792dee1e74b0774656c3b50ab37d740158ed0a7c9 — download from the dashboard or `hivectl review evidence #14956`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 414e22d.

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

Main path looks correct to me; one low-severity ordering gap worth a follow-up, no blockers.

Verified at head 414e22d (go build ./pkg/github/ ./pkg/dashboard/ ./pkg/evidence/ clean):

  • pr_decision_operator.go RecordOperatorPullRequestApprovalWith: records Kind: review.HumanChangeRequestKindApprove, which is the same kind the comment path produces for a bare /hive decision approve (pr_unpark_decision.go:130-132), so withRecordedDecision and applyPRDecisionStage see an identical answer whichever door the owner used. The zero-value PullRequestApprovalOptions keeps RecordOperatorPullRequestApproval byte-for-byte on its old behaviour.
  • Label lifts are gated on labelPresent(labels, …) from the same PullRequests.Get, so no blind RemoveLabel 404s; failures there are logged on the event, not returned, as the doc comment says.
  • review_evidence.go RecordReviewEvidenceSentinelAck: bundle is per head, so an acknowledgment never carries to a new push; idempotent via SentinelAcknowledgedBy(). stage_tracker.go:701 only clears the bundle-promoted alert and keeps the label as the live block, matching the comment.
  • Authorisation is unchanged: canToggleRepoHold (api_repo_item_decision.go:149) — verified owner or a signed-in user with write.

Finding (low) — src/pkg/github/pr_decision_operator.go:265-267: opts.HumanChangeRequests.Record(req) failing is the one post-comment step that returns an error. By then both /lgtm and /approve are already on the PR. The dashboard handler takes the case err != nil branch (api_repo_item_decision.go:303-304) and returns 502 before the s.audit.LogRecord line, so: commands on GitHub, no audit row, the user sees a failure and a retry posts both commands again. Consequence is bounded (the store write is local and rarely fails), but the doc comment above the function promises "the record stands" semantics for everything after the comments, and this step is the exception. Suggest logging it onto the event like the label writes (or recording before posting the commands, since the record is what the lanes read).

I have not approved or merged anything.

— 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

Choose a reason for hiding this comment

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

Reviewed (correctness) — no blockers; one advisory.

released can claim sentinel-acknowledged when nothing was written (low). RecordReviewEvidenceSentinelAck returns true unconditionally after calling upsertReviewEvidence (src/pkg/github/review_evidence.go:535-536), but that upsert swallows every failure — existing bundle failing signature verification (review_evidence.go:276-281), Validate/Seal errors, or writeReviewEvidence EACCES (review_evidence.go:364-375) — all return without writing. pr_decision_operator.go:288 then reports SentinelAcknowledged=true, the handler emits released: [..., "sentinel-acknowledged"] and audits it, while stageTrackerSentinel keeps alert=true because SentinelAcknowledgedBy() is still empty. On a bundle-only alert (the crux#30 case) the owner would be told the park was released and watch the row stay at 085. Cheap fix: confirm by re-reading rather than assuming:

	c.upsertReviewEvidence(full, number, head, u, settings.Policy, key, func() *gh.PullRequest { return nil }, now.UTC())
	b, err = LoadReviewEvidence(ReviewEvidencePath("", full, number, head))
	return err == nil && b != nil && b.SentinelAcknowledgedBy() != ""

Everything else checks out: Record dedupes on (Source, SourceID) per head (human_change_request.go:191-197) so a repeat Approve is idempotent and supersedes an earlier dashboard direction on the same head; recordedHumanApprovalForHead needs only IsApproval() + actor (automerge_review_gate.go:369-379), so contributor PRs are covered; the supersession sweep re-parks only when its comment is new (pr_supersession_resolve.go:371-384), so the lifted needs-human is not re-applied on the next pass.

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

@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 Oct 28, 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.

Security perspective (read at head 414e22d).

Trust-boundary regression: the dashboard approval now releases requires_human on any PR with only GitHub write, bypassing the merger-role gate every other release path enforces.

  • src/pkg/github/pr_decision_operator.go:262-277 records a HumanChangeRequestKindApprove for the head on every PR (selfAuthored is read but never gates the record) and the only authorisation is the caller's canToggleRepoHold (src/pkg/dashboard/api_repo_hold.go:57-108): verified owner role, or Repositories.GetPermissionLevel ∈ {write, maintain, admin}.
  • The lanes honour that record without any trust check: recordedHumanApprovalForHead (src/pkg/github/automerge/automerge_review_gate.go:371-382) takes whatever actor is in the store and releases requires_human. That was safe only because the sole writer, tryUnparkPullRequest, requires opts.TrustedMerger(actor) (src/pkg/github/pr_unpark_decision.go:49, :227) and selfAuthored (:268-270), per its own invariant: "plus the automerge lane's merger trust, so a text decision is never weaker than the review it stands in for" (:31-33).
  • By contrast a GitHub APPROVED review from the same write-collaborator is ignored unless isTrustedMerger says yes (automerge_review_gate.go:338-339, ACMM merger role via trustedMergerFunc, src/cmd/hive/merge_eligibility.go:30).

Net effect: a write collaborator who is not an ACMM merger can POST decision=approve on a contributor PR and (a) release the swarm's requires_human verdict into the auto-merge path, (b) lift needs-human, (c) strip the sentinel-alert label and ack the bundle (pr_decision_operator.go:279-295) — including on workflow-path changes (#14822's case). Neither their review nor their /hive decision approve comment can do any of that today. #14954 describes the owner's approval; the diff grants it to a broader set.

Proposed fix: thread the merger authorizer into the options and record/clear only when it passes; otherwise keep the pre-existing comments-only behaviour (and say so in Released).

--- a/src/pkg/github/pr_decision_operator.go
+++ b/src/pkg/github/pr_decision_operator.go
@@ type PullRequestApprovalOptions struct {
 	HumanChangeRequests review.HumanChangeRequestStore
+	// TrustedMerger gates the record and the park/sentinel release — the
+	// same bar tryUnparkPullRequest applies to `/hive decision approve`
+	// (pr_unpark_decision.go), so a dashboard click is never weaker than
+	// the review it stands in for. nil fails closed: commands only.
+	TrustedMerger func(login string) bool
@@ func (c *Client) RecordOperatorPullRequestApprovalWith(
-	if opts.HumanChangeRequests != nil && head != "" {
+	trusted := opts.TrustedMerger != nil && opts.TrustedMerger(actor)
+	if !trusted {
+		if c.logger != nil {
+			c.logger.Info("dashboard approval: actor is not a trusted merger; commands only", "repo", full, "pr", number, "actor", actor)
+		}
+		return event, nil
+	}
+	if opts.HumanChangeRequests != nil && head != "" {

and in api_repo_item_decision.go:278 pass TrustedMerger: s.deps.TrustedMerger (wire trustedMergerFunc(cfg) from cmd/hive into dashboard Deps, the same function the automerge engine gets). Add a test asserting a write-but-not-merger actor gets Recorded=false and no label removals.

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

@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 Go hunks against v5 pr_unpark_decision.go, human_change_request.go, review_evidence_merge.go and webhook_tracker_refresh.go. The mechanism is sound and matches the existing /hive decision approve comment lane; two things worth knowing before merge.

Verified correct

  • RecordOperatorPullRequestApprovalWith writes the same HumanChangeRequest shape the comment lane writes (pr_unpark_decision.go:73-83), with SourceID: operatorDecisionMarkerID (0). HumanChangeRequests.Record (human_change_request.go:191-197) drops records for other heads and replaces a same-head record only when Source+SourceID match, so a dashboard Approve supersedes an earlier dashboard Approve on the same head and coexists with a /hive decision <text> comment record; For returns the newest, so Approve after a direction wins. That is the behaviour the body describes.
  • applyPRDecisionStage (pr_unpark_decision.go:323) is called with the selfAuthored flag from the same PR fetch, so the stage engine sees the right SelfAuthored; the needs-human/sentinel label removals are guarded by labelPresent(labels, …) from that same fetch, so no spurious DELETE on a label that is not there.
  • RecordReviewEvidenceSentinelAck returns false on no bundle / no sentinel findings and true when an ack already stands, so SentinelAcknowledged in released is accurate; stageTrackerSentinel keeps alert=true while the label is still on and only drops the bundle-promoted alert — consistent with the sweep's live block.
  • invalidateStageTrackerForWebhook exists (webhook_tracker_refresh.go:293) and is the right cache to drop so the next tracker read re-derives the stage.

Two notes (low)

  1. Scope widening vs the comment lane. The comment lane only records a decision when the PR is hive-authored (pr_unpark_decision.go:71 and :269 both gate on selfAuthored). The dashboard path now records for any author — the body says this is deliberate ("for every lane, whoever authored the PR"; the motivating #14821/#14822 are fork PRs). Just flagging that the two entry points now differ, so a maintainer reading one does not assume the other.
  2. Error ordering. In RecordOperatorPullRequestApprovalWith, opts.HumanChangeRequests.Record failing returns event, err after both /lgtm and /approve comments are already posted. handlePullRequestDecision then takes its error path, so the operator sees a failed decision for an approval that is live on GitHub, and released/stage are not computed or audited. A persistence failure is rare, but the comment-lane handles the same ordering by recording before replying (pr_unpark_decision.go:87-89). Suggestion only: either record before posting the commands, or treat the record failure like the label/stage failures (warn + report on the event) so the audit line still lands.

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

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

Dashboard Approve on a parked PR does not release the park (needs-human, requires_human verdict, sentinel) and the 085 chevron hover borrows 080's text

1 participant