Repository navigation
🐛 Sentinel: a dashboard Approve releases the head for good; skip Prow-rejected /lgtm + /approve - #15216
Conversation
|
[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 |
|
@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. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@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. |
|
(24 occurrences, 3/3 runs, every subtest including 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Reviewed (security) — no blocking findings; one advisory.
sentinelReleasedByDashboardApproval(src/pkg/github/sentinel_clearance.go:113-131) gates a sentinel release onmarkerAuthorTrusted, which returns true for any author whenknowsOwnAccounts()is false (src/pkg/github/label_approval.go:436-441 — a PAT hive with no identity and no/user). In that mode a PR author can post/lgtm+ the exact attribution line +<!-- hive:pr-approval head=<sha> by=<owner> -->(format: pr_decision_operator.go:185-191) and release the alert on their own sensitive-path head. This is the same documented fallback the existing sentinel marker path already accepts (sentinel_sweep.go:569-575), so it is not a regression introduced here — but the doc comment at sentinel_clearance.go:111-112 ("Only comments the hive itself wrote count") overstates it. Consider failing closed for this authorization use since it is not a once-only idempotency marker:
if comment == nil || !c.knowsOwnAccounts() || !c.isHiveAccount(comment.GetUser()) {
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@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. |
… skip Prow-rejected commands A dashboard Approve takes the sentinel label off as the hive's own account, so sentinelClearedAfterLatestPush (rightly) did not read the unlabeled event as a human clearance and the sweep re-alerted the head the owner had just approved (dibs#510, 00:32Z approved → 00:33Z re-labelled). The sweep now reads the hive's own hive:pr-approval head=<sha> command comment as the release for exactly that head and rewrites its marker comment as the released alert, as the #13602 path does; a new push re-arms. On a Prow repo where the bot is not an approver, a later Approve records the decision without re-posting /lgtm + /approve and reports commands_skipped. Fixes #15214 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
774986c to
06d8e79
Compare
…to contributor, not Sentinel alert A trusted human's CHANGES_REQUESTED review on the current head of a clanker-authored PR is the human the sentinel/hold/workflow-path parks were waiting for: RouteHuman and ClassifyStage now route it to stage/072-returned-to-contributor (071 for a person's PR, 070 for the hive's) ahead of 085, and the contributor lane reads reviews before it settles on sentinel-blocked. A new head re-arms the park (per head, as in #15216). Dashboard direction decisions are accepted on clanker PRs: the text is recorded as a change request against the head, posted to the contributor's hive, and the PR moves to 072; the 409 stays for a person's PR only. SPA: the 071/072 chevron keeps its routing word with the sentinel finding as a suffix; Give direction names the contributor's hive. Fixes #15255 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
There was a problem hiding this comment.
Security re-review at 06d8e795 (delta since 774986c3 is a rebase plus a test timestamp; the PR's own code is unchanged). No in-scope blocker; two prior advisories still stand:
src/pkg/github/sentinel_clearance.go:123—sentinelReleasedByDashboardApprovalgates onmarkerAuthorTrusted, which (label_approval.go:436-441) falls back to any author whenknowsOwnAccounts()is false. In that degraded config a PR author can post/approve+Posted by @…+<!-- hive:pr-approval head=<own head> … -->and release their own sentinel alert. Same exposure already exists for theSentinelMarkerpath at:197, so not a regression; the forged-author test (sentinel_sweep_test.go,TestSweepSentinelDashboardApprovalNotHonoured) only covers the identity-known case. Fail closed for this new gate:if comment == nil || !c.knowsOwnAccounts() || !c.isHiveAccount(comment.GetUser()) {src/pkg/github/pr_decision_operator.go:104-134—prowRejectedHiveCommandsnow requires a non-hiveBot-typed/[bot]author quoting a hive command id, so humans can't trigger it (testhuman quoting the phrase). Any other installed bot still can; effect is only that/lgtm+/approveare not posted while the approval is still recorded and the toast says so — fail-safe, low.
— hive: agent=adjudicator-2 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. |
There was a problem hiding this comment.
Delta re-review (correctness) — read at head 06d8e79. The PR's own files (pr_decision_operator.go, sentinel_clearance.go, sentinel_sweep.go, api_repo_item_decision.go, the two test files) are byte-identical to the previously reviewed head 774986c; the delta is a rebase onto v5 plus created_at stamps on test fixtures. Both previous correctness findings are still present.
1. Prow-skip path leaves no head-bound approval comment, so the release never fires on the second approval (still present).
src/pkg/github/pr_decision_operator.go:324-329: when prowRejectedHiveCommands is true, nothing is posted. sentinelReleasedByDashboardApproval (src/pkg/github/sentinel_clearance.go:127) only releases on a hive-authored comment whose marker head= equals the current head, and trySentinelPR falls back to it at src/pkg/github/sentinel_sweep.go:451-456. prowRejectedHiveCommands can only be true when the hive already posted commands for an earlier head — so the exact dibs#510 sequence (alert → push → Approve) on its second occurrence on the same PR records commands_skipped and the sweep re-alerts the approved head within one pass. The same gap hits the workflow-path fence: src/pkg/github/automerge/automerge_contributor_workflow_approval.go:146-147 requires a hive /approve comment bound to the head, and dibs#510 touched .github/workflows/ci.yml.
Concrete fix — post one hive-authored, head-bound record comment instead of the commands, and let the parser accept it:
--- a/src/pkg/github/pr_decision_operator.go
+++ b/src/pkg/github/pr_decision_operator.go
@@ const PRApprovalCommandsSkippedProw = "prow-rejects-bot-commands"
+// prApprovalRecordHeading is the first line of the comment posted instead of
+// `/lgtm` + `/approve` when Prow rejects the bot's commands; it keeps the
+// head-bound marker the sentinel and the workflow fence read.
+const prApprovalRecordHeading = "Approval recorded"
@@ func ParsePRApprovalCommandComment(body string) (command, actor, head string, ok bool) {
known := false
for _, want := range PRApprovalCommands {
if command == want {
known = true
}
}
+ if command == prApprovalRecordHeading {
+ known = true
+ }
@@ func (c *Client) RecordOperatorPullRequestApprovalWith(
if prowRejected {
event.CommandsSkipped = PRApprovalCommandsSkippedProw
+ if err := c.CreateIssueComment(ctx, full, number, renderPRApprovalCommandComment(prApprovalRecordHeading, actor, head)); err != nil {
+ return PullRequestApprovalEvent{}, fmt.Errorf("recording approval on %s/%s#%d: %w", owner, name, number, err)
+ }and in automerge_contributor_workflow_approval.go:147 accept command == prApprovalRecordHeading alongside /approve. prowRejectedHiveCommands and sentinelReleasedByDashboardApproval both go through the parser, so they pick the record comment up unchanged.
2. No test covers Approve-with-CommandsSkipped followed by a sweep (still present).
src/pkg/github/sentinel_sweep_test.go:560-700 has TestSweepSentinelDashboardApprovalReleasesHead / ...NotHonoured only; nothing in the file references CommandsSkipped or a Prow reply. A case that seeds a Prow rejection of an earlier-head command, approves the new head, and asserts no re-alert would have caught #1 and should land with the fix.
Security findings from the previous pass (sentinel_clearance.go:123 any-author marker when hive identity unknown; pr_decision_operator.go:112 third-party bot can suppress command posting) are also unchanged by the delta.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The two halves of this PR undo each other on the repo it was written for. The sentinel release memory is keyed on a comment that the Prow-skip half stops writing.
src/pkg/github/sentinel_clearance.go:112-132—sentinelReleasedByDashboardApprovalfinds the release only by locating a hive-authored comment whoseParsePRApprovalCommandCommenthead equals the current head, i.e. the<!-- hive:pr-approval … -->marker thatrenderPRApprovalCommandCommentwrites (pr_decision_operator.go:185). The sweep consults nothing else:SentinelAckdoes not appear insentinel_sweep.goorsentinel_clearance.go, soRecordReviewEvidenceSentinelAck(pr_decision_operator.go:375) is not a fallback.src/pkg/github/pr_decision_operator.go:320-330— whenprowRejectedHiveCommandsis true,RecordOperatorPullRequestApprovalWithsetsCommandsSkippedand posts no command comment, so no marker bound to the new head ever exists.
Mechanism, on dibs: the first Approve posted /lgtm + /approve and Prow replied "NOT APPROVED" quoting them (the dibs#510 state). Every later Approve on that PR — or on any later head — now hits the skip branch (prowRejectedHiveCommands only looks for a rejection of a hive command on the PR, not one for this head), writes nothing, and the sentinel sweep at sentinel_sweep.go:450-456 gets releasedBy == "", falls through, and re-posts the alert and re-applies the label as it did at 00:33Z. The incident this PR fixes recurs from the second approval onward on exactly the Prow repo where it was observed. Severity: high — the owner's approval is silently undone again. sentinel_sweep_test.go only covers the case where the command comment exists; pr_decision_operator_test.go:100-114 only asserts CommandsSkipped and Recorded, never the sentinel interaction.
Two ways out, either is small: (a) when skipping the commands, still post one hive-authored note carrying the hive:pr-approval marker for the head (no /lgtm//approve text, so Prow has nothing to reject) — the sweep then finds it; or (b) have sentinelReleasedByDashboardApproval also accept the review-evidence sentinel ack for head. A test with CommandsSkipped set followed by a sweep on the same head would fail today and pin the fix.
Minor, not blocking: prowRejectedHiveCommands is PR-wide, not head-bound, so a rejection on an old head suppresses the commands forever on that PR even if OWNERS later changes; probably acceptable but worth a comment.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@clubanderson this PR is held at Why:
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. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
…to contributor, not Sentinel alert A trusted human's CHANGES_REQUESTED review on the current head of a clanker-authored PR is the human the sentinel/hold/workflow-path parks were waiting for: RouteHuman and ClassifyStage now route it to stage/072-returned-to-contributor (071 for a person's PR, 070 for the hive's) ahead of 085, and the contributor lane reads reviews before it settles on sentinel-blocked. A new head re-arms the park (per head, as in #15216). Dashboard direction decisions are accepted on clanker PRs: the text is recorded as a change request against the head, posted to the contributor's hive, and the PR moves to 072; the 409 stays for a person's PR only. SPA: the 071/072 chevron keeps its routing word with the sentinel finding as a suffix; Give direction names the contributor's hive. Fixes #15255 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
…to contributor, not Sentinel alert A trusted human's CHANGES_REQUESTED review on the current head of a clanker-authored PR is the human the sentinel/hold/workflow-path parks were waiting for: RouteHuman and ClassifyStage now route it to stage/072-returned-to-contributor (071 for a person's PR, 070 for the hive's) ahead of 085, and the contributor lane reads reviews before it settles on sentinel-blocked. A new head re-arms the park (per head, as in #15216). Dashboard direction decisions are accepted on clanker PRs: the text is recorded as a change request against the head, posted to the contributor's hive, and the PR moves to 072; the 409 stays for a person's PR only. SPA: the 071/072 chevron keeps its routing word with the sentinel finding as a suffix; Give direction names the contributor's hive. Fixes #15255 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
…contributor, not Sentinel alert (#15256) * fix: clanker PRs with a human changes-requested review show Returned to contributor, not Sentinel alert A trusted human's CHANGES_REQUESTED review on the current head of a clanker-authored PR is the human the sentinel/hold/workflow-path parks were waiting for: RouteHuman and ClassifyStage now route it to stage/072-returned-to-contributor (071 for a person's PR, 070 for the hive's) ahead of 085, and the contributor lane reads reviews before it settles on sentinel-blocked. A new head re-arms the park (per head, as in #15216). Dashboard direction decisions are accepted on clanker PRs: the text is recorded as a change request against the head, posted to the contributor's hive, and the PR moves to 072; the 409 stays for a person's PR only. SPA: the 071/072 chevron keeps its routing word with the sentinel finding as a suffix; Give direction names the contributor's hive. Fixes #15255 Signed-off-by: Andrew Anderson <andy@clubanderson.com> * fix: honour a hand-placed stage/071/072 over the sentinel park for the current head The reconciler logged added=[stage/085] removed=[stage/072-returned-to- contributor] on hive#15159 after the owner swapped the labels by hand. A trusted maintainer's return label the hive did not write is now read from the label event once per head, recorded as a stage-label change request against the head, and folded into the pass like a review, so classification keeps 071/072 ahead of the sentinel/hold/workflow-path parks; a new head re-arms the park. A standing change request in the store now also folds into the stage detail when no reviewer verdict was read for the head. Signed-off-by: Andrew Anderson <andy@clubanderson.com> * fix: drop unused openPullRequestHead wrapper Signed-off-by: Andrew Anderson <andy@clubanderson.com> --------- Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Fixes #15214
Live (hivecommons/dibs#510): the owner clicked Approve in the dashboard at 00:32Z; the hive posted
/lgtm+/approve(hive:pr-approval head=30e94a97) and removedsentinel-alertas its own account. At 00:33:56Z the sentinel sweep re-posted the full alert for the same head and re-applied the label; the contributor lane then skipped withcontributor-lane:sentinel-blockedevery cycle and the stage fell back to 085. The owner's approval was undone in two minutes.Root cause: the alert comment was for the earlier head
674bcbb2; head30e94a97had no marker, sotrySentinelPRfell through tosentinelClearedAfterLatestPush, which (correctly, #13602) refuses anunlabeledevent whose actor is a hive account. The dashboard release was persisted only as the label removal and the human-change-request record — nothing the sentinel reads.Fix
sentinelReleasedByDashboardApproval: the sweep reads the hive's ownhive:pr-approval head=<sha>command comment (hive-authored only —markerAuthorTrusted) as the release for exactly that head, thenrecordSentinelClearancerewrites the marker comment as the released alert (newsentinelReleasedNote) so the 🐛 sentinel: cleared sentinel-alert label is re-applied on the next sweep #11686 restart path keeps it quiet. A later push has no approval bound to it and re-arms.sentinel-blockedclears;untrusted-author-roleis the trusted-author lane's normal skip for this author.PullRequestApprovalEvent.CommandsSkipped/ responsecommands_skipped: prow-rejects-bot-commands, logged once per approval, toast reads Approval recorded;/lgtm+/approvenot posted.Tests
TestSweepSentinelDashboardApprovalReleasesHead: no re-apply across two fresh-client passes for the approved head; marker rewritten; push to a new head re-alerts.TestSweepSentinelDashboardApprovalNotHonoured: forged approval by the author, and the hive's approval of an earlier head, both still re-alert.TestRecordOperatorPullRequestApprovalSkipsCommandsProwRejected: lgtm-restricted / NOT APPROVED replies to the hive's comment skip the commands; replies to someone else, a human quoting the phrase, or no prior commands do not; the approval is recorded either way.TestTrySweepContributorLaneOperatorApprovalAdmitsReleasedSentinel: the lane merges the newcomer-tier head on the recorded owner approval once the sentinel label stays off, and still stands down while it is on.Docs:
operator-reference.md(sentinel clearance),dashboard-sections.md(Approve row action). Changelog:changelog.d/fixed-sentinel-release-memory.md.