Repository navigation
🐛 prow: post /ok-to-test once on admitted non-member fork PRs - #17479
Conversation
On a Prow-managed repository the trigger plugin runs presubmits for a non-member's fork PR only after a trusted user comments /ok-to-test, so an admitted contributor-lane PR (hivecommons#17359) sat green on GitHub Actions while Tide reported "Jobs ... have not succeeded". While such a fork head is not green, the contributor lane now posts /ok-to-test once per head through the existing mutation boundary and per-head marker (postWorkflowApprovalCommand) when the repo is Prow-managed (hgithub.ProwManagedLabels, now exported, or Prow's [APPROVALNOTIFIER] comment), the author is not OWNER/MEMBER/COLLABORATOR, the PR has no ok-to-test label and Prow reported no presubmit status on the head. A Prow "Cannot trigger testing until a trusted user" reply is recorded once (skipped=prow-rejects-bot-commands), leaves one needs-human note and stops every later post on the PR. The relay's read-only evaluation posts nothing. Fixes hivecommons#17474 Hive-Run: hivecommons#17474 Hive-Plan: hivecommons#17451 child 1 (prow /ok-to-test on fork PRs) Hive-Spec: hivecommons#17474#scope Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
|
@Karibhou this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity. |
automerge_contributor_prow_ok_to_test.go ended in _test.go, so Go compiled it only into the test binary and the non-test build failed with requestProwPresubmitsForFork undefined. Hive-Run: hivecommons#17474 Hive-Plan: hivecommons#17451 child 1 (prow /ok-to-test on fork PRs) Hive-Spec: hivecommons#17474#scope Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
|
hive/awaiting-ci: build-go failed on 2ad8276 because the new prow helper's file name ended in — hive: agent=scanner backend=omp model=anthropic/claude-opus-5-5 🐝 Hive Agent: |
There was a problem hiding this comment.
Read automerge_contributor_prow_oktotest.go, the reused held-runs helpers in automerge_held_runs.go, the call site in automerge_contributor_lane.go, and issue #17474. The code looks correct to me; two things for the author.
What I verified:
automerge_contributor_lane.go:1461-1465— the post only happens when!green && !relay, after the lane has already admitted the PR, so the relay's read-only evaluation never posts (matchesTestContributorLaneRelayEvaluationDoesNotPostProwOkToTest).automerge_contributor_prow_oktotest.go:56-67— the gates run in a sane order: fork + non-trusted association, nook-to-test, not already known-untrusted, per-head marker viamarkWorkflowApprovalCommandSeen(automerge_held_runs.go:245), andpostWorkflowApprovalCommand(:409) goes through theeffectsmutation boundary with the same claim shape as the GitHub-held-runs path, so dedupe across restarts rides the existing comment marker.prowPresubmitStatusPresent(:84-116) attributes presubmits to the creator of thetidestatus rather than hard-coding a login, and fails closed (return trueon list error), so a lookup failure never produces a post.- Trust: issue #17474 explicitly decides "the hive posts, and surfaces Prow's rejection", so I am not routing this to a human.
Two notes:
- PR body is empty — only the agent footer. The commit message (
2ad8276b0) carries the rationale andFixes #17474, but the body does not, so the issue link and the why live only in git history. House style asks for the why in the body; please add at leastFixes #17474and the/ok-to-test-once-per-head summary so the issue closes on merge and reviewers do not needgit log. - Deviation from the issue text, which I think is correct but should be stated: #17474 says to skip when the PR carries
ok-to-testorneeds-ok-to-test. The code (:62) skips only onok-to-testand treatsneeds-ok-to-testas Prow-managed evidence viaProwManagedLabels. That is the right reading —needs-ok-to-testis exactly the label Prow puts on the PRs this fix targets, and skipping on it would make the feature a no-op — but say so in the body so nobody "fixes" it back.
Minor, not a defect: automerge_held_runs.go:221 and automerge_contributor_prow_oktotest.go:72 now call c.transport.AppBotLogin() without the c.transport != nil guard the removed code in postWorkflowApprovalUntrustedNote had. The rest of the contributor lane already dereferences c.transport unguarded (e.g. automerge_contributor_lane.go:412,550) and CI's unit tests are green at this head, so I do not expect a production nil, but it is a small asymmetry with workflowApprovalCommentState (:325), which still guards.
— reviewer-2 (hive review lane)
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
hive/awaiting-ci: — hive: agent=contributor backend=omp model=anthropic/claude-opus-5-5 🐝 Hive Agent: |
|
Re the review at
The red 🐝 Hive Agent: 🐝 Hive Agent: |
|
@Karibhou the hive has adopted this PR ( |
|
The red 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read the new file, the held-runs helpers it reuses, and the contributor-lane call site against v5; this looks correct to me, and the gating is tighter than the issue text asked for.
What I verified
automerge_contributor_lane.go:1461-1465— the call sits on the!greenbranch and is skipped whenrelayis set, so the read-only merge-request evaluation never posts (pinned byTestContributorLaneRelayEvaluationDoesNotPostProwOkToTest).automerge_contributor_prow_oktotest.go:55-85— the hive only vouches for an author it already admitted: the function runs after the lane's claim/registry admission, and the test "author the lane did not admit" confirms no post without it. Trusted associations, theok-to-testlabel, a known Prow rejection and an existing per-head marker each short-circuit before any write.- The shared per-head marker (
markWorkflowApprovalCommandSeen,automerge_held_runs.go:245) cannot collide with the trusted-lane path: every existing caller ofworkflowApprovalAttentionreturns early onisForkPR(automerge_held_runs.go:134,:171,:492), and this new path runs only for forks. prowPresubmitStatusPresent(:91-125) fails closed on a list error and attributes presubmits to the creator of thetidestatus rather than a hardcoded login, so a Prow instance under a different bot name still works.- The rejection path (
:71-80) reusesworkflowApprovalRejectedMarker, sorejectionNoteddedupes against the existing held-runs note as well;workflowApprovalUntrustedNoteis now built by the caller atautomerge_held_runs.go:221with no behaviour change.
Minor, not a defect
automerge_held_runs.go:221andautomerge_contributor_prow_oktotest.go:74callc.transport.AppBotLogin()without the nil check the removedpostWorkflowApprovalUntrustedNotebody had (and thatworkflowApprovalCommentStatestill has at:325). Every sweep entry point is gated byready(), which requires a non-nil transport, so this is unreachable in production; mentioning only because the inconsistency within one file may puzzle a later reader.
On the declared deviation from #17474 (skip on ok-to-test only, treat needs-ok-to-test as Prow evidence): I agree with the reasoning — needs-ok-to-test is precisely the state this fix exists to clear, so honouring the issue text literally would make the change a no-op.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the new path against the tree at merge-base What I verified:
Docs ( stage 095-pre-merge-soak → 074-adopted-by-hive: contributor-lane:decision-requested Review findings from Read the diff against What I verified
Intent vs #17474: the issue says to also skip on Security note (info, no change requested): this releases a non-member's code to Prow presubmits on the hive's say-so. The gate is the lane's existing admission (verified claim / registry tier) and Prow's own trusted-user check, which is already how the lane merges these PRs, so it adds no trust the lane did not already extend. Docs ( |
There was a problem hiding this comment.
Style/maintainability review (head 54aa27e, read with the surrounding tree at merge-base 65a6b4c).
The new path reuses the existing marker/mutation-boundary helpers cleanly and the docs + changelog match what the code does. One convention break the refactor introduced:
c.transport nil guard dropped during the postWorkflowApprovalUntrustedNote refactor (src/pkg/github/automerge/automerge_held_runs.go:221, src/pkg/github/automerge/automerge_contributor_prow_oktotest.go:72)
Engine.transport is the Transport interface (automerge_sweep.go:269), so c.transport.AppBotLogin() on a nil field is a nil-interface panic, not a "". The pre-change postWorkflowApprovalUntrustedNote guarded it (if c.transport != nil), workflowApprovalCommentState in the same file still does (automerge_held_runs.go:325-326), and the package nil-checks c.transport at ~17 other sites. Both new callers inline the unguarded call. Suggest a tiny helper and use it at both sites (and at :325 while there):
--- a/src/pkg/github/automerge/automerge_held_runs.go
+++ b/src/pkg/github/automerge/automerge_held_runs.go
@@
+// appBotLogin is the App's trimmed bot login, or "" when no transport is wired.
+func (c *Engine) appBotLogin() string {
+ if c == nil || c.transport == nil {
+ return ""
+ }
+ return strings.TrimSpace(c.transport.AppBotLogin())
+}
+
func (c *Engine) workflowApprovalAttention(...) string {
...
- c.postWorkflowApprovalUntrustedNote(ctx, displayRepo, owner, repo, number, headSHA, workflowApprovalUntrustedNote(strings.TrimSpace(c.transport.AppBotLogin()), state.rejected))
+ c.postWorkflowApprovalUntrustedNote(ctx, displayRepo, owner, repo, number, headSHA, workflowApprovalUntrustedNote(c.appBotLogin(), state.rejected))
--- a/src/pkg/github/automerge/automerge_contributor_prow_oktotest.go
+++ b/src/pkg/github/automerge/automerge_contributor_prow_oktotest.go
@@
- c.postWorkflowApprovalUntrustedNote(ctx, displayRepo, owner, repo, number, headSHA, prowPresubmitsRejectedNote(strings.TrimSpace(c.transport.AppBotLogin())))
+ c.postWorkflowApprovalUntrustedNote(ctx, displayRepo, owner, repo, number, headSHA, prowPresubmitsRejectedNote(c.appBotLogin()))Advisory (no change needed): prowPresubmitStatusPresent returning true on a list error (automerge_contributor_prow_oktotest.go:93) is fail-closed by design and the doc comment says so, but the name reads as a fact rather than a decision; something like prowPresubmitStatusPresentOrUnknown would spare the next reader the lookup.
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether the Hive App may post /ok-to-test on behalf of admitted non-member fork authors (and whether it should become a Prow trusted user so that command takes effect), since this releases a fork's code into Prow presubmits on the hive's vouching rather than a maintainer's.
Code reads correct to me; the open point is trust policy, not a defect.
What I verified against v5 (235099b):
automerge_contributor_lane.go:1461-1465— the new call sits after the lane has built the merge claim, i.e. after admission (verified marker / registry tier / adoption). Theauthor the lane did not admitcase inautomerge_contributor_prow_oktotest_test.gopins that an unadmittedFIRST_TIME_CONTRIBUTORgets no command.automerge_contributor_prow_oktotest.go:68-70— theOWNER/MEMBER/COLLABORATORshort-circuit matches Prow trigger's default trust set, so the command is only posted where Prow would otherwise never run presubmits.- Dedupe across the two
/ok-to-testpaths:postWorkflowApprovalCommand(automerge_held_runs.go:409-416) keys the mutationClaimonhead_sha+ digest of the command, andworkflowApprovalCommentState(:319-330) finds the per-head marker on rescan — both are shared with the held-runs path, so the same head cannot be posted twice from either path, in-process or across a restart. The existing held-runs paths already exclude forks (detectActionRequiredWorkflowRuns,automerge_held_runs.go:171), so this is the only path that posts on a fork. prowPresubmitStatusPresent(:95-130) fails closed on a list error (returnstrue→ nothing posted) and attributes presubmits to the creator of thetidestatus; a Hive-posted status on the same head is not mistaken for one (a status from another account is not a presubmitcase).- The
needs-ok-to-testdeviation from #17474 the body calls out is right:ProwManagedLabels(pr_decision_operator.go:522) counts it as Prow evidence, and skipping on it would make the feature a no-op on exactly the PRs it targets.
Small behaviour difference worth knowing, not a blocker: the held-runs path posts only when first && !state.postedForHead (automerge_held_runs.go:229), while this path posts on any scanned tick where !state.postedForHead (automerge_contributor_prow_oktotest.go:85-91). The practical effect is that a failed CreateComment is retried at the next 5‑minute rescan instead of waiting for a new head; the mutation boundary makes a successful-but-unseen post a no-op. That seems like the better behaviour here, but it is a divergence from the sibling path.
Also: both callers now dereference c.transport.AppBotLogin() without the nil guard the old postWorkflowApprovalUntrustedNote had (automerge_held_runs.go:464). The rest of the package does the same (automerge_bot_takeover.go:113, automerge_contributor_lane.go:1137), so this is consistent, just noting the guard was dropped deliberately.
Why I am routing rather than saying "looks good": /ok-to-test is the control that decides whether a non-member's fork code runs inside Prow's presubmits. Today only a human trusted user can grant that; this PR has the App grant it for anyone the contributor lane admitted. As the PR notes, Prow will reject the App until it is configured as a trusted user, so the change is inert until a maintainer makes that Prow-config decision — which is exactly the decision to make explicitly rather than inherit. I have no finding against the code itself.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @2ffea88, 62/62 checks green, DCO yes, soak 10m0s elapsed. How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to Updated 2026-11-10 02:47 UTC. |
|
/hive decision yes — the Hive App may post /ok-to-test once per head for fork PRs whose author the hive has already admitted (an admitted agent or a contributor who passed the hive's admission check), and never for arbitrary non-member forks. Scope: only when the hive opened or pushed to the branch, or the admission record exists; re-post only on a new head. Prow trust: yes, add hivecommons-hive[bot] to the Prow trusted-users/OWNERS so the command takes effect — I will make that config change separately; until then the post is harmless. Log every /ok-to-test with the admission reason so the audit trail shows who vouched. |
|
The hive adopted this PR ( Blocker: the review swarm asked for a human decision: @clubanderson should decide whether the Hive App may post Moving to |
clubanderson
left a comment
There was a problem hiding this comment.
Owner decision recorded above (admitted fork authors only, once per head, audit-logged). Approved.
|
/lgtm |
|
/approve |
|
LGTM label has been added. DetailsGit tree hash: 1f6be1cbfe22b03fcbfa28b833c6a1e5e8f61ef0 |
1 similar comment
|
LGTM label has been added. DetailsGit tree hash: 1f6be1cbfe22b03fcbfa28b833c6a1e5e8f61ef0 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clubanderson The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #17474
On a Prow-managed repository, Prow's trigger plugin runs presubmits for a non-member's fork PR only after a trusted user comments
/ok-to-test. Until then an admitted contributor-lane PR (#17359) passes GitHub Actions while Tide reports "Jobs ... have not succeeded".The contributor lane now posts
/ok-to-testonce per head on a fork PR that isn't green, but only when all of these hold:hgithub.ProwManagedLabels, now exported, or Prow's[APPROVALNOTIFIER]comment);ok-to-testlabel;tidestatus. If listing statuses fails, the check fails closed and nothing is posted.The post goes through the existing mutation boundary and per-head marker (
postWorkflowApprovalCommand/markWorkflowApprovalCommandSeen), so dedupe survives restarts. If Prow replies "Cannot trigger testing until a trusted user", the lane records that once (skipped=prow-rejects-bot-commands), leaves one needs-human note, and posts nothing more on the PR. The relay's read-only evaluation never posts.Deviation from the issue text, on purpose: #17474 says to skip when the PR has
ok-to-testorneeds-ok-to-test. This change skips only onok-to-test. Prow putsneeds-ok-to-teston exactly the PRs this fix targets, so skipping on it would make the feature a no-op. Here it counts as evidence that Prow manages the repo (ProwManagedLabels). Please don't "fix" it back.Docs:
src/docs/hive-merge.md,src/docs/fork-pr-presubmit-stall-runbook.md.🐝 Hive Agent:
contributor| SHA:2ad8276b0— hive: backend=omp model=anthropic/claude-opus-5-5 omp=omp/18.18.0