Skip to content

πŸ› Edit claim ledger, needs-decision and sentinel comments in place; suppress reviewer-lane no-findings reviews - #16434

Merged
hivecommons-hive[bot] merged 6 commits into
v5from
spam-issue-side
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 6 commits into
v5from
spam-issue-side

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #16433

An audit of the last 48h (2026-11-03) shows the hive still posts 1264 comments/48h (7.5 bot : 1 human). The PR-side churn was fixed by #15876 / #15919; the remaining top offenders are issue-side and are re-posts that carry no information the previous comment lacked. This PR edits them in place.

Before (48h window)

Family Comments / 48h Notes
hive:claim + hive:release 334 (26% of volume) relaunch/revoke cycles (lease_revoked 88, holding_agent_relaunched 47) append a release+claim pair each time; 19 items got 2–3 claims
hive:stage-needs-decision re-posts 40 9 items with 2–4 copies
hive-sentinel 41 2 PRs double-stamped
No-findings reviews from plain reviewer / reviewer-2 32 20 + 12; narrated bodies escaped the one-line acknowledgement regex
Total bot comments 1264 7.5 : 1 bot : human

Changes

  1. Claim ledger (pkg/claims/ledger_comment.go, cmd/hive/claimswire.go, pkg/github/issue_marker_comment.go). One comment per issue marked <!-- hive:issue-claim-ledger -->, PATCHed on every claim / takeover / release: current state (the same hive:claim / hive:release / hive:preempt marker and text the standalone comments carried) plus a collapsed history of the last 8 transitions. First claim creates it; a human holder the ledger has never named still gets one notifying comment, as does a displaced human on a takeover. Knob github.notifications.claim_ledger (default true; false restores a comment per transition). The ledger carries exactly one machine marker so issueclaim.Latest and everything on it keep working unchanged; issueclaim.Release gained Kind and the claimed-by label reconciler reads the ledger history for "did the human let go".
  2. Needs-decision / ready entry comments (automerge_stage_human.go, stagelabels/human.go). postHumanEntry finds the hive's own existing entry comment for the stage and rewrites it with an Updated <ts> line; a stranger's comment carrying the marker is never edited.
  3. Sentinel (sentinel_sweep.go). A new head rewrites the hive's existing sentinel comment instead of posting a second one. Only a comment the hive can verify as its own is reused (identity-unknown hives still post fresh, as the clearance recorder already does). Tests that asserted one comment per head were updated accordingly.
  4. Reviewer-lane no-findings (review/no_findings.go: CleanReview, review_request_watcher.go). In quiet mode a body that says "no findings" whose verdict report approves with an empty findings list and asks for no decision is suppressed like the one-line acknowledgement; the verdict and reviewer notes land in the hive:status comment as a review-findings:<agent> section. Bodies with a hive marker, a decision request or a non-approving verdict still post.

Docs: operator-reference/sweeps-and-operations.md (notification mode section + new claim-ledger section), settings_parity_allowlist.txt, changelog fragment.

Marker consumers kept compatible

issueclaim.Latest / ParseMarker / ParseReleaseMarker (claim recovery, dashboard contribute claims, contributor lane), github.humanClaimReleased (claimed-by label sweep), hive:preempt on takeovers, sentinelClearedByMaintainer / recordSentinelClearance (exact-head sentinel read unchanged).

No time.Sleep in the new tests; gofmt -l clean. CI is the verdict per AGENTS.md.

@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 kellyaa 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 3, 2026
@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
#16451 🌱 chore(actions): surface status-card helper failures and add its regression test same files src/docs/notifications.md

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

Failing checks:

  • build (linux/amd64, true, false, 60)
  • build (linux/arm64, true, true, 75)

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.

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

Correctness β€” delta re-review at 6075c46 (vs 697fd41). The delta fixes two of the prior findings; CI on this head (run 41672539466) still fails in cmd/hive, pkg/claims and pkg/github.

