From 176b85fd31c64017a46d6dd550c1811ca79734bc Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2026 07:50:15 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20skip=20ok-to-test=20p?= =?UTF-8?q?ost=20on=20observe-only=20automerge=20pass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The read-only eligibility probe reached the ok-to-test post, where the mutation guard refused each tick and the caller logged a WARN, tripping unclassified_error_repeated. Skip before the first-seen mark so the live sweep still posts. Closes #17673 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- ...fixed-automerge-ok-to-test-observe-only.md | 1 + .../github/automerge/automerge_held_runs.go | 5 ++++ .../automerge/automerge_held_runs_test.go | 27 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 changelog.d/fixed-automerge-ok-to-test-observe-only.md diff --git a/changelog.d/fixed-automerge-ok-to-test-observe-only.md b/changelog.d/fixed-automerge-ok-to-test-observe-only.md new file mode 100644 index 0000000000..ed4178f457 --- /dev/null +++ b/changelog.d/fixed-automerge-ok-to-test-observe-only.md @@ -0,0 +1 @@ +- Fixed the automerge workflow-approval path posting `/ok-to-test` from the read-only integration eligibility probe: the mutation guard refused the comment every tick, logging a repeated WARN that tripped the `unclassified_error_repeated` self-report, and the first-seen mark could swallow the real post. The probe now skips the post and leaves it to the live sweep; behaviour with auto-merge on is unchanged. (#17673) diff --git a/src/pkg/github/automerge/automerge_held_runs.go b/src/pkg/github/automerge/automerge_held_runs.go index 0a27335a11..4c4b9d50b8 100644 --- a/src/pkg/github/automerge/automerge_held_runs.go +++ b/src/pkg/github/automerge/automerge_held_runs.go @@ -210,6 +210,11 @@ func (c *Engine) workflowApprovalAttention(ctx context.Context, displayRepo, own if c.workflowApprovalUntrustedKnown(owner, repo, number) { return workflowApprovalUntrustedPrefix + contextName } + if integrationEligibilityProbe(ctx) { + // The read-only eligibility probe cannot comment; skipping before the + // first-seen mark leaves the post to the real sweep tick (#17673). + return workflowApprovalRequiredPrefix + contextName + } firstSeen, first := c.markWorkflowApprovalCommandSeen(owner, repo, number, headSHA) state, scanned := c.workflowApprovalCommentState(ctx, displayRepo, owner, repo, number, headSHA, first) if scanned && (state.rejected || state.prowManaged) && !c.okToTestWorkflowInstalled(ctx, displayRepo, owner, repo) { diff --git a/src/pkg/github/automerge/automerge_held_runs_test.go b/src/pkg/github/automerge/automerge_held_runs_test.go index 85df75faf3..2cf239b1ff 100644 --- a/src/pkg/github/automerge/automerge_held_runs_test.go +++ b/src/pkg/github/automerge/automerge_held_runs_test.go @@ -717,3 +717,30 @@ func TestWorkflowApprovalUntrustedReasonParksAtNeedsDecision(t *testing.T) { t.Fatalf("decisionCause(%q) = %q, want Prow, the command and the workflow path named", reason, cause) } } + +func TestWorkflowApprovalAttentionSkipsCommandInReadOnlyEligibilityProbe(t *testing.T) { + var comments []string + pr := missingRequiredPR(func(p *selfAuthoredPR) { + p.workflowRuns = []map[string]any{heldRun(1, "acme/widget")} + p.commentBodies = &comments + }) + var merged []int + api := newSelfAuthoredAutoMergeAPI(t, []selfAuthoredPR{pr}, &merged) + defer api.Close() + c := newAutoMergeSweepClient(api.URL) + + probeCtx := context.WithValue(context.Background(), integrationEligibilityContextKey{}, &integrationEligibilityCapture{}) + want := workflowApprovalRequiredPrefix + "ci/build" + if got := c.workflowApprovalAttention(probeCtx, "widget", "acme", "widget", 23, "sha23", "ci/build", 1); got != want { + t.Fatalf("probe reason = %q, want %q", got, want) + } + if len(comments) != 0 { + t.Fatalf("probe posted comments %q, want none", comments) + } + if got := c.workflowApprovalAttention(context.Background(), "widget", "acme", "widget", 23, "sha23", "ci/build", 1); got != want { + t.Fatalf("live reason = %q, want %q", got, want) + } + if len(comments) != 1 || comments[0] != workflowApprovalCommandBody("sha23") { + t.Fatalf("live comments = %q, want one command after the probe", comments) + } +} From 4a371eab04cf1449b6a7ffb161d3b2d52e07e720 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2026 08:03:22 -0500 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20fix:=20scope=20eligibility-p?= =?UTF-8?q?robe=20hardening,=20drop=20#17673=20attribution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review on #17674 found the WARN in #17673 ("observe-only pass on a repo whose auto-merge is off cannot mutate issue_comment") comes from the v6-only observeOnlyBoundary, not from the v5 eligibility probe, and that the probe runs on an isolated engine so its first-seen mark never swallowed the live post. Reword the changelog fragment and code comment as eligibility-probe hardening and remove the #17673 reference; the #17673 fix belongs on v6. Hive-Fix-Attempt: 1/6 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-automerge-ok-to-test-eligibility-probe.md | 1 + changelog.d/fixed-automerge-ok-to-test-observe-only.md | 1 - src/pkg/github/automerge/automerge_held_runs.go | 5 +++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/fixed-automerge-ok-to-test-eligibility-probe.md delete mode 100644 changelog.d/fixed-automerge-ok-to-test-observe-only.md diff --git a/changelog.d/fixed-automerge-ok-to-test-eligibility-probe.md b/changelog.d/fixed-automerge-ok-to-test-eligibility-probe.md new file mode 100644 index 0000000000..7c8c60dd09 --- /dev/null +++ b/changelog.d/fixed-automerge-ok-to-test-eligibility-probe.md @@ -0,0 +1 @@ +- Hardened the automerge workflow-approval path against the read-only integration eligibility probe: the probe could reach the `/ok-to-test` post, where the mutation boundary refused the comment and the caller logged a WARN on every tick. The probe now skips the post and leaves it to the live sweep; live behaviour is unchanged. diff --git a/changelog.d/fixed-automerge-ok-to-test-observe-only.md b/changelog.d/fixed-automerge-ok-to-test-observe-only.md deleted file mode 100644 index ed4178f457..0000000000 --- a/changelog.d/fixed-automerge-ok-to-test-observe-only.md +++ /dev/null @@ -1 +0,0 @@ -- Fixed the automerge workflow-approval path posting `/ok-to-test` from the read-only integration eligibility probe: the mutation guard refused the comment every tick, logging a repeated WARN that tripped the `unclassified_error_repeated` self-report, and the first-seen mark could swallow the real post. The probe now skips the post and leaves it to the live sweep; behaviour with auto-merge on is unchanged. (#17673) diff --git a/src/pkg/github/automerge/automerge_held_runs.go b/src/pkg/github/automerge/automerge_held_runs.go index 4c4b9d50b8..3f871225f5 100644 --- a/src/pkg/github/automerge/automerge_held_runs.go +++ b/src/pkg/github/automerge/automerge_held_runs.go @@ -211,8 +211,9 @@ func (c *Engine) workflowApprovalAttention(ctx context.Context, displayRepo, own return workflowApprovalUntrustedPrefix + contextName } if integrationEligibilityProbe(ctx) { - // The read-only eligibility probe cannot comment; skipping before the - // first-seen mark leaves the post to the real sweep tick (#17673). + // The read-only eligibility probe cannot comment: its mutation + // boundary would refuse the post and WARN every tick. Skipping + // leaves the post to the live sweep. return workflowApprovalRequiredPrefix + contextName } firstSeen, first := c.markWorkflowApprovalCommandSeen(owner, repo, number, headSHA)