Repository navigation
π clanker PRs with a human changes-requested review show Returned to contributor, not Sentinel alert - #15256
Conversation
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Reviewed (style/maintainability) β no blockers; two advisory notes, head b319a60.
-
Same reason token spelled twice.
src/pkg/stagelabels/human.go:241addsLaneReasonHumanChangesRequested = "human-changes-requested"with a comment thatprstage.AutoMergeReasonHumanChangesRequested"spells the same token";src/pkg/stageengine/prstage/reasons.go:21carries the literal independently. Sinceprstagealready importsstagelabels(reasons.go:6), the dependency direction allows a single source of truth β nothing checks the two stay equal, andClassifyStage(derive_pr_classify.go:402) andRouteHuman(human.go:269) now both key on it.AutoMergeReasonHumanChangesRequested = stagelabels.LaneReasonHumanChangesRequested(in
prstage/reasons.go:21) -
Caption rewrite depends on phrasing defined elsewhere.
stageTrackerReturnedToHiveCaption(src/pkg/dashboard/stage_tracker.go:1491-1506) post-processes the finished caption withstrings.Replaceon" β "+who+" must act"and" β a maintainer requested changes", which are produced as literals instageTrackerCaption(stage_tracker.go:1580) andhumanizeStageReason(stage_tracker.go:1264). This follows the existingstageTrackerAdoptionCaptionidiom (stage_tracker_adoption.go:201-207), so it is consistent with the file β but a rewording at either source silently turns the rewrite into a no-op (it returns the caption unchanged rather than failing). Consider hoisting the two phrases into package consts shared by producer and rewriter, or threadingAuthorKind/requesters intostageTrackerCaption'sReturnedToContributorbranch so the sentence is composed once.
β hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Intent alignment vs #15255 β the three expected behaviours are implemented and tested (derive_pr_classify.go:399-408 + TestClassifyStageHumanChangeRequestWinsOverSentinelPark; pr_decision_operator.go:385-398 + TestRecordOperatorPullRequestDecisionCarriesDirectionToContributorHive; index.html stageTrackerReturnedWord). One gap between what the PR tells the contributor and what the code does:
The 072 nudge now tells the contributor's hive "the hive is pushing the fix" (medium, in-scope). sentinelBlockedUnlessHumanChangesRequested (automerge_human_changes_requested.go:132-144) makes human-changes-requested a contributor-lane stage reason for the first time. The 072 nudge (automerge_contributor_nudge.go:272 β nudgeDiagnosisRouted β nudgeDiagnosis) maps that reason at automerge_contributor_nudge.go:110-112 to the ask "a maintainer requested changes; the hive is pushing the fix" β self-lane wording that is false for a clanker PR (the same comment ends "the hive does not push to your branch", line 370). The dashboard reply also promises the contributor's hive "is nudged with the instruction below verbatim" (pr_unpark_decision.go:422), but the nudge carries neither the requester nor the direction text. Issue #15255 expected (2) asks for the text to reach the contributor's hive as a change request.
Suggested fix (src/pkg/github/automerge/automerge_contributor_nudge.go:110-112; d.HumanChangeRequester is already on stageDetail and is set by noteStageHumanChangeRequest):
case r == autoMergeReasonHumanChangesRequested:
ask := "a maintainer requested changes on this head"
if who := strings.TrimPrefix(strings.TrimSpace(d.HumanChangeRequester), "@"); who != "" {
ask = "@" + who + " requested changes on this head β see their review / the recorded direction on this PR"
}
asks = append(asks, ask)
human = true
and either drop "verbatim" from renderPRDecisionToContributorHiveReply or have the nudge quote the stored HumanChangeRequest.Body for obs.HeadSHA.
β hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Correctness β read at head b319a60.
The routing fix itself holds up: ClassifyStage (src/pkg/stageengine/derive_pr_classify.go:402-410) and RouteHuman (src/pkg/stagelabels/human.go:265-270) both let a per-head standing change request beat the 085 park, humanEvidence only populates HumanChangeRequester when HumanChangeRequestHead == obs.HeadSHA (automerge_stage_human.go), and latestTrustedHumanChangesRequested already gates on isTrustedMerger + head match (automerge_human_changes_requested.go:60-72). Tests cover 071/072 split, re-arm on new head, and the 409βaccept change.
Finding (in-scope, medium): the 072 nudge for the new human-changes-requested route tells the contributor the hive is fixing it, and does not carry the direction text.
renderPRDecisionToContributorHiveReply(src/pkg/github/pr_unpark_decision.go:417-427) promises "@x's hive is nudged with the instruction below verbatim". But the nudge path has no instruction field:ContributorNudge(src/pkg/github/automerge/automerge_contributor_nudge.go:31-57) carries onlyReason/ReviewAsks, andnudgeContributor(:259-294) never consultsc.humanChangeRequests. The direction reaches the PR only as the reply comment's quote.- Worse,
nudgeDiagnosis(automerge_contributor_nudge.go:110-112) renders reasonhuman-changes-requestedas "a maintainer requested changes; the hive is pushing the fix". That wording was written for the self lane (070); this PR is the first to route a clanker PR to 072 with that reason, so the contributor'sfix-prtask and the 072 comment now say the hive is pushing a fix on a PR it will not touch.
Suggested fix (automerge_contributor_nudge.go):
case r == autoMergeReasonHumanChangesRequested:
- asks = append(asks, "a maintainer requested changes; the hive is pushing the fix")
+ asks = append(asks, "a maintainer requested changes")
human = trueand in nudgeContributor, after nudgeDiagnosisRouted, append the standing request so the relay's fix-pr task and the comment carry the instruction:
checks, asks, human := nudgeDiagnosisRouted(obs.Reason, obs.Detail, obs.Route)
+ if c.humanChangeRequests != nil && obs.HeadSHA != "" {
+ if req, found := c.humanChangeRequests.For(obs.Owner+"/"+obs.Repo, obs.Number, obs.HeadSHA); found && !req.IsApproval() && strings.TrimSpace(req.Body) != "" {
+ asks = append(asks, "@"+req.Actor+" asked: "+strings.TrimSpace(req.Body))
+ human = true
+ }
+ }(or drop the "verbatim" promise from the reply if you'd rather not widen the nudge). stage_tracker.go humanizeStageReason already got the author-neutral "a maintainer requested changes" wording at :1263-1265, so the dashboard and the nudge currently disagree.
β hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@clubanderson this PR is held at Why:
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. |
β¦to contributor, not Sentinel alert A trusted human's CHANGES_REQUESTED review on the current head of a clanker-authored PR is the human the sentinel/hold/workflow-path parks were waiting for: RouteHuman and ClassifyStage now route it to stage/072-returned-to-contributor (071 for a person's PR, 070 for the hive's) ahead of 085, and the contributor lane reads reviews before it settles on sentinel-blocked. A new head re-arms the park (per head, as in #15216). Dashboard direction decisions are accepted on clanker PRs: the text is recorded as a change request against the head, posted to the contributor's hive, and the PR moves to 072; the 409 stays for a person's PR only. SPA: the 071/072 chevron keeps its routing word with the sentinel finding as a suffix; Give direction names the contributor's hive. Fixes #15255 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
β¦e current head The reconciler logged added=[stage/085] removed=[stage/072-returned-to- contributor] on hive#15159 after the owner swapped the labels by hand. A trusted maintainer's return label the hive did not write is now read from the label event once per head, recorded as a stage-label change request against the head, and folded into the pass like a review, so classification keeps 071/072 ahead of the sentinel/hold/workflow-path parks; a new head re-arms the park. A standing change request in the store now also folds into the stage detail when no reviewer verdict was read for the head. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
There was a problem hiding this comment.
Intent-alignment (delta re-review, head 3f3703d) β the two new commits (hand-placed stage/071/072 honoured per head in automerge_stage_human_return.go; unused openPullRequestHead dropped) match the #15255 narrative (owner swapped 085β072 by hand and the sweep undid it). One previous finding is still open:
Direction to a clanker PR tells the contributor's hive the wrong thing. src/pkg/github/pr_unpark_decision.go:423 promises the contributor's hive "is nudged with the instruction below verbatim", but the 072 nudge payload has no field for the text (automerge_contributor_nudge.go:31-57, built at :276), and the ask it does carry for human-changes-requested is "a maintainer requested changes; the hive is pushing the fix" (automerge_contributor_nudge.go:110-111). This PR is what first routes clanker PRs into that nudge with that reason (automerge_human_changes_requested.go β sentinelBlockedUnlessHumanChangesRequested), so the contributor's hive is now told the hive will push the fix β the opposite of #15255's expectation 2. The same wording also reaches a person's 071 note (:386-388), which ends "the hive does not push to your branch".
Suggested fix β name the requester and point at the comment on the PR (stageDetail.HumanChangeRequester is already populated by this PR's foldRecordedDecision change):
--- a/src/pkg/github/automerge/automerge_contributor_nudge.go
+++ b/src/pkg/github/automerge/automerge_contributor_nudge.go
@@ -109,7 +109,11 @@ func nudgeDiagnosis(reason string, d stageDetail) (checks, asks []string, human bool) {
case r == autoMergeReasonHumanChangesRequested:
- asks = append(asks, "a maintainer requested changes; the hive is pushing the fix")
+ ask := "a maintainer requested changes; see their review or direction comment on this PR"
+ if who := strings.TrimPrefix(strings.TrimSpace(d.HumanChangeRequester), "@"); who != "" {
+ ask = "@" + who + " requested changes; see their review or direction comment on this PR"
+ }
+ asks = append(asks, ask)
human = trueand in pr_unpark_decision.go:423 replace "is nudged with the instruction below verbatim" with "is nudged and the instruction below stays on this PR for it", unless you add a text field to ContributorNudge and thread req.Text through.
β hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (security, delta 7c02ec5β3f3703d) β no blocking findings. Two advisories:
src/pkg/github/automerge/automerge_stage_human_return.go:57-66βhumanReturnAlreadyChecked/markHumanReturnCheckedcache by head only. If an untrusted actor is the first to swap 085β072 on a head, the pass marks the head checked and returns; when the hive re-asserts 085 and a trusted maintainer then places 072 by hand on the same head,latestLabelEventis never re-read and the maintainer's return is silently removed every pass (fails closed, so not a vulnerability β but it is the exact #15159 flow if the author touched the label first). Key the cache by the event you already read rather than the head:
- if c.humanReturnAlreadyChecked(key, head) {
- return
- }
ev, err := c.latestLabelEvent(ctx, o.Owner, o.Repo, o.Number, worn.Label())
if err != nil {
c.debug(...)
return
}
- c.markHumanReturnChecked(key, head)
- if ev == nil || ev.GetEvent() != "labeled" {
+ if ev == nil || ev.GetEvent() != "labeled" || c.humanReturnAlreadyChecked(key, head, ev.GetID()) {
return
}
+ c.markHumanReturnChecked(key, head, ev.GetID())(store head+"@"+eventID, or a small struct, as the map value.)
- Still present from the previous review:
src/pkg/github/pr_decision_operator.go:285-286classifies a PR as clanker frompr.GetBody()markers the PR author controls, which widens the dashboard direction path (formerly 409) to any human PR whose body carries the markers. Effect is limited to a write-access operator's direction being posted as a comment and the row moving to 072, so advisory only.
β hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
3f3703d to
527d63c
Compare
There was a problem hiding this comment.
Correctness (delta re-review at 3f3703d) β the new hand-placed 071/072 reconciler (automerge_stage_human_return.go) and its test look sound; the previous blocker is still present.
1. Still present β the 072 nudge never carries the direction text and tells the contributor's hive the wrong agent is fixing it.
src/pkg/github/automerge/automerge_contributor_nudge.go:110-111 renders reason human-changes-requested as "a maintainer requested changes; the hive is pushing the fix", and ContributorNudge (automerge_contributor_nudge.go:30-52) has no field for the recorded request body, so nudgeContributor (:272-276) sends only that sentence. But the new dashboard reply on a clanker PR promises the opposite β src/pkg/github/pr_unpark_decision.go:423: "β¦%s is nudged with the instruction below verbatim" β and pr_decision_operator.go:436 documents "the contributor nudge delivers the text". #15255 expectation 2 ("the text is posted to the contributor's hive as a change request") is therefore not met: the contributor's hive receives a nudge saying this hive is pushing the fix, with no instruction.
Suggested fix (carry the standing request into the nudge):
--- a/src/pkg/github/automerge/automerge_contributor_nudge.go
+++ b/src/pkg/github/automerge/automerge_contributor_nudge.go
@@ type ContributorNudge struct {
HumanChangesRequested bool
+ // Direction is the trusted human's instruction standing against HeadSHA
+ // (review body or dashboard direction), delivered verbatim.
+ Direction string
@@ func nudgeDiagnosis(reason string, d stageDetail) (checks, asks []string, human bool) {
case r == autoMergeReasonHumanChangesRequested:
- asks = append(asks, "a maintainer requested changes; the hive is pushing the fix")
+ who := "a maintainer"
+ if d.HumanChangeRequester != "" {
+ who = "@" + d.HumanChangeRequester
+ }
+ asks = append(asks, who+" requested changes on this head")
human = true
@@ func (c *Engine) nudgeContributor(
checks, asks, human := nudgeDiagnosisRouted(obs.Reason, obs.Detail, obs.Route)
+ var direction string
+ if c.humanChangeRequests != nil {
+ if req, ok := c.humanChangeRequests.For(obs.Owner+"/"+obs.Repo, obs.Number, obs.HeadSHA); ok && !req.IsApproval() {
+ direction = strings.TrimSpace(req.Body)
+ }
+ }
n := ContributorNudge{
Owner: obs.Owner, Repo: obs.Repo, Display: obs.Display, Number: obs.Number,
HeadSHA: obs.HeadSHA, Title: obs.Title, URL: obs.URL, Author: obs.Author, OpenedAt: obs.OpenedAt,
- Reason: obs.Reason, FailingChecks: checks, ReviewAsks: asks, HumanChangesRequested: human,
+ Reason: obs.Reason, FailingChecks: checks, ReviewAsks: asks, HumanChangesRequested: human, Direction: direction,and render n.Direction as a quoted block in ContributorNudgeComment (:202-206) and in the relay payload. Alternatively drop the "verbatim" promise at pr_unpark_decision.go:423 and pr_decision_operator.go:436 β but the issue asks for the text to reach the contributor's hive, so the first route is the one that satisfies #15255.
2. Advisory (low) β hand-placed return attributed to whatever head is current when it is first read.
automerge_stage_human_return.go:61-86 honours the newest labeled event for the worn 071/072 label without comparing ev.GetCreatedAt() to when the head became current, so a label a maintainer placed on head A is recorded against head B if the author pushes before the next pass β the park then does not re-arm on B, contrary to the "per head" rule in the doc comment (:27-29). Also :66 marks the head checked before the trust check, so a trusted re-placement after an untrusted actor's on the same head is never read. Narrow windows; fine to leave for a follow-up.
Previous findings: nudge text (#1) still present; human-changes-requested literal still duplicated (stagelabels/human.go:241, prstage/reasons.go:21) β style only.
β hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Correctness re-review at head 3f3703d (delta since 80c194e: commits 1104670 "honour a hand-placed stage/071/072 over the sentinel park" and 3f3703d "drop unused openPullRequestHead wrapper").
What now holds up (verified):
automerge_contributor_lane.go:446,1240βsentinelBlockedUnlessHumanChangesRequestedonly rewrites thesentinel-blockedreason, and only when a change request stands on the current head; every other prefilter reason passes through unchanged.derive_pr_classify.go:398-410β the needs-human branch now defers toHumanChangeRequestStagebefore 085, andhuman-changes-requestedis already in the fixing-reason table (:305), so the lane reason and the classifier agree.automerge_stage_human_return.goβ the hand-placed 071/072 fold ignores the App's own label events and untrusted actors, reads label events once per head, and returns early when the store says the hive wrote that stage itself. Per-head re-arm matches #15216.pr_decision_operator.go:456-470β the 409 is kept for a person's PR and for a bareapproveon a clanker PR; direction on a clanker PR is recorded against the head.
Still present β the direction never reaches the contributor's hive, and the nudge misattributes the fix (src/pkg/github/automerge/automerge_contributor_nudge.go:110-111, untouched in this PR)
renderPRDecisionToContributorHiveReply (src/pkg/github/pr_unpark_decision.go:421) tells the operator that "@thatguywob's hive is nudged with the instruction below verbatim", and dashboard-sections.md repeats it. But the 072 nudge is built from nudgeDiagnosisRouted(obs.Reason, obs.Detail, obs.Route) (automerge_contributor_nudge.go:271), and for human-changes-requested it emits the fixed string "a maintainer requested changes; the hive is pushing the fix" with no direction text. Neither ContributorNudge nor stageDetail carries the recorded text. So #15255 expected (2) β "the text is posted to the contributor's hive as a change request" β is met only by the PR comment, not by the nudge, and the nudge tells the contributor's hive that this hive is pushing the fix when, at 072, the contributor is. The reply wording and the nudge wording disagree about who fixes and what was asked.
Smallest fix I can see: thread the standing request's text into ContributorNudge (e.g. via obs.Detail) and have the human-changes-requested ask say "a maintainer requested changes: " without the "the hive is pushing the fix" clause when the route is the contributor.
Also: the branch conflicts with v5 (mergeable CONFLICTING), so it needs a rebase before anything else.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the production diff against the tree at 3f3703d and the callers it hooks into; the mechanism holds up. What blocks it is a rebase, not the code.
Verified correct
ClassifyStage(src/pkg/stageengine/derive_pr_classify.go:402): the newHumanChangeRequestStagecheck in thestageNeedsHumanReasonsbranch is head-scoped β it goes throughTrustedHumanChangeRequested(d, o.HeadSHA)(line 224) β and mirrors the identical check already in the admission-reasons branch above it. A new head re-arms the park, as the issue asks.sentinelBlockedUnlessHumanChangesRequested(automerge_human_changes_requested.go:181): only rewritessentinel-blocked, andhumanChangesRequestedForHead(line 91) readslatestTrustedHumanChangesRequestedβ trusted reviewers only, current head only.foldHumanReturnLabel(automerge_stage_human_return.go): therec.Stage == wornprovenance short-circuit is sound becausestore.Observe(automerge_stage_labels.go:1054) records the derived stage, not the worn label β so when the hive derived 085 and a person placed 072, the label event is read and attributed. App-bot and untrusted actors are rejected beforeRecord; one read per head viahumanReturnChecked.stage_facts_sink.go:170: theauthorkind.Detectfallback for PR facts is what makesFixingStageland on 072 rather than 071 for a clanker PR; without it the issue's expected (1) would not hold.go build ./...at the head is clean.
Needs the author
Merge is CONFLICTING with v5. git merge-tree origin/v5 3f3703d reports content conflicts in three files: src/docs/api-reference.md, src/pkg/dashboard/stage_tracker_adoption_test.go, src/pkg/stagelabels/human_test.go. The conflicting commits are #15122, #15240 and #15267. I checked stagelabels/human.go specifically since #15240 also touched RouteHuman: the two changes are compatible (#15240 adds HumanAuthorOwesAnswer for a human author's requires_human; this PR adds the HumanChangeRequester note), and git auto-merges that file β only the test file conflicts. After the rebase, src/docs/api-reference.md citations will likely need bash src/scripts/check-api-reference-citations.sh --fix, since both sides moved lines in api_repo_item_decision.go.
Body is only "Fixes #15255"; the issue carries the design, so that's fine, but the PR also resolves the 409 the issue reports for direction on clanker PRs β worth a line so the reviewer of the squash sees both halves.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Fixes #15255