Repository navigation
π dashboard: surface Prow's rejection of relayed /lgtm and /approve - #17478
Conversation
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
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: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Read the diff against the v5 tree and the callers; this looks correct to me.
Body matches the diff (read the body after the code). Docs paragraph in Review findings from Read the diff against What I verified
Two non-blocking notes (info)
No conflict with #17479: it touches the same file but only exports |
There was a problem hiding this comment.
Looks correct to me; the operator docs describe only the second-Approve path and should pick up the first-Approve one this adds.
Verified against the tree (v5 merge-base):
awaitProwRejection(src/pkg/github/pr_decision_operator.go:121) reusesprowRejectedHiveCommands, which already requires the Prow reply to quote one of the hive's own command comments by#issuecomment-<id>and come from aDefaultLabelDrivenTrustedBotslogin (pr_decision_operator.go:146-192). So the new read cannot be satisfied by an unrelated or spoofed comment β the #15263 guard carries over unchanged.event.ProwManagedis set fromprowManagedLabels(labels)at construction (pr_decision_operator.go:422), beforereportOperatorPullRequestApprovalruns, so thewaitflag is meaningful when it is consulted at line 509.- The poll is bounded by
prowReplyWindowand byctx, and it runs inside the existing 15sdefaultApprovalReportingTimeoutcontext, so the worst case on a Prow repo is ~4-6s added to the Approve request, not an unbounded hang. (Polls fire at t=0, 2, 4s; the last iteration stops oncenow+intervalwould pass the 6s deadline, so the effective window is 4s β fine, just noting it is a bit shorter than the variable name suggests.) - Dashboard wording:
repoItemApproveResult(src/pkg/dashboard/api_repo_item_decision.go:899-944) now routesProwRejectedthrough the same "recorded in hive" headline and OWNERS-reviewerNextasProw/CommandsSkipped, and thePostedbranch distinguishes "posted, but Prow rejected" from "not posted". The new test asserts exactly that.
Docs (low): src/docs/dashboard-sections/activity-monitor.md:491 explains the skip path (commands_skipped: prow-rejects-bot-commands, toast not posted) but says nothing about the first Approve: the new prow_rejected response field and the posted, but Prow rejected them wording. A sentence next to that paragraph would keep the operator doc in step with the response shape.
Not a defect, just a note: the v5..head diff also shows CHANGELOG.md losing 12 lines and four other fragments reappearing β that is the branch being behind v5's changelog compile, not a change in this PR (gh pr diff shows 6 files). A rebase before merge clears it.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Review follow-ups for #17478: - activity-monitor.md now describes the first-Approve path: the commands are posted, Prow's rejection is awaited, and the response carries `prow_rejected: true` with the "posted, but Prow rejected them" toast, before the later `commands_skipped` path. - awaitProwRejection sleeps min(interval, remaining) so the last read lands at the end of prowReplyWindow instead of stopping one interval short (polls at 0/2/4/6s rather than 0/2/4s). Hive-Fix-Attempt: 1/6 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read the diff against src/pkg/github/pr_decision_operator.go and src/pkg/dashboard/api_repo_item_decision.go. Looks correct to me.
What I verified:
- Ordering is right: the pre-existing
prowRejectedHiveCommandsread atpr_decision_operator.go:496still decides the skip path before posting;awaitProwRejection(:514) runs only on the post branch and re-lists comments, so theownset it matches against includes the two comments just posted. The match still requires Prow's#issuecomment-<id>)back-reference and aDefaultLabelDrivenTrustedBotsauthor (:163-195), so the #15263 guard against a third-party bot faking the phrase is intact. - The β€6 s poll fits inside the existing 15 s
defaultApprovalReportingTimeout(:470); on cancellationawaitProwRejectionreturns false andreturn ctx.Err()surfaces it asReportingErrorwith the native approval still recorded β same contract as before. - Toast wording is server-side: the frontend does not read
commands_skipped/prow_rejected(onlyapi_repo_item_decision.goreferences them), andrepoItemApproveResultnow branches onProwRejectedfor headline,Posted, and the OWNERS note (:902,:919,:941). TheCommandsSkippedbranch is checked first, so the two never both print. activity-monitor.md:491updated to describe the first-Approve behaviour; changelog fragment present.
One optional note, not a defect: with event.ProwManaged == false the call at :514 still does a single extra listIssueComments round-trip on every non-Prow Approve, immediately after the one at :496. It is harmless (and a safety net if Prow detection misses), just worth knowing it is there.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read pr_decision_operator.go around the new awaitProwRejection and the existing prowRejectedHiveCommands (pr_decision_operator.go:151-199), plus repoItemApproveResult. The mechanism is sound: the pre-post check at :496 already returns CommandsSkipped whenever a bound Prow rejection exists, so any rejection awaitProwRejection finds after posting is necessarily a reply to the comments just posted (the detector only counts a Prow-bot reply quoting #issuecomment-<id> of a hive command comment). The wait is bounded by the request ctx and prowReplyWindow, and ReportingError handling is unchanged. The wording change in the dashboard is tested. Looks correct to me.
Two notes, non-blocking:
- Scope vs #17475. The issue asks to "persist the rejection so later approvals on the same repo take the
CommandsSkippedpath". What ships persists per PR (Prow's reply comment on that PR); the first Approve on every new PR in the repo still posts both commands and draws a fresh rejection. That is a reasonable place to stop, but withCloses #17475the body should say the repo-level memory was not done (or the issue should stay open for it). awaitProwRejection(β¦, wait=false)(pr_decision_operator.go:514) still does onelistIssueCommentsimmediately after the post on non-Prow PRs. Prow answers via webhook a second or more later, so that read can essentially never observe a reply and is an extra API call on every non-Prow approval. Skipping it when!event.ProwManagedwould be cheaper with no loss.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the diff against src/pkg/github/pr_decision_operator.go and src/pkg/dashboard/api_repo_item_decision.go at 04d63da. Looks correct to me.
What I verified:
reportOperatorPullRequestApproval(pr_decision_operator.go:496-514) still does the pre-postprowRejectedHiveCommandsread, so the second Approve takes the existingprow-rejects-bot-commandsskip path exactly as before; the newawaitProwRejectiononly runs in the branch that actually posted the commands.prowRejectedHiveCommands(:151-199) only counts a reply fromconfig.DefaultLabelDrivenTrustedBotsthat quotes a hive command comment by#issuecomment-<id>, so a rejection detected inside the window is bound to the comments just posted β the test'sreplyAfterPostfixture mirrors that (issue_unpark_command_test.go:212-216).awaitProwRejectionreturns onctx.Done()andreportOperatorPullRequestApprovalalready foldsctx.Err()intoReportingError, so a cancelled request leaves the native approval recorded, as today.- Dashboard wiring:
ProwRejectedflows event βrepoItemApproveFactsβrepoItemApproveResult(api_repo_item_decision.go:899-942); theCommandsSkipped/ProwRejectedelse ifordering means a second Approve keeps the "not posted" wording rather than claiming a fresh rejection.
One observation, not a defect: on a Prow repo where the hive bot is an approver, Prow's positive reply does not match prowCommandRejections, so every Approve now spends the full prowReplyWindow (6 s) before the toast appears β the happy path pays the latency, not just the misconfigured one. If that matters, matching Prow's acknowledgement (approved label applied / LGTM added) as an early exit would bound it. The queue-merge decision (api_repo_item_decision.go:621) goes through the same call and inherits the wait too, though it never surfaces prow_rejected.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the diff against v5 plus the callers; this looks correct to me.
src/pkg/github/pr_decision_operator.go:514βawaitProwRejectionruns only on the post path (theprowRejectedpre-check at :497 still routes toCommandsSkipped), andevent.ProwManagedis set at construction (:427,prowManagedLabels(labels)), so the polling branch is reachable when intended and the single-read branch covers non-Prow PRs.- Budget:
prowReplyWindow(6s) sits insidedefaultApprovalReportingTimeout(15s, :471). If the earlier label/stage calls ever eat more than ~9s the wait ends onctx.Done()and the trailingreturn ctx.Err()at :516 surfaces asReportingErrorβ that is the pre-existing contract, just noting the window now consumes part of it. src/pkg/dashboard/api_repo_item_decision.go:899-944β the threeProwRejectedbranches (headline,Posted,Next) are consistent with theCommandsSkippedwording, andTestRepoItemApproveResultSurfacesProwRejectionpins them.- The
replyAfterPosthook inissue_unpark_command_test.go:212makes the comment listing reflect the post, so the "prow rejects" / "prow silent" cases exercise the real poll loop rather than a stub.
Docs (activity-monitor.md) and the changelog fragment match the behaviour. Nothing blocking from me.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the diff against v5 plus the callers; this looks correct to me.
What I verified
src/pkg/github/pr_decision_operator.go:514βawaitProwRejectionruns only on the post path, after both commands were created, and reusesprowRejectedHiveCommands(:151), which already requires the reply to be from aDefaultLabelDrivenTrustedBotslogin and to quote a hive command comment id, so the new flag cannot be set by an arbitrary commenter.- The wait is bounded:
prowReplyWindow(6s) sits insidedefaultApprovalReportingTimeout(15s,:470), and the loop selects onctx.Done(), so a cancelled request still returnsctx.Err()as before. src/pkg/dashboard/api_repo_item_decision.go:899-944βProwRejectedchanges the headline, thePostedline and theNextnote;CommandsSkippedkeeps precedence in thePostedbranch, which matches the two states being mutually exclusive in the client (:496-514).- The fake server change in
issue_unpark_command_test.go:212lets the reply appear only after the POST, so the "prow silent" case genuinely exercises the full window rather than a pre-seeded comment. - No overlap with #17479's edit to the same file (that PR only exports
prowManagedLabelsat:481); the hunks are far apart.
One observation, not a defect
- On a Prow-managed PR where Prow accepts the commands (or answers late), the dashboard Approve request now blocks for the full 6s before returning, since
awaitProwRejectiononly exits early on a rejection. That is within the existing timeout and probably acceptable for a human-initiated action; noting it so the latency is not a surprise.
Body and diff agree (prow_rejected, polling only when ProwManaged, changelog + activity-monitor doc updated).
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #17475
Part of #17451 (children #17474 and #17476 remain)
Why
dibs#510 skips relaying
/lgtm+/approveonly once Prow's rejection is already on the PR. On the first Approve nothing read Prow's reply, so the toast still said approved while Prow answered 'restricted to collaborators' / 'NOT APPROVED' (#17359).What
reportOperatorPullRequestApprovalreads the PR comments for Prow's reply (polling ~6s on Prow-managed PRs, one read otherwise) and setsPullRequestApprovalEvent.ProwRejected.prow_rejected) says Prow rejected the commands and an OWNERS reviewer is needed, instead of 'Approved'.prow-rejects-bot-commandsskip path.β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@clubanderson