Skip to content

🐛 Remember per repo that Prow refuses the App's /ok-to-test - #18876

Merged
kubestellar-prow[bot] merged 1 commit into
v5from
feat/18608-prow-refusal-repo-memory
Nov 18, 2026
Merged

kubestellar-prow[bot] merged 1 commit into
v5from
feat/18608-prow-refusal-repo-memory

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Remaining scope of #18608 after #18748 and #18838 (decision: fold nothing further; nudge/adopt ladder is #18872).

  • Fork lane (requestProwPresubmitsForFork) now consults a repo-level memory that Prow refuses the App. When known, it skips the first /ok-to-test and posts the existing hive-ok-to-test-rejected needs-human guidance directly (once per PR).
  • Memory is keyed by owner/repo, set on any observed Prow refusal, and re-derived after a restart from one bounded repo-wide comment read (30 day window, max 3 pages), cached for okToTestWorkflowCheckTTL.
  • Clears while hive-ok-to-test.yml is installed. Unknown repos and non-Prow repos behave as before.
  • The direct note omits Prow's refusal wording so it cannot renew the memory forever.
  • Docs and changelog.d fragment updated. Contributor-nudge, adopted and reporter-trust-wait comments untouched.

Refs #18608

🤖 Generated with Claude Code

Refs #18608

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

gremlins found 7 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.

File Line Mutation
src/pkg/github/automerge/automerge_prow_refusal_memory.go 72 CONDITIONALS_BOUNDARY
src/pkg/github/automerge/automerge_prow_refusal_memory.go 93 ARITHMETIC_BASE
src/pkg/github/automerge/automerge_prow_refusal_memory.go 93 INVERT_NEGATIVES
src/pkg/github/automerge/automerge_prow_refusal_memory.go 100 CONDITIONALS_BOUNDARY
src/pkg/github/automerge/automerge_prow_refusal_memory.go 100 INCREMENT_DECREMENT
src/pkg/github/automerge/automerge_prow_refusal_memory.go 122 CONDITIONALS_NEGATION
src/pkg/github/automerge/automerge_prow_refusal_memory.go 122 CONDITIONALS_NEGATION

2 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/pkg/github/automerge/automerge_prow_refusal_memory.go 31 ARITHMETIC_BASE
src/pkg/github/automerge/automerge_prow_refusal_memory.go 31 ARITHMETIC_BASE

Verdict: lived (#17349).

@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 review — one in-scope finding (trust boundary).

The repo-wide refusal memory trusts comment text from any author. deriveProwRefusal (automerge_prow_refusal_memory.go:118) returns true for any non-App comment that contains Cannot trigger testing until a trusted user and mentions @<app>. It never checks who wrote the comment. When AppBotLogin() is empty, any comment with the phrase is enough. Anyone who can comment on any issue or PR in a public repo can post that text. The result is that Hive stops posting /ok-to-test on every fork PR in the repo for up to 30 days (the lookback window), and each PR gets the needs-human note instead. The note stops the lane on its own, and the memory renews itself. This is a repo-wide denial of the lane, where the same check in automerge_held_runs.go:378 only affected one PR. It does not grant privilege.

Suggested fix: count only comments from Prow's bot. Require the author to be a Bot account, and ideally match a configured Prow login. Drop the empty-login fallback.

			if appLogin != "" && comment.GetUser().GetType() == "Bot" && strings.Contains(strings.ToLower(body), "@"+strings.ToLower(appLogin)) {

Add a test where a non-bot user posts the refusal text mentioning the App and the memory stays false.

The other changes look fine. Failed lookups fail open, the quota is bounded, the note omits Prow's wording so it can't renew the memory, and the workflow-installed check clears the memory.

— hive: agent=adjudicator-2 backend=claude model=claude-sonnet-5-5 claude=2.1.326

}
continue
}
if appLogin == "" || strings.Contains(strings.ToLower(body), "@"+strings.ToLower(appLogin)) {

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.

Any commenter can forge this. No author check, so a non-bot comment with the refusal phrase and @app flips the whole repo to skip /ok-to-test for 30 days. If AppBotLogin is empty, any comment with the phrase matches. Require a Bot author (ideally Prow's configured login) and drop the empty-login fallback.

Suggested change
if appLogin == "" || strings.Contains(strings.ToLower(body), "@"+strings.ToLower(appLogin)) {
if appLogin != "" && comment.GetUser().GetType() == "Bot" && strings.Contains(strings.ToLower(body), "@"+strings.ToLower(appLogin)) {

@hivecommons-hive

hivecommons-hive Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Review findings from adjudicator (folded here because this head already carries its hive review):

Correctness review at 25c8091: no in-scope blocker. The skip/note/restart/clear paths read correctly and the tests cover them.

Advisory only (low):

  • automerge_prow_refusal_memory.go:92: the 3-page x 100 bound means the "30 day" re-derivation is really the newest ~300 comments on a busy repo; a missed refusal just reverts to the old post-once behaviour. Consider rewording the docs.
  • automerge_prow_refusal_memory.go:115: an empty App login or a login-prefix collision can count someone else's refusal (same as the existing per-PR check); harmless consequence.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Why:

  • the review swarm requested changes

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.

@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 18, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 merged commit b7028dc into v5 Nov 18, 2026
104 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/18608-prow-refusal-repo-memory branch November 18, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant