Repository navigation
π stage: a recorded /hive decision answers the head's requires_human verdict (no more 070β085 flap) - #14759
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
|
|
@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply. |
|
@clubanderson this PR is held at Failing checks:
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. |
6a26da9 to
001439e
Compare
|
Supersession sweep found that this PR's claimed issue is already closed by another merged PR.
Decision needed (@hivecommons): #14684 already merged and closed the claimed issue, but this PR touches files the merged PR did not. Recommended: keep open until the extra changes are reviewed, or close as superseded if they are not wanted. Another option: merge anyway. Files the merged PR did not touch: This comment is edited in place by the supersession sweep; it is not duplicated. |
|
@clubanderson this PR is held at Failing checks:
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. |
There was a problem hiding this comment.
Mechanism reads correct to me; the one thing standing in the way is the coverage gate, and it is this diff's doing.
Verified. review.DecisionAnswerFor relies on HumanChangeRequests.For (src/pkg/review/human_change_request.go:187-208), which filters on item.HeadSHA == head and returns the newest RecordedAt β so a decision on head H never answers head H2, which is the invariant the whole change depends on. DecisionAnswered() (derive_pr_classify.go) is additionally gated on VerdictNeedsHuman(d), so a bare /hive decision approve on a head whose verdict never asked for a person does not get relabelled as "decision-answered". foldRecordedDecision skips observations already stamped for the same head, so the fold is idempotent across ticks. ObservationsFromPRFacts β ReviewFactsFrom round-trip is consistent: both sides key the answer on head, and NormalizeStageDetail back-fills HumanChangeRequester/HumanApprover from the answer before the facts are read, so by is never empty on the way back in. go build of pkg/review, pkg/stageengine/..., pkg/github/automerge at 001439e is clean (I can't run go test from this host).
Low β coverage gate red because of this diff. The coverage job on 001439e (run 40610624806) fails with COVERAGE GATE FAILED: stageengine/prstage: 75.0% (floor 90%). The gate measures each package without -coverpkg, and the new ReviewVerdict.WithDecisionAnswer (src/pkg/stageengine/prstage/types.go:208-220) is only exercised from stageengine and automerge tests, so none of its four branches count toward prstage. A small prstage table test β empty by/head returns v unchanged; "approve" β DecisionDirectiveApprove; anything else (including "" and " changes_requested ") β DecisionDirectiveChanges; existing fields preserved β should clear it and is worth having anyway since that defaulting is the only place the directive string is canonicalised.
Docs: labels-and-control-signals.md gains the contributor-lane:decision-answered reason alongside the fixing reasons; matches stageFixingReasons.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦'s requires_human verdict The stage-label reconciler re-derived 085-needs-decision from the persisted decision-requested verdict on every tick because nothing told the verdict route that the owner's /hive decision had answered it; whoever moved the PR to 070 (unpark reply, fix planner, a maintainer by hand) was undone ~90s later (hive#14628 flapped 070<->085 six times). The recorded decision (review-human-change-requests.json, head-scoped, actor, timestamp, kind) is now folded into the reviewer verdict for that head as DecisionAnswered/DecisionAnsweredBy/DecisionAnsweredHead/ DecisionDirective, both in the lanes' verdict lookup and in the stage pass before classification, so a lane that skipped early can no longer leave the question looking open. Instructions derive 070 with reason contributor-lane:decision-answered; a bare approve clears the hold like a trusted Approve review; a new head's fresh requires_human verdict carries no answer and parks again. ReviewFacts round-trips the answer for the derive path and the verdict-route log names decision_answered/by/directive. Refs #14679 Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
β¦coverage floor Signed-off-by: Andy Anderson <andy@clubanderson.com>
001439e to
6b7a76e
Compare
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 6b7a76e. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
Looks correct to me. Read the three places the answer now enters and they agree on head scoping:
automerge_contributor_lane.go:1134-1150foldsreview.DecisionAnswerForinto the lane verdict;DecisionAnswerForβHumanChangeRequests.For(human_change_request.go:204-225) is exact-head, newest-wins, so a new push draws no answer and asks again, as the doc row says.automerge_stage_labels.go:475-490foldRecordedDecisionruns beforeresolveStage(list)for every item, which covers the lane-skipped-early case that produced the 070β085 flap.derive_pr_classify.goHumanChangeRequestStagekeeps owned rank and only swaps the reason tocontributor-lane:decision-answeredwhenVerdictNeedsHumanheld;stageFixingReasonscarries the new reason, so nudge/classification stay consistent.
The facts_sink.go approve branch is reached only through pr_unpark_decision.go:298 (markerAuthorTrusted), so a bare approve setting HumanApprover is still trust-gated.
One nit, docs only: the PRDecided doc comment (facts_sink.go:208-213) still says "A bare approval only lifts the park direction β¦ the deriver abstains here", which the new else if branch no longer does β it now records HumanApprover + DecisionDirectiveApprove. Worth a one-line update so the comment matches.
go build ./pkg/stageengine/... ./pkg/review/... ./pkg/github/automerge/... passes at 6b7a76e.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Refs #14679 β follow-up to #14684.
Problem: a flap, not a stall
hive#14628 (head
3b4a2b5, owner decision 18:25Z) moved 085β070 and back six times (18:45/19:04, 19:47 manual/20:00, 21:33/21:34). Pod logs showedstage labels: reviewer verdict route β¦ stage=085-needs-decision reason=contributor-lane:decision-requestedfor the PR every ~90 s regardless of the current label.Root cause: the stage pass classifies from the persisted reviewer verdict (
requires_human+decision_requested) on the head. #14684 made the lanes note the owner's answer into the tracker detail, but the tracker's details are cleared on every drain and a lane that skips early (the contributor lane on an app-authored PR, a lane stopped at CI) never notes anything β so the next tick re-derived 085 from the unanswered verdict and undid whoever had moved it to 070 (unpark reply, fix planner, a maintainer by hand).Fix
The recorded decision is already a durable, head-scoped artifact:
review-human-change-requests.json(actor, head sha,recorded_at, kind, verbatim body), written at the moment the unpark reply is posted (record-before-reply).review-verdicts.jsonis regenerated from perspective reports byCollect, so a field there would be wiped; the decision store is the right home. This PR makes the verdict route consult it:prstage.ReviewVerdictgainsDecisionAnswered / DecisionAnsweredBy / DecisionAnsweredHead / DecisionDirective(approve|changes_requested) +WithDecisionAnswer.review.DecisionAnswerFor(store, repo, pr, head)+HumanChangeRequest.Directive().contributorLaneVerdictForfolds the store answer into the verdict (withRecordedDecision), andApplyStageLabelscallsfoldRecordedDecision(list)on every drained observation beforeresolveStageβ so the answer is seen on every tick, after restart, and independent of lane order.NormalizeStageDetailfolds an answered verdict intoHumanChangeRequester/HumanApproverfor the head;HumanChangeRequestStagereports reasoncontributor-lane:decision-answeredwhen the verdict asked for a person;RequiresHumanStage/TrustedHumanChangeRequestednormalize first;ReviewFactsround-tripsDecisionAnswered/DecisionDirectiveso the derive path (startup reconcile, dashboard) agrees; thePRDecidedsink carries the answer too.decision_answered,decision_by,decision_directive; nudge text explains the new reason; docs table row added.070-fixing, reasoncontributor-lane:decision-answeredstage/070while the decision stands/hive decision approveon Hrequires_human085-needs-decisionagain (answer is head-scoped)Idempotency: the "Decision recorded" reply is posted once per (head, command comment id) β new candidates only;
reconcileAnsweredPRDecisionre-records silently (covered byTestSweepIssueUnparkCommandsReconcilesAnsweredDecisionAfterRestart). The fix kick prompt quotes every line of the decision verbatim (humanChangeRequestPromptSection; new test).Tests (no
time.Sleep)TestClassifyStageDecisionAnsweredVerdictNeverParks(tickβ070, lane's own decision-requested reasonβ070, manual 070 stands, approveβmerge path, new headβ085, stale answerβ085; each also viaFactsFromPRObservations/ObservationsFromPRFacts),TestReviewFactsRoundTripDecisionAnswer.TestFoldRecordedDecisionAnswersVerdictRoute,TestContributorLaneVerdictForCarriesRecordedDecision.TestHumanChangeRequestPromptSectionCarriesEveryDecisionLine(+DecisionAnswerFor).Not run locally per AGENTS.md; CI is the verdict.