Skip to content

πŸ› fix(advisory): re-pin digest past foreign-authored comment, warn once, skip unchanged edit - #16445

Merged
hivecommons-hive[bot] merged 3 commits into
v5from
fix-16439-advisory-pin
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 3 commits into
v5from
fix-16439-advisory-pin

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #16439

Problem

advisory.go logged skipping advisory digest comment not authored by this App on every digest cycle (~4–5 min) for the same human-authored comment (torch-spyre/spyre-inference#406, comment 5061265231) and never recovered: the comment stays on the issue forever, and the digest was still re-edited each cycle with materially identical content.

Change (src/pkg/github/advisory.go, client.go)

  1. Anchor resolution: non-App digest comments are never selected. A foreign comment is only noted in the scan state; the scan continues newest-first and re-pins to the App's own digest comment, falling back to creating a fresh App-authored one. The comment id the write lands on is persisted per owner/repo#issue (advisoryDigestAnchors, the same process-memory store the digest hashes use).
  2. Rate-limited WARN: the foreign-comment message is logged at Warn once per issue per process (advisoryForeignDigestWarned), Debug afterwards, and includes action (re-pinned to App-authored digest comment <id> / creating a fresh App-authored digest comment).
  3. Unchanged-body no-op: per-anchor last-written material fingerprint (advisoryDigestAnchorHashes); when the pending digest's fingerprint matches, the PATCH is skipped (counts toward the [quality] Advisory digest comment is rewritten every ~60s even when byte-identical β€” ~1,440 unnecessary forge writes/dayΒ #4818 write-through streak, which still forces a periodic real write).

Tests (advisory_foreign_anchor_test.go, fake httptest transport, no sleeps)

  • foreign anchor newer than App comment β†’ re-pins to App comment, no CREATE, Warn exactly once over 3 cycles, anchor persisted
  • foreign anchor with no App comment β†’ one CREATE, created id persisted as anchor
  • identical material content with a new timestamp β†’ no second PATCH; changed content β†’ PATCH again

Also a changelog.d fragment. gofmt additionally reordered the pre-existing import block in advisory.go.

…ce, skip unchanged edit

When a human-authored digest comment sits newer than the App's own on the
advisory issue, the scan warned on every ~5 min cycle and never settled.
Resolve by never selecting a non-App comment, re-pinning to the App's own
digest (or creating one) and persisting the anchor id, logging the foreign
comment once per issue per process (Debug thereafter) with the action taken,
and skipping the PATCH when the material fingerprint for the anchor is
unchanged.

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 3, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 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.

Why:

  • the review swarm requested changes

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 `#16445fe1b87a` sha256:5f34753d9043307559b101dda57c28c5fb5ee0186c892dc4fc5bc45642e06efc β€” download from the dashboard or `hivectl review evidence #16445`.

@github-actions

github-actions Bot commented Nov 3, 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
#16398 ✨ feat(github): enforce pin-only exception in merge-request relay same files src/pkg/github/client.go

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.

Read advisory.go, advisory_suppress.go and client.go at aba924ddc. The once-per-issue Warn (resolveDigestScan, advisory.go:800-829) and the per-anchor unchanged guard (:500-523) both do what the body says, and the guard is consistent with the existing #5507 rule β€” evaluateDigestSuppression already suppresses identical material indefinitely (advisory_suppress.go:137), so this adds no new bypass of a time cap. One gap worth fixing before merge:

advisoryDigestAnchors is write-only (low). It is populated at advisory.go:580-583 and asserted in advisory_foreign_anchor_test.go, but nothing reads it: PostAdvisoryDigest still takes commentID from findDigestCommentDetail every cycle (:497), and resolveDigestScan/scanDigestPage never consult it. The re-pin you observe in the tests comes from the scan continuing past the foreign comment to the next App-authored one β€” which scanDigestPage already did on v5 (continue after the old Warn). So the body's "the pin the digest returns to" and the client.go:514-517 field comment describe behaviour that is not implemented; only advisoryDigestAnchorHashes (keyed by the scan's commentID) carries weight. Either read the memoized anchor in the scan (e.g. prefer it when found on the page) or drop the map and the claim, so the next reader doesn't rely on a pin that isn't there.

Open question, not a defect: the body says the skipped PATCH "counts toward the write-through streak, which still forces a periodic real write". writeThrough only turns on when the full digestHash repeats (advisory.go:431), and the digest carries volatile text that materialDigestFingerprint has to strip. If the rendered digest differs every cycle, the streak increments but write-through never fires β€” on v5 as well, so pre-existing, but worth a glance since this PR leans on it.

Also: relative links and anchors resolve is red on this head; it may be the src/docs/scale-envelope.md client.go:5110-5120 citation shift β€” I did not confirm.

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

@hivecommons-hive
hivecommons-hive Bot merged commit f514b0d into v5 Nov 3, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix-16439-advisory-pin branch November 3, 2026 17:06
@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 fe1b87a.

@github-actions

github-actions Bot commented Nov 3, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advisory digest pin retries a comment it can never edit (not authored by this App)

1 participant