Skip to content

πŸ› contributor nudge: per-PR CI-failure cooldown and failing-set dedupe - #17331

Merged
clubanderson merged 2 commits into
v5from
fix/ci-failure-nudge-cooldown
Nov 9, 2026
Merged

clubanderson merged 2 commits into
v5from
fix/ci-failure-nudge-cooldown

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #17328

What

On hive's own spoke, CI-failure contributor nudges churned on the same PRs (#17303/#17305/#17308): the lane reason flapped between check-failing: / optional-check-failing: / required-check-failing: on one head, so each flip looked like a new reason class β€” count restart, comment rewrite, relay re-dispatch β€” and each re-failed push repeated it.

This keys CI-failure nudges on the failing-check set and adds a per-PR cooldown:

  • optional-check-failing now folds into the check-failing class (NudgeReasonSlug).
  • The one hive:contributor-nudge comment (🌱 contributor-nudge once per PR+reason; fold origin notes into status; marker ratchetΒ #17073 upsert) gains checks=<digest> attempt=<n> in its marker.
  • Same head, a check joins the set β†’ comment edited (all checks listed), no relay re-dispatch, count and cooldown clock unchanged. Shrunken set on the same head = flap β†’ no write.
  • New head, same set β†’ comment edited with attempt+1 ("The same checks have failed on N heads so far"), relay told, no new nudge counted.
  • New head, different set inside governor.labels.stage.contributor_nudge.ci_failure_cooldown (default 6h) β†’ folded into the comment, class count unchanged; after the cooldown it counts as a fresh nudge.
  • Ledger (nudge_ci_checks/head/at/attempts, nudge_mode) lives in the stage-label store, so a restart does not re-nudge.
  • Settings UI parity: Labels tab field + PUT stage_nudge_ci_failure_cooldown / GET stageNudgeCICooldown.

Tests

  • TestContributorNudgeCIFailureSetCooldown β€” set grows on same head (edit, no relay), subset flap (nothing), same set new head (attempt=2), restart on the same store file, changed set inside cooldown (fold), changed set after cooldown (fresh nudge); never a second comment.
  • TestCINudgeDue, TestStoreMarkNudgedCIFailure, slug fold case, TestHandleGovernorLabels_CIFailureCooldownRoundTrip.

CI-failure nudges are keyed on the failing-check set rather than the lane's
reason prefix. The same set on a new head, or a check joining the set on the
same head, edits the PR's one nudge comment (marker gains checks=<digest>
attempt=<n>; no relay re-dispatch for the same head). A changed set on a new
head within governor.labels.stage.contributor_nudge.ci_failure_cooldown
(default 6h) is folded into the comment instead of counting as a fresh
nudge. The ledger persists in the stage-label store across restarts.

Fixes #17328

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 9, 2026
@clubanderson

Copy link
Copy Markdown
Member Author

/lgtm

@clubanderson

Copy link
Copy Markdown
Member Author

/approve

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@clubanderson: you cannot LGTM your own PR.

Details

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 9, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[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

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

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

Failing checks:

  • test (rest 2/4)

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.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@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.

Read the change against the tree at 2fd05e6 (merge-base with v5), including the callers in automerge_contributor_nudge.go and the store in stagelabels/store.go. The failing-set keying and the same-head fold look correct to me; one low-severity edge worth a look.

Verified

  • rec.NudgeReason is stored as the slug (store.go:1462), so ciNudgeDue's comparison against NudgeReasonCIFailure (automerge_contributor_nudge.go, ciNudgeDue) is valid; MentionCauseClass already strips required- (store.go:1380) and NudgeReasonSlug now folds optional-check-failing, so the three prefixes collapse into one class as the body says.
  • Same head: checks is unioned with rec.NudgeCIChecks before ciNudgeDue, so a shrunken set compares equal and falls through to nudgeRepeatDue (no write), and a grown set returns ordinal 0 with sameHeadFold true β†’ no relay dispatch, rec.NudgeMode reused. Matches the body.
  • Pre-ledger records (NudgeCIChecks nil) on the same head take the fold path once and then carry the ledger; harmless one-time rewrite.
  • TestContributorNudgeCIFailureSetCooldown / TestCINudgeDue cover grow-on-same-head, same-set-new-head, changed-set-inside-cooldown and changed-set-after-cooldown.

Low: "fresh nudge after cooldown" does not restart the class count

ciNudgeDue returns ordinal 1 for a changed set on a new head once the cooldown has elapsed, and the body says this "counts as a fresh nudge". But MarkNudgedReason (store.go:1463-1470) only resets the count when the class changes and only raises it when n > NudgeReasonCount. So if the PR has already had its stall repeat (NudgeReasonCount == 2), the later ordinal-1 nudge:

  • renders n=1 in the marker and non-stalled prose while the ledger stays at 2 (the "nudge N" reading goes backwards), and
  • leaves nudgeRepeatDue capped (NudgeReasonCount >= contributorNudgeCap), so the genuinely new failing set never gets its own stall reminder.

The new test only exercises this path from NudgeReasonCount == 1 (automerge_contributor_nudge_ci_cooldown_test.go:162-171), so it does not see the difference. If the intent is that a new set after cooldown really restarts the class, MarkNudgedCIFailure(counted=true) (or MarkNudgedReason) should reset NudgeReasonCount to 1; if the intent is that the cap stays global per PR, the body's "fresh nudge" wording and the n=1 marker are the thing to adjust. Either is a small follow-up; not blocking.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contributor nudge: CI-failure nudges churn on the same PR as the failing-check set and reason prefix flap

1 participant