Skip to content

✨ Scanner PR notes: one edited comment per PR, silent when nothing changed - #18457

Merged
hivecommons-hive[bot] merged 3 commits into
v5from
feat/spam-scanner-notes
Nov 16, 2026
Merged

hivecommons-hive[bot] merged 3 commits into
v5from
feat/spam-scanner-notes

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Part of #18450 (spam reduction phase 2, item 1).

Where the notes come from

The scanner writes CI-triage and rebase notes itself with gh pr comment. bin/gh-wrapper.sh routes that to hive-open-issue comment, and the hive's comment relay (handleOneIssueRequest in src/pkg/github/issue_request_watcher.go) posts it. The write-surface gate refuses a direct POST from an enforced lane, so the relay sees every agent comment. The fix is there, not only in the prompt.

The existing origin-notes upsert (#17067) never matched these notes. The relay appends the — hive: agent=… attribution trailer after the identity footer, so OriginFooterNote's "footer is terminal" check fails. Some notes also carry ad-hoc markers (<!-- hive-scanner-triage -->). Every pass fell through to a plain new comment: 17 on #18254 for head 50eef7e.

Change

src/pkg/github/scanner_note.go, scanner lane only, PR comments only:

  • First note: posts a comment marked <!-- hive:scanner-note head=<sha> checks=<fp> told=<sha> -->.
  • Same head SHA and same failing-check set (red gating checks, failed DCO, merge-conflict when mergeable state is dirty): nothing is written. The request completes already_existed and the relay logs a line.
  • Changed head or failing set: the note is edited in place.
  • The author must act (non-hive author, something red) and has not been told for this head: a new comment, which becomes the current note. The old note loses its marker.
  • Pass-through: issues, other lanes, blocked-on-PR parks, shared-CI incident references (<!-- hive-shared-ci-<n> -->), verification and other <!-- hive:… --> markers, PR lookup failure. If the checks can't be read, the note is never dropped.
  • HIVE_SCANNER_NOTE_UPSERT=off|0|false|no disables it. It is on by default.

The scanner policies (all six scanner*.md) now describe the one-note rule. src/docs/notifications.md has a new "Scanner note: one comment per PR" section, and two new write-site inventory entries are added in both the doc and notification_write_sites.go.

Tests

src/pkg/github/scanner_note_test.go: first note posted, repeat on same head dropped, changed head / failing set edits, author-must-act posts once per head and hands over the marker, conflict and DCO in the failing set, unknown checks never drop, pass-through cases, toggle, end-to-end through the relay.

Fixes #18451

🤖 Generated with Claude Code

…anged

The comment relay keeps one <!-- hive:scanner-note --> comment per PR for the
scanner lane. A note on an unchanged head SHA and failing-check set (red
checks, failed DCO, merge conflict) is dropped with a log line; a change edits
the note in place; a non-hive PR author who must act and has not been told
for this head still gets a new comment. Shared-CI incident references and
other marked comments keep their own path. HIVE_SCANNER_NOTE_UPSERT=off turns
it off. Scanner policies, notifications.md and the write-site inventory are
updated.

Fixes #18451

Signed-off-by: Andy 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 16, 2026
@clubanderson clubanderson changed the title 📉 Scanner PR notes: one edited comment per PR, silent when nothing changed ✨ Scanner PR notes: one edited comment per PR, silent when nothing changed Nov 16, 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 Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 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.

PR Title Relation Files
#18456 ✨ Sentinel: fold informational notices on trusted authors' PRs into the status card same files src/docs/notifications.md
src/pkg/github/notification_write_sites.go
#18455 ✨ Fold the auto-merge note into the PR hive:status card (quiet mode) same files src/docs/notifications.md

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing

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/scanner_note.go 63 ARITHMETIC_BASE
src/pkg/github/scanner_note.go 63 ARITHMETIC_BASE

Verdict: uncovered (#17349).

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
ef70746

ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blocked

Hive flagged this PR (author @clubanderson, head ef707469e36f) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 12 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • src/pkg/policies/defaults/scanner-advisory.md
    • src/pkg/policies/defaults/scanner-automerge.md
    • src/pkg/policies/defaults/scanner-full.md
    • src/pkg/policies/defaults/scanner-holdgated.md
    • src/pkg/policies/defaults/scanner-issues.md
    • src/pkg/policies/defaults/scanner.md
    • src/policies/scanner-advisory.md
    • src/policies/scanner-automerge.md
    • src/policies/scanner-full.md
    • src/policies/scanner-holdgated.md
    • src/policies/scanner-issues.md
    • src/policies/scanner.md

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

@clubanderson this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • test (rest 1/4)
  • test (rest 3/4)

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@hivecommons-hive
hivecommons-hive Bot merged commit c39c0f6 into v5 Nov 16, 2026
86 of 87 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/spam-scanner-notes branch November 16, 2026 18:31
@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 5913ec2.

@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 16, 2026
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/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.

📉 Spam phase 2: scanner CI-triage and rebase notes become one edited comment per PR, silent when nothing changed

1 participant