Repository navigation
🐛 Owner Approve on a parked PR releases the park; 085 chevron hover names its own stage - #14956
Conversation
… 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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@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. |
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
@clubanderson this PR is held at Failing checks:
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. |
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 414e22d. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
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.goRecordOperatorPullRequestApprovalWith: recordsKind: review.HumanChangeRequestKindApprove, which is the same kind the comment path produces for a bare/hive decision approve(pr_unpark_decision.go:130-132), sowithRecordedDecisionandapplyPRDecisionStagesee an identical answer whichever door the owner used. The zero-valuePullRequestApprovalOptionskeepsRecordOperatorPullRequestApprovalbyte-for-byte on its old behaviour.- Label lifts are gated on
labelPresent(labels, …)from the samePullRequests.Get, so no blindRemoveLabel404s; failures there are logged on the event, not returned, as the doc comment says. review_evidence.goRecordReviewEvidenceSentinelAck: bundle is per head, so an acknowledgment never carries to a new push; idempotent viaSentinelAcknowledgedBy().stage_tracker.go:701only 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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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-277records aHumanChangeRequestKindApprovefor the head on every PR (selfAuthoredis read but never gates the record) and the only authorisation is the caller'scanToggleRepoHold(src/pkg/dashboard/api_repo_hold.go:57-108): verified owner role, orRepositories.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 releasesrequires_human. That was safe only because the sole writer,tryUnparkPullRequest, requiresopts.TrustedMerger(actor)(src/pkg/github/pr_unpark_decision.go:49,:227) andselfAuthored(: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
isTrustedMergersays yes (automerge_review_gate.go:338-339, ACMMmergerrole viatrustedMergerFunc,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
There was a problem hiding this comment.
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
RecordOperatorPullRequestApprovalWithwrites the sameHumanChangeRequestshape the comment lane writes (pr_unpark_decision.go:73-83), withSourceID: operatorDecisionMarkerID(0).HumanChangeRequests.Record(human_change_request.go:191-197) drops records for other heads and replaces a same-head record only whenSource+SourceIDmatch, so a dashboard Approve supersedes an earlier dashboard Approve on the same head and coexists with a/hive decision <text>comment record;Forreturns the newest, so Approve after a direction wins. That is the behaviour the body describes.applyPRDecisionStage(pr_unpark_decision.go:323) is called with theselfAuthoredflag from the same PR fetch, so the stage engine sees the rightSelfAuthored; theneeds-human/sentinel label removals are guarded bylabelPresent(labels, …)from that same fetch, so no spurious DELETE on a label that is not there.RecordReviewEvidenceSentinelAckreturns false on no bundle / no sentinel findings and true when an ack already stands, soSentinelAcknowledgedinreleasedis accurate;stageTrackerSentinelkeepsalert=truewhile the label is still on and only drops the bundle-promoted alert — consistent with the sweep's live block.invalidateStageTrackerForWebhookexists (webhook_tracker_refresh.go:293) and is the right cache to drop so the next tracker read re-derives the stage.
Two notes (low)
- Scope widening vs the comment lane. The comment lane only records a decision when the PR is hive-authored (
pr_unpark_decision.go:71and:269both gate onselfAuthored). 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. - Error ordering. In
RecordOperatorPullRequestApprovalWith,opts.HumanChangeRequests.Recordfailing returnsevent, errafter both/lgtmand/approvecomments are already posted.handlePullRequestDecisionthen takes its error path, so the operator sees a failed decision for an approval that is live on GitHub, andreleased/stageare 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
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+/approvecomments (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 approvewrites, honoured bywithRecordedDecision/recordedHumanApprovalForHeadin both lanes and by the stage engine (PRDecided) — liftsneeds-human, removes the sentinel label, writes a head-keyedsentinel_acknowledgedhuman action into the review evidence bundle (RecordReviewEvidenceSentinelAck), re-derives the stage (applyPRDecisionStage) and reports what it released. The bareRecordOperatorPullRequestApprovalkeeps the comments-only behaviour for the delegated Let hive decide path (recommends, never clears a sentinel alert).api_repo_item_decision.go) passes the store,LiftNeedsHumanandsentinel.label, drops the tracker cache and addsreleased/stageto the response and audit detail.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.Tests
TestRecordOperatorPullRequestApprovalWithReleasesThePark/…WithoutOptionsStaysCommentsOnly(store record, labels, bundle ack, stage fact, idempotence, delegated path pinned)TestRecordReviewEvidenceSentinelAckTestRepoItemDecisionApprovePRReleasesThePark(handler → response, store, labels, cache invalidation, audit)TestStageTrackerSentinelLabelClearsBlockingBundlenew ack casesTestStageTrackerRowschevron-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_requestedon contributor PRs and adoption not running (#14816 item 1) — described in #14954.