Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-observe-only-ok-to-test-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- On a repo whose auto-merge is off, the contributor lane's observe-only pass no longer tries to post `/ok-to-test` on a non-member fork PR. Its mutation boundary refuses every write by design, and each pass runs on a fresh engine, so the attempt was refused and logged at WARN on every re-evaluation of the head, about every three minutes.
10 changes: 10 additions & 0 deletions src/pkg/github/automerge/automerge_contributor_prow_oktotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,20 @@ var prowTrustedAssociations = map[string]bool{
// remembered per repository (automerge_prow_refusal_memory.go), so a later
// fork PR there gets the needs-human note without the command being posted. The caller
// must already have admitted the PR to the contributor lane.
//
// An observe-only pass (a repo whose auto-merge is off) and the read-only
// eligibility probe post nothing here. Their mutation boundary refuses the
// comment by design, and each pass runs on a fresh engine whose per-head
// mark is empty, so the attempt was refused and logged at WARN on every
// re-evaluation of the head (projectbluefin/server#690, about every three
// minutes), as the workflow-fence audit comment once was (#17668).
func (c *Engine) requestProwPresubmitsForFork(ctx context.Context, displayRepo, owner, repo string, pr *gh.PullRequest, number int, headSHA string) {
if c == nil || c.gh == nil || pr == nil || strings.TrimSpace(headSHA) == "" || !c.isForkPR(pr) {
return
}
if c.observeOnly || integrationEligibilityProbe(ctx) {
return
}
if prowTrustedAssociations[strings.ToUpper(strings.TrimSpace(pr.GetAuthorAssociation()))] {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,32 @@ func TestContributorLaneProwRejectionAlreadyNotedLogsBelowWarn(t *testing.T) {
t.Fatalf("WARN lines = %d in %q, want 1 (only the run that left the note)", got, logs.String())
}
}

// An observe-only pass (a repo whose auto-merge is off) posts no /ok-to-test
// and logs nothing at WARN: its mutation boundary refuses the comment by
// design, and each pass runs on a fresh engine, so the refused attempt was
// logged on every re-evaluation of the head (projectbluefin/server#690). The
// live sweep on the same fixture posts once (TestContributorLanePostsProwOkToTestForNonMemberFork).
func TestContributorLaneObserveOnlyPassDoesNotPostProwOkToTest(t *testing.T) {
fx := prowOkToTestFixture()
api := newContributorLaneAPI(t, &fx)
defer api.Close()
policy := defaultContributorLanePolicy()
clock := &contributorLaneClock{at: time.Date(2026, 11, 18, 10, 0, 0, 0, time.UTC)}
engine := newContributorLaneEngine(api.URL, policy, clock, Options{ContributorSoak: soakedTracker(clock)})
var logs bytes.Buffer
for pass := 0; pass < 3; pass++ {
oc := engine.observeOnlyEngine()
oc.logger = slog.New(slog.NewTextHandler(&logs, &slog.HandlerOptions{Level: slog.LevelWarn}))
if _, _, err := oc.trySweepContributorLanePR(context.Background(), "widget", "acme", "widget", 7, policy); err != nil {
t.Fatalf("pass %d err = %v", pass, err)
}
clock.advance(workflowApprovalRecheck + time.Minute)
}
if fx.comments != 0 {
t.Fatalf("comments = %d %q, want none from an observe-only pass", fx.comments, fx.allComments)
}
if strings.Contains(logs.String(), "failed to post ok-to-test") {
t.Fatalf("observe-only pass logged the refused /ok-to-test at WARN: %s", logs.String())
}
}
Loading