Skip to content

🌱 contributor-nudge once per PR+reason; fold origin notes into status; marker ratchet - #17073

Merged
hivecommons-hive[bot] merged 4 commits into
v5from
spam-nudge-dedupe
Nov 7, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
v5from
spam-nudge-dedupe

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #17067

Spam reducer #3c (2026-11-07 audit: contributor-nudge 11/day -> 34/day on 11-05; unmarked bot free-text 30-46/day since 11-04).

Changes

  1. Nudge once per PR + reason. <!-- hive:contributor-nudge reason=<slug> head=<sha> n=<n> mode=<mode> -->. A new head or changed reason edits the existing nudge comment (findOwnEntryComment + EditComment, no notification) instead of posting another. One re-nudge after auto_merge.nudge_repeat_after (default 72h; governor.labels.stage.contributor_nudge.renudge_interval overrides) if the same condition persists, then stop (cap 2 per reason). New per-reason ledger fields on stagelabels.Record (nudge_reason, nudge_reason_count, nudge_reason_at); the per-head MarkNudged ledger is kept because the adoption clock reads it.
  2. hive:origin free-text notes. github.OriginFooterNote (attribution.go, footer function only) recognises a relayed body whose only marker is the identity footer's origin marker. The relay then folds it into the hive:status card (agent-note:origin) in quiet mode, or appends it to one upserted <!-- hive:origin-notes --> comment per item (last 10 kept) otherwise.
  3. Marker ratchet. src/internal/testutil/comment_marker_ratchet_test.go walks pkg/github (incl. automerge) for functions calling .Issues.CreateComment( / .CreateIssueComment( / .CreateIssueCommentBudgeted( without marker evidence (<!-- hive, Marker/marker, prstatus., Upsert). Allow-list = the 4 transport primitives. Baseline: 45 unmarked emitters; fails if it grows, logs when it drops.

Tests are table-driven, no time.Sleep. Docs updated (hive-merge, stage-labels, sweeps-and-operations, operator-reference, notifications). Changelog fragment at changelog.d/changed-contributor-nudge-dedupe.md.

Sibling-owned files (review_backlog.go, review_severity.go, automerge/*signoff*, hive:unauthorized path) untouched.

…; marker ratchet

Contributor nudges carry a hive:contributor-nudge reason=<slug> marker and
are edited in place for a new head or changed reason, with one re-nudge after
auto_merge.nudge_repeat_after (default 72h). Agent free-text relay comments
whose only marker is the hive:origin footer fold into the hive:status card
in quiet mode or one hive:origin-notes comment per item otherwise. A
grep-based ratchet in internal/testutil caps unmarked raw comment emitters
under pkg/github at the current 45.

Fixes #17067

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@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 hanthor 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 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. labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 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
#17110 πŸ› fix(pr-title): proposals use the πŸ“– prefix the PR Type gate accepts same files src/docs/notifications.md
#17086 ✨ agents: drain CLI memory into draft knowledge entries before clearing same files src/docs/operator-reference/README.md
#17112 ✨ agents: disable CLI auto-memory by default and add cli_memory.clear_on_kick same files src/docs/operator-reference/README.md
src/pkg/config/config.go

@hivecommons-hive

hivecommons-hive Bot commented Nov 7, 2026 •

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:

  • relative links and anchors resolve

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.

Evidence bundle `#170735efef71` sha256:fe71b4a9b94849869338d1a102267e6b4cc0a203eb7eb17c1d8af2449ca61750 β€” download from the dashboard or `hivectl review evidence #17073`.

TestSettingsDialogReferencesEveryHiveYAMLLeaf requires every hive.yaml
leaf to have a Settings control. Add a Re-nudge-after field to the
Labels tab next to the legacy renudge_interval it supersedes, read and
write it via /api/config/governor/labels with the same positive-duration
validation, and cover the round trip.

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

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

One concrete blocker, otherwise the dedupe logic reads correctly to me.

Red CI is your diff, and it is a one-line fix. test (dashboard 4/4) and test (dashboard shuffle 3/3) (and therefore the test/coverage aggregators) fail on

settings_parity_test.go:33: hive.yaml settings are not referenced by the Settings UI and are not allowlisted:
    auto_merge.nudge_repeat_after

The new AutoMergeConfig.NudgeRepeatAfter leaf (src/pkg/config/config.go) needs either a Settings-dialog reference or an entry in src/pkg/dashboard/settings_parity_allowlist.txt (read at src/pkg/dashboard/settings_parity_test.go:18). Given its sibling governor.labels.stage.contributor_nudge.renudge_interval is operator-tunable too, I'd expect the allowlist route unless you want it in the UI.

Correctness β€” what I checked in the tree at the PR head, not just the diff:

  • nudgeDue (src/pkg/github/automerge/automerge_contributor_nudge.go:278-296): reason change β†’ ordinal 1; same reason on a new head β†’ (0, true), so the one comment is rewritten for the new head while MarkNudgedReason(key, reason, 0, now) leaves NudgeReasonCount/NudgeReasonAt untouched (src/pkg/stagelabels/store.go:1454-1457 only advance on n > count). That means the 72h repeat clock runs from the first nudge for that reason class, not from the latest push β€” consistent with the "red for the same reason for 72h" intent, and MarkNudged still updates NudgeHead so the (0, true) branch is taken once per head, not every sweep.
  • The cap check moved from NudgeCount to NudgeReasonCount, so a PR that cycles through reason classes gets up to 2 nudges per class rather than 2 total; the body says that is the intent.
  • Edit-in-place via findOwnEntryComment(…, ContributorNudgeMarkerPrefix) with posted only counted on create, so the per-sweep nudge budget is not consumed by rewrites.

No security surface touched. Docs (hive-merge.md, stage-labels.md, notifications.md, operator reference) and a changelog fragment are updated with the behaviour.

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

The per-reason nudge ledger added for #17067 had no
direct tests, dropping pkg/stagelabels under its 90% coverage floor.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 7, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

The red relative links and anchors resolve check is not this PR's doing: CHANGELOG.md: broken link 'url' fails on the v5 head itself (incident #17098, fix in #17096). Deferring until the baseline is green and the check re-runs.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

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

The one red check is not this PR's. Everything I read in the nudge/origin-note path looks correct to me.

Red check: relative links and anchors resolve β€” the log ends with CHANGELOG.md: broken link 'url' -> url does not exist. This PR does not touch CHANGELOG.md; the literal [open](url) is on base v5 at CHANGELOG.md:224 and #17096 removes it. Rebasing after #17096 lands (or just re-running once it does) clears this; nothing to change here.

What I verified (tree at 9d37018, not just the diff)

  • src/pkg/github/automerge/automerge_contributor_nudge.go:278-295 nudgeDue: ordinal 1 on a new reason class, 0 (rewrite, uncounted) on a new head for the same class, 2 only after repeatAfter since NudgeReasonAt, never a third. The old renudge <= 0 β†’ stage dwell fallback is gone, which is fine because src/cmd/hive/merge_eligibility.go:117 now sets RenudgeInterval: nudgeRepeatAfter(cfg) and :1424 prefers governor…contributor_nudge.renudge_interval when set, else auto_merge.nudge_repeat_after with DefaultNudgeRepeatAfter = 72h (config.go:8617-8621). So policy.RenudgeInterval is never 0 in production.
  • Upgrade path: records written before this PR have NudgeReason == "", so the first pass takes the ordinal-1 branch; findOwnEntryComment(…, ContributorNudgeMarkerPrefix) (automerge_stage_human.go:715) still matches the old <!-- hive:contributor-nudge head=… marker because the search key is the prefix alone, so the existing comment is edited rather than duplicated. No second comment on upgrade.
  • store.go:1442-1461 MarkNudgedReason: a head-only rewrite passes n=0, which never lowers NudgeReasonCount or moves NudgeReasonAt, so the 72h clock is not reset by pushes β€” consistent with the "counted across heads" comment at :86-91.
  • attribution.go:355-372 OriginFooterNote: requires the identity footer with the origin marker and exactly one <!-- hive occurrence in the whole body, so a verification/blocker/status marker still routes to its own path; body-only-footer returns ok=false.
  • origin_notes.go:47-63 renderOriginNotes: continuation lines are indented two spaces by originNoteEntry, so a multi-line note (even one containing a markdown list) is not split by the "\n- " re-parse; cap of 10 keeps the newest.

One thing I did not verify and leave as an open question, not a finding: MarkNudged at store.go:1428-1432 still increments the per-head NudgeCount on every same-head call, and this PR now calls it with max(ordinal,1) on reason changes too, so per-head NudgeCount can exceed 2 where it previously could not. nudgeDue no longer reads it, so behaviour is unaffected unless something else gates on NudgeCount >= 2 β€” I did not trace every reader of that field.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The hive's GitHub App lacks actions: write, so it cannot rerun shared ci for head 9d3701878f9c. A repository maintainer with Actions write can re-run failed jobs at https://github.com/hivecommons/hive/actions/runs/42409347551 . Alternatively, the App owner can request Actions read and write for this recovery installation and its owner must accept the update. This is a CI recovery permission block, not a source-code failure or merge approval. Hive retries after its bounded permission cooldown; no alternate credential is selected. Hive will resume automatically once the step is done; this label and note clear themselves.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive
hivecommons-hive Bot merged commit 86830fc into v5 Nov 7, 2026
85 of 87 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the spam-nudge-dedupe branch November 7, 2026 21:42
@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 5efef71.

@github-actions

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

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌱 contributor-nudge once per PR+reason; fold origin notes into status; marker ratchet

1 participant