Skip to content

🐛 fix: fold remaining hive comments into the status comment in quiet mode - #15919

Merged
clubanderson merged 1 commit into
v5from
fix/notification-spam-2
Oct 31, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/notification-spam-2

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Closes #15918

Phase 2 of the notification-spam work (#15875 / #15876). In the first 80 minutes after quiet mode went live the hive still created ~65 new comments; this folds the remaining kinds into the single edited <!-- hive:status --> comment and fixes two duplication bugs that bite in either mode.

In quiet mode (github.notifications.mode: quiet, default)

was its own comment now
<!-- hive-review-evidence --> (13 / 80 min) evidence section of the status comment (review_evidence_merge.go)
<!-- hive:unblocked --> (9, incl. duplicates) unblocked section; see idempotency below (issue_blocked.go)
<!-- hive:review-backlog-summary --> review-backlog section (review_backlog.go)
contribute-hub <!-- hive:claim … --> claim section via Client.PostClaimNote — readers scan every hive comment body with strings.Index, so the marker inside a section is found exactly as before (contribute_claims.go)
relayed agent notes hive/awaiting-ci: …, Parking on stage/045…, Already fixed … agent-note:<kind> sections; any other relayed comment (findings, evidence, questions) is still posted (issue_request_watcher.go, issue_request_status_notes.go)

In either mode

normal restores the previous behaviour.

Before / after (80-min tally from #15918)

~65 new comments → the 10 status comments (edited in place; created once per PR/issue) plus the content-bearing relayed comments. Of the 55 non-status comments: 13 evidence, 9 unblocked, 2 awaiting-ci, 2 claim, 2 parking, 2 already-fixed, 2 backlog summary and ≥1 duplicate closing comment (33+) are folded or deduped; the remaining ~20 were agent findings/verdicts and single closing comments that stay.

Tests

TestRecordReviewEvidenceMergeQuietFoldsIntoStatusComment, …QuietCreatesStatusCommentOnce, TestPostUnblockedNoteIdempotentPerCause (normal / quiet / closed-by-merge), TestRelayStatusNoteKey, TestPostNoteOrFoldQuietEditsNormalCreates, TestNotificationTallyLogsHourly, TestCloseOnMergeSkipsSecondClosingComment. Direct-write ratchet tightened (review_backlog.go wrap 1→0). No time.Sleep.

Docs: operator-reference/sweeps-and-operations.md Notification mode section; changelog fragment changelog.d/fixed-notification-spam-fold-remaining-comments.md.

…mode

In quiet notification mode the evidence pointer, the unblocked note, the
review backlog summary, the contribute-hub claim marker and relayed agent
status notes (awaiting-ci, parking, already fixed) become sections of the
single edited <!-- hive:status --> comment. The unblocked note is
idempotent per cause in either mode and skipped when the same merge closes
the issue; close-on-merge and the issue-stage lane post one closing
comment, not both. The client logs created/edited/suppressed counts hourly.

Closes #15918

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 Oct 31, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 31, 2026
@github-actions

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 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 at 2c3a105 against v5 and followed the folded markers to their readers. No defects found; looks correct to me.

What I verified:

  • Claim fold is safe for readers. issueclaim.Latest (src/pkg/issueclaim/issueclaim.go:295-336) parses each body with ParseMarker, which is a strings.Index scan — so the <!-- hive:claim … --> marker inside the claim section of the status comment is found exactly as a standalone comment was. One thing I checked because it would have broken this: Latest treats any body containing <!-- hive:release as release-only (continue at :307). Nothing in this PR folds a release marker into the status comment (only pkg/claims emits it, as its own comment), so the status comment never carries both and the claim stays visible.
  • Closing-comment dedupe is symmetric and does not lose idempotency. closeOnMergeMarkers now also reports stageNoted (close_on_merge.go:932), and the stage lane checks CloseOnMergeMarker via issueCommentsContainAny (issue_stage_labels.go). hasCloseOnMergeMarker has no non-test callers, so suppressing close-on-merge's own marker when the stage lane already noted the close has no downstream consumer that would misread the issue as not-hive-closed.
  • Relay fold only catches status-shaped notes. relayStatusNoteKey (issue_request_status_notes.go) keys on the first-line prefix and returns "" otherwise, so findings/verdict comments still post. The decision-question markers are read by the review relay path (review_request_watcher.go, review_verdict_relay.go), not the issue-comment relay, so folding a "Parking on …" issue note cannot hide a decision question from the router.
  • notificationTally uses atomics for the counters and a mutex only around lastLog; the edited counter is bumped on both EditComment sites.

One behavioural note, not a defect: the agent-note:parking section is keyed per item, so a second parking note on the same issue replaces the first's text rather than appending. That matches the "one-line state report" framing in the file comment; flagging only so it is a conscious choice.

Body matches the diff throughout.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

hivecommons-hive Bot commented Oct 31, 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 reviewer (folded here because this head already carries its hive review):

Read the fold/dedupe paths against the v5 tree at a926ee6. The two "either mode" fixes are sound; one low-severity edge worth a look before this lands.

Verified correct

  • Skipping close-on-merge's own comment when the stage lane already left <!-- hive:closed-by-merged-pr pr=N --> (close_on_merge.go:659) is safe even though it means CloseOnMergeMarker is never written for that issue: the human-reopen guard does not depend on the marker — closeOnMergeReopenedAfter(events, …) on the timeline (close_on_merge.go:626) still runs, and the marker_present early return at :608 was only a shortcut. The reverse direction (issue_stage_labels.go:698) is symmetric.
  • issueCommentsContainAny / postUnblockedNote go through listIssueComments, which paginates (pr_level_hold.go:322-339), so the dedupe isn't fooled by a long thread.
  • postUnblockedNote matches on the full note text, so two different causes on one issue (superseding PR vs. direct PR) are still both reported in normal mode, and the quiet-mode unblocked section is an edit, not a create. TestPostUnblockedNoteIdempotentPerCause covers that.

Low — historic close marker suppresses unblock notes on reopened issues (issue_blocked.go:658)

The skip fires on any comment containing CloseOnMergeMarker or mergedPRClosedStageMarker, not just one for the merge currently closing the issue. The hive itself has a reopen path — it posts closeOnMergeReopenedMarker(pr) when a human reopens (close_on_merge.go:893) — so an issue that was closed by a merge, reopened, later marked blocked, and then unblocked will never get the "actionable again" note (and in quiet mode never gets its unblocked section), while the label is still lifted silently. Informational only, but the body's stated rule is "being closed by the same merge", and this is broader. Cheapest tightening: don't suppress when a closeOnMergeReopenedMarker is also present, or scope the check to the PR that caused this unblock.

Open question, not a finding: in quiet mode the single unblocked section is overwritten by the next cause. blockedIssueScan at issue_blocked.go:712 looks for the deadline note text to set deadlineNoted; if a later unblock cause rewrites the section, that signal disappears. I couldn't trace a concrete bad outcome from that in the time I had — flagging in case you already know it's benign.

Also: Sign-off survives the squash shows CANCELLED on this head; probably a superseded run, but worth a re-trigger before merge.

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

Correctness pass at 2c3a105 — the fold is sound (section bodies are trimmed by prstatus.Render, so the strings.Contains(body, note) check in postUnblockedNote and the legacy hive:claim / hive-review-evidence scans still match inside a section; release markers carry at= so issueclaim.Latest orders the folded claim by time, not comment index). One low, non-blocking edge case:

Suppression keys on any close marker, not the same merge — src/pkg/github/issue_blocked.go:664-668 returns on any CloseOnMergeMarker / mergedPRClosedStageMarker, and src/pkg/github/issue_stage_labels.go:698 treats any CloseOnMergeMarker as "already commented". Both markers are PR-agnostic and survive a person reopening the issue (close_on_merge.go:29 writes hive-reopened-after-merge, but neither path consults it). A closed→reopened issue that is later blocked/unblocked, or closed again for a different PR, gets no note at all. #15918 scopes the skip to "the same merge is closing the issue". Labels/closes are unaffected, so this is advisory.

		case strings.Contains(body, CloseOnMergeMarker) && !strings.Contains(body, "<!-- hive-reopened-after-merge"),
			strings.Contains(body, mergedPRClosedStageMarker):

(and in handleMergedPRIssueStage, prefer closeOnMergeMarkers(ctx, owner, name, in.Number, in.Claim.PRNumber) and skip only when closed && !reopened.)

@clubanderson
clubanderson merged commit 6420581 into v5 Oct 31, 2026
78 of 80 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/notification-spam-2 branch October 31, 2026 02:48
@github-actions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

1 participant