Prior findings: no_findings_test.go:45 composite literal β€” fixed (now AgentReport: outputschema.AgentReport{Findings: …}). Adoption-test read counts (automerge_adoption_orphan_test.go:242,266,328) β€” fixed, no automerge failures on this head. claimswire_budget_test.go:31 / claimswire_relaunch_test.go:125 β€” still present (TestClaimHooks_LeaseRevokedSharesClaimCommentBudget, TestClaimHooks_RelaunchReleasePostsReleaseMarker fail: the hooks now GET /issues/7/comments for the ledger and the fakes reject it). issue_claims.go:214 released-ledger fallthrough and automerge_contributor_lane.go:1124 β€” untouched, still present.

New on this head (both are the PR's own gates, not pre-existing failures):

  1. TestLedgerCommentTakeoverAndMarkerHygiene fails β€” src/pkg/claims/ledger_comment.go:72 renders the current state through releaseCommentAt, whose prose line (src/pkg/claims/comments.go:121) interpolates the raw reason, so a reason carrying <!-- hive:claim … --> lands in the ledger body verbatim and the "exactly one marker" invariant the ledger promises (ledger_comment.go:20-24) is broken. Only the history line is defanged (ledger_comment.go:180). Suggested fix at comments.go:121:
	fmt.Fprintf(&b, "πŸ”“ Claim by %s released (%s).", mention(c), strings.Join(strings.Fields(strings.ReplaceAll(reason, "<!--", "")), " "))
  1. TestNotificationWriteSitesInventory fails β€” src/pkg/github/issue_marker_comment.go:60 calls CreateIssueCommentBudgeted from EditIssueMarkerComment, which has no entry in notificationWriteSites (src/pkg/github/notification_write_sites.go:24-32); notification_write_sites_test.go:112 rejects the untagged producer. Add next to UpsertIssueMarkerComment (line 29) and to the table in src/docs/notifications.md:
	"github.(*Client).EditIssueMarkerComment":      {Class: NotificationClassStatus, Passthrough: true},

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

One verified gap worth fixing before this lands, otherwise the in-place-edit design reads sound to me. (Also: the PR is currently CONFLICTING against v5 / needs-rebase, so CI hasn't exercised this head.)

The claim-ledger upsert will edit a stranger's comment on an identity-unknown hive β€” medium.

  • src/pkg/github/issue_marker_comment.go (new, EditIssueMarkerComment): the "is this ours" test is c.markerAuthorTrusted(cm.GetUser()), and the first match is EditCommented.
  • src/pkg/github/label_approval.go:436-441 (v5): markerAuthorTrusted returns true for every author when !c.knowsOwnAccounts().
  • So on a hive that cannot name its accounts, any comment on the issue containing <!-- hive:issue-claim-ledger --> β€” including one a contributor typed β€” becomes existing and is overwritten with the ledger body. An App with issues:write can edit other users' comments, so the write succeeds. The human's text is gone, and the ledger state the hive then reads back on later claims lives in a comment it did not author.
  • The same PR already treats this case correctly in the other two sites: sentinel_sweep.go (if !posted && c.knowsOwnAccounts() before reusing a prior comment, with the comment explaining why) and automerge_stage_human.go findOwnEntryComment (requires AppBotLogin() to match, returns nil otherwise). recordSentinelClearance in sentinel_clearance.go:202 does likewise. EditIssueMarkerComment is the only new editor without that gate.
  • Suggested fix: gate the existing search on c.knowsOwnAccounts() (fall through to create when unknown), matching the sentinel hunk; the ledger then degrades to one comment per transition on such hives, which is today's behaviour.

Low / non-blocking: the sentinel reuse picks the hive's first <!-- hive-sentinel --> comment (findMarkerCommentWhere returns the first page-order match), while recordSentinelClearance (sentinel_clearance.go:197-203) rewrites the last one. On a PR that already carries two sentinel comments from the pre-fix double-stamp, a new head rewrites the older one and a later clearance rewrites the newer, leaving two comments naming different heads. Harmless for the exact-head sentinelClearedByMaintainer read, but picking the same comment in both places would keep the "one explanation per PR" promise.

I read the sentinel path against trySentinelPR / sentinelClearedByMaintainer at v5 and the rewrite-for-new-head flow holds: a cleared head A followed by push B still re-labels (no exact-head marker for B β†’ cleared false), and after a restart the rewritten comment for B is found by the exact-head read and stays quiet. findOwnEntryComment and the "stranger's comment is never edited" claim for the 085/090 entries check out.

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

Read the tree at 83bf59f (go build of cmd/hive, pkg/claims, pkg/github/..., pkg/review, pkg/stagelabels is clean). The marker-compatibility argument holds: issueclaim.Latest orders by the marker's own started_at/at= and only falls back to comment index when at= is empty (src/pkg/issueclaim/issueclaim.go:318,330-338), and releaseCommentAt always stamps at= (src/pkg/claims/comments.go:120), so a ledger that is rewritten in place reads the same as the standalone comments did. The sentinel reuse is gated on knowsOwnAccounts() and findOwnEntryComment refuses when AppBotLogin() is empty, as the body says.

One finding worth fixing before this lands:

The ledger edit is not idempotent under retry, and the retry drops the human notice β€” medium.

src/cmd/hive/claimswire.go:274-290 runs the ledger through run (retried up to claimsEffectAttempts = 4, line 59) on the stated grounds that "a PATCH that lands twice is the same body". It is not the same body: the render closure is claims.LedgerComment(previous, event), and LedgerComment unconditionally appends ledgerHistoryLine(event) to whatever history it parses out of previous (src/pkg/claims/ledger_comment.go:62-66). claimEffectRetryable treats context.DeadlineExceeded as retryable (claimswire.go:112-117 β†’ pkg/github/github_retryable.go:27), and attempt wraps every call in claimsGitHubTimeout. So on the realistic path β€” PATCH lands, response times out; or PATCH lands and the follow-on CreateIssueCommentBudgeted for the notice times out (claimswire.go:286-288, same run closure) β€” the retry re-lists, finds the ledger already carrying this transition, appends it a second time, and PATCHes again. Each retry burns one of the 8 history slots with a duplicate line. Worse, on the claim path the retry's notice(res.Previous) now sees a body that already mentions the holder, so LedgerNotifiesHuman returns false (ledger_comment.go:137-144) and the person is never told they hold the issue β€” the one notification the design promises them. The old code used runOnce for exactly this class of problem (comment at claimswire.go:252-254).

Cheap fix: event is built once outside run (the release path captures time.Now() into At before the closure, line 403), so ledgerHistoryLine(event) is identical across attempts β€” have LedgerComment skip the append when the last parsed history line already equals it, and compute the notice decision from the first attempt's Previous rather than re-deriving it per retry.

Non-blocking:

  • mergeable: CONFLICTING against v5 is only src/docs/notifications.md (git merge-tree origin/v5 83bf59f); the Go files auto-merge.
  • review.CleanReview (src/pkg/review/no_findings.go:40-58) will fold any approve-with-zero-findings body containing the words "no findings" into the status comment, including one that also says "open question: …". That is the design, and the hive-marker exclusion keeps decision questions out, but reviewer lanes should know their open questions now live in hive:status, not as a review.
Evidence bundle `#1643438a9ff9` sha256:da9ea2191b77f0876a546c9000e5bac9ada0d7dfed076538e39f34d0c3004dc6 β€” download from the dashboard or `hivectl review evidence #16434`.

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

Security perspective β€” head 697fd41

Ledger upsert trusts any comment author when the hive cannot name its accounts, and re-emits that comment's history verbatim.

src/pkg/github/issue_marker_comment.go:48 selects the comment to edit with c.markerAuthorTrusted(cm.GetUser()), which (label_approval.go:436-441) returns true for every author when knowsOwnAccounts() is false. The sentinel path in this same PR deliberately refuses that fallback (sentinel_sweep.go:704 β€” if !posted && c.knowsOwnAccounts(), "never rewrites a comment the PR author may have forged"), and the 085/090 upsert requires an App login (automerge_stage_human.go:723-726). The claim ledger is the odd one out: on a PAT hive that cannot reach /user, a stranger's comment containing <!-- hive:issue-claim-ledger --> is PATCHed by the hive (issue_marker_comment.go:70), destroying that user's comment.

The render step compounds it: claims.LedgerComment (src/pkg/claims/ledger_comment.go:62-65) feeds the previous body through ParseLedgerHistory (:97-121), which only trims the - bullet, and writes the lines back out unchanged (:83-87). Only the new line is scrubbed of <!-- (:188). A forged ledger whose history contains - <!-- hive:claim who=evil … --> is thus re-emitted under hive authorship β€” a second marker in a comment issueclaim.Latest and humanClaimReleased (claimed_by_label.go:101, trusted-author gated) will now believe.

Suggested fix β€” match the sentinel's rule and sanitize on read:

--- a/src/pkg/github/issue_marker_comment.go
+++ b/src/pkg/github/issue_marker_comment.go
@@ -45,7 +45,10 @@ func (c *Client) EditIssueMarkerComment(ctx context.Context, repo string, number int, marker string, render func(previous string) string) (IssueMarkerCommentResult, error) {
 	var existing *gh.IssueComment
-	for _, cm := range comments {
-		if cm == nil || !strings.Contains(cm.GetBody(), marker) || !c.markerAuthorTrusted(cm.GetUser()) {
+	// Only a comment the hive can verify as its own is edited; an
+	// identity-unknown hive posts fresh, as the sentinel does.
+	for _, cm := range comments {
+		if cm == nil || !c.knowsOwnAccounts() || !strings.Contains(cm.GetBody(), marker) || !c.isHiveAccount(cm.GetUser()) {
 			continue
 		}
--- a/src/pkg/claims/ledger_comment.go
+++ b/src/pkg/claims/ledger_comment.go
@@ -114,7 +114,8 @@ func ParseLedgerHistory(body string) []string {
 		if !strings.HasPrefix(line, ledgerLinePrefix) {
 			continue
 		}
-		if line = strings.TrimSpace(strings.TrimPrefix(line, ledgerLinePrefix)); line != "" {
+		line = strings.ReplaceAll(strings.TrimPrefix(line, ledgerLinePrefix), "<!--", "")
+		if line = strings.TrimSpace(line); line != "" {
 			lines = append(lines, line)
 		}
 	}

Update the issue_marker_comment.go:29-33 doc comment accordingly. Nothing else from this perspective: the 085/090 upsert, sentinel rewrite and CleanReview (rejects any body with <!--, no_findings.go:47) look sound.

β€” hive: agent=ci-maintainer 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.

Read the tree at 697fd41 (base 9c62646): the ledger renderer, EditIssueMarkerComment, the claimswire.go hooks, the humanClaimReleased reconciler, trySentinelPR, postHumanEntry, CleanReview and the watcher. The design holds up β€” one marker per ledger body keeps issueclaim.Latest/ParseMarker/ParseReleaseMarker reading the same thing, and CleanReview refusing any body with <!-- keeps decision/redundant markers posting. Both red checks, however, are caused by this diff (both are green on the base commit).

1. src/pkg/review/no_findings_test.go:45 β€” does not compile (golangci-lint typecheck). PerspectiveReport has no own field Findings; it is promoted from the embedded outputschema.AgentReport (src/pkg/review/review.go:125), and Go composite literals cannot set promoted fields. The element type is also outputschema.Finding, not PerspectiveFinding (review.go:324). CleanReview itself compiles because len(r.Findings) reads through the embedding; only the test literal is wrong. Nest it: AgentReport: outputschema.AgentReport{Findings: []outputschema.Finding{{…}}}.

2. src/pkg/github/automerge/automerge_stage_human.go:688 β€” second comment-list call per 085/090 entry breaks the read-budget invariant (test rest 1/4). findOwnEntryComment calls c.listIssueComments on every postHumanEntry. TestAdoptionMarkerWithClosedCopyReadopts (automerge_adoption_orphan_test.go:243) and TestAdoptionMarkerSettledOrAbsentIsNotRecovered (:324) assert exactly one comment read per observation β€” the adoption-marker read β€” and now see 2. That assertion is guarding API spend on every PR the engine parks, so I would not relax it; reuse the comments the adoption read already fetched for this observation (or thread a per-observation comment cache) rather than listing again.

3. Low β€” src/pkg/claims/ledger_comment.go:124 LedgerMentions is a substring match. strings.Contains(lower, "@"+holder) makes @bob match a ledger that only names @bobby, so a first-time human holder with a prefix login gets no notifying comment (the only email they would receive, since the edit notifies nobody). A word-boundary check, or matching the exact rendered forms mention(c)/ledgerName(c), fixes it.

Also worth a look: humanClaimReleased (claimed_by_label.go:107) sets ledgerReleasedHuman = humanClaimKind(rel.Kind) when the ledger's current state is a release and ignores the history in that branch, so a human β†’ agent takeover β†’ agent release sequence reads as "not released" until the next agent claim rewrites the ledger. I could not construct a path where ApplyClaimedByLabel runs against that intermediate state (it is only consulted on an agent claim, which rewrites the ledger first in the same queue), so this is an open question rather than a defect.

Verdict: changes requested for 1 and 2; both are small. I have not changed anything.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

CI triage β€” head 6075c46 (quality)

Baseline: v5 HEAD is green on every test shard, so the four red checks are PR-local (FIX_DIFF). coverage is only downstream: Coverage requires successful test shards (... rest=failure). Four distinct failures, all in code this PR adds or changes:

  1. pkg/claims β€” TestLedgerCommentTakeoverAndMarkerHygiene (rest 3/4) β€” ledger_comment_test.go:112: the release reason is embedded raw in both the <!-- hive:release ... reason=... --> marker and the history line, so an attacker-controlled reason of <!-- hive:claim who=evil until=2099-... --> round-trips as a second claim marker. Scrub <!--/--> (or anything matching hive:claim) out of reason before rendering; the test is right and the renderer is wrong.
  2. pkg/github β€” TestNotificationWriteSitesInventory (same job) β€” notification_write_sites_test.go:112: github.(*Client).EditIssueMarkerComment (issue_marker_comment.go:60) is a new notification-capable write without a class tag. Add it to notificationWriteSites and src/docs/notifications.md.
  3. cmd/hive β€” TestClaimHooks_LeaseRevokedSharesClaimCommentBudget (rest 4/4) β€” claimswire_budget_test.go:31: the edit-in-place ledger now does GET /repos/acme/widgets/issues/7/comments?per_page=100 before writing; the fake server rejects it (404) and the hook logs release ledger as a failed side effect. Serve the comments list in the fixture.
  4. cmd/hive β€” TestClaimHooks_RelaunchReleasePostsReleaseMarker (same job) β€” claimswire_relaunch_test.go:125: no release comment is created any more (it is edited into the ledger), so the "posts" assertion needs to read the edited ledger body instead.

I cannot push to this branch; nothing here is shared-infra, so no incident issue.


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

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

@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 3, 2026

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

Correctness β€” delta re-review at 1edafe2 (delta: claimswire_budget_test.go, claimswire_relaunch_test.go only)

Delta is sound: the new TestClaimHooks_ClaimLedgerEditsOneCommentPerIssue ordering assertions (edited[0] = release, edited[1] = re-claim) are safe because hooks run through the per-issue claimEffectQueue (src/cmd/hive/claimswire.go:119-135, :295). Prior finding "claim-hook tests not updated for ledger default" is fixed β€” cmd/hive passes in CI at this head.

Two prior in-scope findings are still present and still fail CI at this head (run 41674127367: pkg/claims and pkg/github FAIL):

  1. src/pkg/claims/comments.go:121 β€” release prose carries the raw reason; TestLedgerCommentTakeoverAndMarkerHygiene fails. releaseCommentAt sanitizes the reason inside the marker but writes it verbatim into the πŸ”“ prose, so a reason of <!-- hive:claim who=evil … --> puts a second <!-- hive:claim prefix into the ledger body (ledger_comment_test.go:110-112 expects 0). ledgerHistoryLine already strips <!-- (ledger_comment.go:180); the prose line needs the same.

    	fmt.Fprintf(&b, "πŸ”“ Claim by %s released (%s).", mention(c), strings.Join(strings.Fields(strings.ReplaceAll(strings.ReplaceAll(reason, "<!--", ""), "-->", "")), " "))
    
  2. src/pkg/github/issue_marker_comment.go:60 β€” EditIssueMarkerComment missing from notificationWriteSites; TestNotificationWriteSitesInventory fails. The create path calls CreateIssueCommentBudgeted from a new method with no inventory entry (notification_write_sites.go:22-32 lists UpsertIssueMarkerComment only). Add the passthrough entry and the matching row in src/docs/notifications.md (next to line 482):

     	"github.(*Client).UpsertIssueMarkerComment":    {Class: NotificationClassStatus, Passthrough: true},
    +	"github.(*Client).EditIssueMarkerComment":      {Class: NotificationClassStatus, Passthrough: true},
     | `github.(*Client).UpsertIssueMarkerComment` | `status` | passthrough wrapper; attributed to its caller |
    +| `github.(*Client).EditIssueMarkerComment` | `status` | passthrough wrapper; attributed to its caller |

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

…uppress reviewer-lane no-findings reviews

Issue-side comment churn (#16433): hive:claim/hive:release
transitions now maintain one per-issue claim-ledger comment edited in place
(github.notifications.claim_ledger, default on) that every existing marker
reader still parses; the needs-decision/ready entry comment is rewritten
with an Updated line on re-entry; a new push rewrites the hive's existing
sentinel comment instead of stamping the PR again; and in quiet mode a
reviewer-lane review that narrates "no findings" with an approving,
finding-free verdict is recorded and folded into the hive:status comment
instead of being submitted.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
…r vs legacy mode

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
…er openers out of ledger release prose

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 3, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit b4fd659 into v5 Nov 3, 2026
81 of 82 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the spam-issue-side branch November 3, 2026 17:23
@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 38a9ff9.

@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

@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 tree at 38a9ff9 (base af4ad99): the three edit-in-place paths, their marker readers, and the claims write hooks. The core compatibility argument holds and I found no correctness defect; two low-severity notes below.

Marker compatibility β€” verified. issueclaim.Latest (src/pkg/issueclaim/issueclaim.go:300-330) picks the claim by the marker's own StartedAt/until= and matches releases by identity + at=, never by comment position, so an in-place-edited ledger that is old by created_at still reads correctly. The ledger body carries exactly one hive:claim/hive:release marker (ledger_comment.go:59-70; TakeoverComment adds hive:preempt, which Latest ignores) and history lines strip <!--. The sentinel keeps the exact-head findOwnMarkerComment read for sentinelClearedByMaintainer (sentinel_sweep.go:691-708), only widening to the prior-head comment behind knowsOwnAccounts(). The 085/090 upsert only rewrites a comment whose author equals the App login (automerge_stage_human.go:719-727). The claims hooks run ledger-then-label synchronously inside one queue.run closure, so humanClaimReleased sees the freshly edited ledger when an agent claim reconciles the human label.

Low β€” ledger edit is not idempotent under retry (src/cmd/hive/claimswire.go:273, src/pkg/claims/ledger_comment.go:63). The comment says "a PATCH that lands twice is the same body", but LedgerComment(previous, event) re-parses the history from previous and appends the event again, so a retry after a successful edit (e.g. the follow-up CreateIssueCommentBudgeted for a human notice fails retryably inside the same run) duplicates the history line and, for takeovers, re-posts LedgerDisplacedNotice (claimswire.go:337 ignores previous). Consequence is cosmetic plus one possible duplicate ping; a dedupe of the last history line, or runOnce for the notice POST, would close it.

Low β€” identity-unknown fallback edits any author's comment (src/pkg/github/issue_marker_comment.go:49,71). markerAuthorTrusted returns true for every author when knowsOwnAccounts() is false, and unlike the sentinel path (sentinel_sweep.go:704, which refuses to reuse a prior comment in that state) the ledger then EditComments whichever comment carries <!-- hive:issue-claim-ledger --> β€” an App with issues:write can edit anyone's comment, so a forged marker from a PR author gets overwritten with the ledger. The docstring acknowledges the fallback and the forged-author case is covered by TestEditIssueMarkerCommentIgnoresForeignAuthorAndEmptyBody only for the identity-known case. Narrow window (needs a hive that cannot resolve its own login), but gating the edit branch on knowsOwnAccounts() and falling back to a fresh POST would match the sentinel's rule in the same PR.

Body matches the diff: all four numbered changes, the claim_ledger knob, docs, allowlist and changelog fragment are present. Looks correct to me with the two notes above; neither blocks.

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

clubanderson added a commit that referenced this pull request Nov 4, 2026
…ent-per-PR alert

v5 #16434 (#16433) rewrites the hive's existing sentinel
comment for a new head instead of posting a second one. The v6-only
clearance carry-over tests still asserted a fresh second comment; align
them with the same expectation #16434 applied to the other re-alert tests.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
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.

Issue-side comment churn: claim/release ledger, needs-decision upsert, reviewer no-findings suppression

1 participant