Repository navigation
🐛 fix(fork-guard): the 085 comment on a fork PR names the current head after a rebase and says an earlier run does not cover it - #17373
Conversation
A fork PR parked at 085 on a fork-guarded check (the fork Canary) keeps its park across new heads since hivecommons#16814, but the entry comment was written once per stage visit and never for a new head within it. On projectbluefin/utah-packages#917 the maintainer's Canary passed on 8d7a655, the author rebased the byte-identical patch onto a newer main (82ef790), and the comment still asked for a run on an earlier head. The comment is now rewritten in place (no notification) for each new head while the fork-guard park stands, and the ask says a run on an earlier head does not cover this one even with the same patch, because a rebase or a merge of the base changes the code the check runs. Whether an earlier run carries over stays the repository's decision (its Canary workflow); the hive does not carry it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Read postHumanEntry at 4042321 on v6. forkGuardEntryStale (automerge_fork_guard_carry.go:91) only fires when the record's commented head differs from the current one on a fork-guard 085 park, and the rewrite path ends in MarkEntryCommentedCause (automerge_stage_human.go:830), which sets EntryCommentedHead to the new head (stagelabels/store.go:1299), so the next visit on the same head is quiet again — no edit-every-pass loop. The rewrite goes through the existing findOwnEntryComment edit-in-place branch (#16433), so no new comment is created and nobody is re-notified. The !rec.EntryCommented guard added to the else if keeps the previously-implicit condition explicit now that the first branch can be skipped. Looks correct to me.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Reviewed by Reviewer notesRead against
No findings. I have not approved or changed anything. |
There was a problem hiding this comment.
Correctness review at head 4042321. The fix traces cleanly: ForkGuardStage puts fork-guard:<checks> into verdict.Reason → obs.Reason (automerge_stage_labels.go:1066-1068) before postHumanEntry, so forkGuardEntryStale (automerge_fork_guard_carry.go:91-97) fires on a new head within the visit, and the in-place edit then calls MarkEntryCommentedCause (automerge_stage_human.go:835) which advances EntryCommentedHead, so the repeat pass is a no-op. Test harness supports the asserted path (stageAPI.reset() keeps issueComments; commentEdits is cumulative). CI was still pending when I read it.
One low, non-blocking note:
Fallback when the hive's own 085 comment is not found posts a fresh comment per new head. postHumanEntry only edits when findOwnEntryComment returns non-nil (automerge_stage_human.go:825); on nil (comment deleted by a maintainer, AppBotLogin empty, or a transient list error, which findOwnEntryComment deliberately reads as "none", automerge_stage_human.go:847-873) it falls through to CreateComment (automerge_stage_human.go:837). Before this PR a new head inside the 085 visit posted nothing; now each author push on a still-red fork PR creates a notifying comment in that fallback. If you want the "edit notifies nobody" guarantee to hold strictly for the head-bound rewrite:
if existing := c.findOwnEntryComment(ctx, obs, stagelabels.EntryCommentMarker(route.Stage)); existing != nil {
...
return 0, nil
}
+ if headBound {
+ // The head-bound rewrite is an edit or nothing: without the hive's
+ // own comment to rewrite, do not post a new one per head.
+ store.MarkEntryCommentedCause(key, obs.HeadSHA, cause)
+ return 0, nil
+ }
if _, _, err := c.gh.Issues.CreateComment(ctx, obs.Owner, obs.Repo, obs.Number, &gh.IssueComment{Body: gh.Ptr(body)}); err != nil {— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Summary
When a fork PR is parked at 085 because a check only a maintainer can run (the fork Canary) is red, the hive's 085 comment asks the maintainer to run it "for head
<sha>". Since #16814 the park carries onto new heads without leaving 085, but the comment was only written once per stage visit, so after a rebase it kept naming an old head. Now the comment is rewritten in place for each new head, and it says plainly that a run on an earlier head does not cover this one, even with the same patch. The hive still does not carry a Canary proof across heads: that stays the repository's call, and the safety reasoning is below.What went wrong
projectbluefin/utah-packages#917 (fork PR from kylerankin):
8d7a655(run 42394558743, success).ef16e09(hive merge of main),429adc6(author rebase),bc96eb8andee80fbe(hive merges of main), and finally82ef790(author rebase, 11-09 04:59Z). Each new head turned the Canary red again.git patch-id --stableof each head's diff against its merge base isd17c30f6730b…for8d7a655,ef16e09,429adc6,ee80fbeand82ef790.ee80fbe". The head has been82ef790since 11-09 04:59Z, with no stage change in between, so the comment was never refreshed.Root cause.
postHumanEntry(src/pkg/github/automerge/automerge_stage_human.go) returns early when the entry comment was already posted this visit andEntryCommentedHeaddiffers from the current head. Before #16814 a new fork head always fell out of 085 and back, which started a new visit. Now it stays at 085, so a head-bound ask goes stale.Why the proof is not carried on patch-id equality
The fork Canary exists because it builds and publishes from fork code with the repository's credentials, so a pass has to prove the exact code that ran. Two things rule out carrying it in the hive:
8d7a655's base (e9f555d) and82ef790's base (ff2affe),mainchanged.github/workflows/canary-read-only.yml,tools/generated_sources.py,config/buildroot-image,config/buildroot-lock.jsonand.packit.yaml. That is the pipeline itself. The Canary never ran that tree.Canaryis utah-packages' own workflow, and branch protection requires it. The hive cannot turn it green, and it must not treat a red required check as passed. fix(canary): carry a fork's Canary proof across clean merges of main that change no pipeline path projectbluefin/utah-packages#900 (open) already adds carry-over in the repository's own CanaryDecidestep, for clean merges ofmainthat change no pipeline path. Even under that rule, this rebase would not carry, because of point 1.So the right hive change is to tell the maintainer the truth on the current head.
What changes
<head>, even when the change itself is the same: a rebase or a merge of the base changes the code the check runs. The check's own failure message on this head says what to run." (On utah-packages that message names the "Canary for a fork pull request" workflow, the PR number and the head commit.)fork-guard:and a changelog fragment describe both.Files
src/pkg/github/automerge/automerge_stage_human.go:postHumanEntryrewrites a stale fork-guard entry comment.src/pkg/github/automerge/automerge_fork_guard_carry.go: newforkGuardEntryStalepredicate.src/pkg/stagelabels/human.go: the extra sentence in the fork-guard ask.src/docs/labels-and-control-signals/stage-labels.md,changelog.d/fixed-fork-guard-card-new-head.md.Tests
Not run locally (AGENTS.md); CI is the verdict.
TestForkGuardEntryCommentFollowsNewHeadreplays fix: contribute page Docker/local mode + HTTP copy fallback #917. The 085 comment is posted for8d7a655. A new head82ef790, which keeps the carried guard, must edit that comment to name82ef790, with no second comment. A repeat pass on the same head must not edit it again. On v6 tip the second pass returns early, so there is no edit and the test fails.TestForkGuardEntryStalecovers the predicate: stale on a new head, not stale for the same head, another 085 cause, a non-085 route, or a record that has never commented. It does not compile on tip.TestRouteHumanForkGuardpins the new wording for one check and for two. It fails on tip because the sentence is missing.Refs #16814, projectbluefin/utah-packages#917, projectbluefin/utah-packages#900
🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1