Repository navigation
🐛 Let hive decide: say when a decision never took effect, in plain words, and never block the PR with hive's own decision - #15063
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 |
|
@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. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@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. |
A delegated decision whose expected effect (park lifted, merge, close, fresh hive PR, new commit) has not shown within decisions.delegate.effect_timeout (default 30m) is reported as no-effect: "Hive decided <plain action> at <T>, but it hasn't taken effect: <plain why>" with Merge as maintainer / Re-run decision (force) / Close as superseded / Send back for a new commit as toast buttons, plus one plain-words follow-up comment on the item (stalled marker, never a second decision). Inside the window the no-op names the decision and the deadline instead of a bare rule slug. One glossary (pkg/delegatedecision/decision_glossary.go, mirrored as STAGE_TRACKER_DECISION_GLOSSARY with a drift test) renders every rule, verdict and reason in plain words across toast, popover, PR comment and tooltip. The delegate's comment carries Hive decided / Why / What happens next / If it doesn't happen above the attribution and machine marker. A /hive decision comment the hive itself posted (delegated marker) is no longer read as a maintainer's change request, whichever login posted it — the self-blocking seen on #14822 (contributor-lane:changes-requested every cycle on the PR that carried the parser fix). Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
f6ddf71 to
31f333c
Compare
There was a problem hiding this comment.
Reviewed (security) — no blocking findings. One advisory:
Forced re-run is not visible in the audit trail (low). req.Force bypasses the dedup at src/pkg/dashboard/api_repo_item_decide_delegated.go:266 and falls through to executeDelegatedDecision (:292), which posts comments / closes / queues auto-merge again — but the audit record at :313-320 is the same as a first-time decision; nothing says the operator forced it past a recorded prior. Suggest adding the flag so a repeat write can be distinguished later:
detail := auditDetail("repo", repoFull, "number", strconv.Itoa(number), "type", itemType,
"verdict", string(d.Verdict), "rule", d.Rule, "actions", strings.Join(kinds, ","),
"keeps_park", strconv.FormatBool(d.KeepsPark), "policy", delegatedecision.PolicyName, "decision", d.Text,
"force", strconv.FormatBool(req.Force))
Checked and fine: endpoint still requires a user session (:199-201) and force adds no new auth surface; isHiveSelfDecisionComment (pr_unpark_decision.go:139) is fail-closed — a forged marker only makes a comment ignored; toast why/options are rendered via textContent only (static/index.html); the stalled follow-up body is built from fixed glossary slugs, not request text.
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (style/maintainability) — read at f6ddf71 and re-checked against current head 31f333c.
-
Already fixed on current head — noting for the record. At f6ddf71,
src/pkg/dashboard/api_repo_item_decide_delegated.go:328kept(*Server).delegatedPriorDecisionas a thin wrapper around the newdelegatedPriorDecisionState, but nothing called it any more;src/.golangci.ymlhasunusedenabled, and the golangci-lint check on f6ddf71 failed with exactly that (api_repo_item_decide_delegated.go:337:18: func (*Server).delegatedPriorDecision is unused). The wrapper is gone at 31f333c, so no action needed. -
Low / advisory — two definitions of the same default.
src/pkg/config/decisions.go:42definesDefaultDelegateDecisionEffectTimeout = 30 * time.Minuteandsrc/pkg/delegatedecision/decision_comment.go:19definesDefaultEffectTimeout = 30 * time.Minute;delegated_decision_effect.go:85-87falls back to the latter while the parsed config falls back to the former. If one is ever changed the toast's "expected within …" and the stuck threshold can drift apart silently.pkg/dashboardalready importspkg/config, so the dashboard fallback can read the config constant and the second constant can be dropped:
if s == nil || s.deps == nil || s.deps.Config == nil {
return config.DefaultDelegateDecisionEffectTimeout
}
— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Correctness review (head f6ddf71) — one low-severity regression, non-blocking.
decisionPlainReason now mislabels required-check-*:dco lane reasons — src/pkg/dashboard/stage_tracker_decision.go:264-266 consults delegatedecision.Explain(base) before humanizeStageReason. Explain (src/pkg/delegatedecision/decision_glossary.go:233-238) falls back to the token after the last :, so a lane reason such as required-check-pending:dco or required-check-failing:DCO resolves to the dco reason entry ("a commit is missing its sign-off") instead of the existing "check dco still running" / "check DCO failing" text from src/pkg/dashboard/stage_tracker.go:1103-1108. For a pending DCO check the popover now states a sign-off is missing, which is false. Same suffix path would catch any required check named hold, conflict, red, etc.
Suggested fix — keep the glossary fallback to whole-token / lane-prefixed reasons the glossary actually models:
lower := strings.ToLower(strings.TrimSpace(base))
if !strings.HasPrefix(lower, "required-check-") && !strings.HasPrefix(lower, "optional-check-") && !strings.HasPrefix(lower, "base-branch-red:") && !strings.HasPrefix(lower, "fork-guard:") {
if e, ok := delegatedecision.Explain(base); ok && e.Kind == delegatedecision.GlossaryReason {
return e.Plain
}
}
(or add an exact-match lookup in delegatedecision and use that here). A table case in the decisionPlainReason tests for required-check-pending:dco would pin it.
Verified OK: the isHiveSelfDecisionComment skip (pr_unpark_decision.go:138-140, issue_unpark_command.go:902) does not regress issue un-parking — executeDelegatedDecision applies RecordOperatorIssueDecision directly at post time (api_repo_item_decide_delegated.go:471-481), so the sweep never needed to parse the hive's own comment; stalled marker <!-- hive:decision-stalled is disjoint from <!-- hive:delegated-decision and is filtered before the rule-tag check (delegated_decision_effect.go:73-77).
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the self-blocking fix against the v5 tree; it is sound, and it does not lose the decision's effect.
src/pkg/github/pr_unpark_decision.go:139/issue_unpark_command.go:902/pr_unpark_decision.go:239skip any comment carrying the delegated marker (delegatedecision.IsDelegatedComment,policy.go:214— a substring match onMarkerPrefix). The worry would be that the sweep was the thing that executed the hive's/hive decisioncomment; it is not: the adopt-supersede verdict carries its ownActionAdoptSupersede(policy.go:443) whichexecuteDelegatedDecisionruns directly (api_repo_item_decide_delegated.go:754), approvals go throughActionApproveReview, and issue/hive-PR direction is recorded viaRecordOperator*Decisionin the same function. The comment was only ever the audit record, so ignoring it in the sweep removes the false change-request without removing anything that acted.- No import cycle:
pkg/githubnow importspkg/delegatedecision, which (including the newdecision_comment.go/decision_glossary.go) imports only stdlib andpkg/jsonextract. TestSweepIssueUnparkCommandsIgnoresHiveSelfDecisioncovers both the sweep and the reconcile-after-restart path and checks a real maintainer/hive decisionon the same thread is still honoured — that is the regression test the issue needed.
Scope note: I read the unpark/sweep change, the executeDelegatedDecision path, delegated_decision_effect.go's prior-state reader and the config plumbing; I did not read the glossary tables or the index.html toast rendering line by line. The conflicts-with-open-pr label is worth a look before merge, but I have no finding against the code.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Intent alignment vs #15062 — the four fix items are all present (stuck-decision dedup path in src/pkg/dashboard/delegated_decision_effect.go, glossary + JS mirror, four-line comment in decision_comment.go, self-decision guard at pr_unpark_decision.go:239 / issue_unpark_command.go:902). One gap in item 1's "plain why":
supersede falls back to the wrong "why" for the live PR's remaining blocker — delegated_decision_effect.go:139-146. delegatedStuckWhy only matches lane-reason substrings (changes-requested/sentinel/conflict/dco/hold/behind/CI) and then, for VerdictAdoptSupersede, reaches default: GlossaryNotMergedYet — whose text is "The hive approved it but the merge gate has not merged it" (decision_glossary.go:176-177). But a supersede is executed by the adoption engine via the LabelAdoptSupersede label (api_repo_item_decide_delegated.go:754-769), and the engine silently holds it when the author maintains the repo (automerge/automerge_contributor_adopt.go:594-604, recorded as AdoptBlockedAuthorMaintainer). That is exactly #14822's author. Once the self-decision guard clears the changes-requested lane, the no-effect toast/comment on #14822 will say "the merge gate hasn't merged it" for a decision that never asked for a merge. The dashboard already knows this state (stage_tracker_adoption.go:121-127 sets BlockedBy/AuthorMaintainer). The GlossaryAuthorOnline branch at :107 is unreachable on this path (policy.go:438 only fires contributor-offline when !ContributorOnline), so it does not cover it either.
Suggested fix: add an adoption-blocked slug and a supersede-specific fallback, e.g.
// decision_glossary.go
+ GlossaryAuthorMaintainer = "author-maintainer"
+ GlossaryNotAdoptedYet = "not-adopted-yet"
...
+ {Slug: GlossaryAuthorMaintainer, Kind: GlossaryReason, Plain: "the author maintains this repository, so the hive won't take the PR over",
+ Detail: "Stage adoption is held for maintainers' own PRs (governor.labels.stage.adoption.maintainer_policy). Merge it by hand, or set maintainer_policy to allow adoption."},
+ {Slug: GlossaryNotAdoptedYet, Kind: GlossaryReason, Plain: "the hive hasn't opened the replacement PR yet",
+ Detail: "The supersede was queued for the adoption engine but no hive-authored PR has appeared; the adoption row on the Activity Monitor says what holds it."}, // delegated_decision_effect.go, delegatedStuckWhy
if d.Verdict == delegatedecision.VerdictAdoptSupersede {
if in.ContributorOnline { return delegatedecision.GlossaryAuthorOnline }
if !s.stageAdoptionEnabled() { return delegatedecision.GlossaryAdoptionOff }
+ if a := s.stageTrackerAdoptionFor(in.Repo, in.Number); a != nil && a.AuthorMaintainer {
+ return delegatedecision.GlossaryAuthorMaintainer
+ }
}
...
switch {
+ case d.Verdict == delegatedecision.VerdictAdoptSupersede:
+ return delegatedecision.GlossaryNotAdoptedYet
case d.Verdict == delegatedecision.VerdictCloseDuplicate, ...(and mirror the two slugs in static/index.html's glossary so the sync test passes). Read at head f6ddf71.
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 060-reviewed → 050-review-pending: review-gate:awaiting-review-approval |
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 31f333c. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Fixes #15062. Evidence: #14822 (the hive's own
/hive decision supersede now: adopt…read ascontributor-lane:changes-requestedevery cycle; the owner's repeat click answered "No change — hive already recorded this decision (rulecontributor-offline)").What changes
1. Stuck-decision detection (
pkg/dashboard/delegated_decision_effect.go). The dedup path ofdecide-delegatednow checks whether the recorded decision's expected effect has shown. Insidedecisions.delegate.effect_timeout(new, default30m) the no-op names the decision in plain words and the deadline. Past it,result.action: "no-effect": Hive decided at , but it hasn't taken effect: — the why derived from the lane reason and PR state (self-decision-read-as-changes, changes_requested, sentinel, conflicting, ci-red, dco, hold, author-online for adopt, adoption-disabled, …) — plusresult.options(Merge as maintainer (on GitHub), Re-run decision, Close as superseded, Send back for a new commit) rendered as toast buttons. Re-run posts"force": trueand skips the dedup. One stalled follow-up comment is posted on the item (<!-- hive:decision-stalled … -->, never a second decision).2. Plain-words glossary (
pkg/delegatedecision/decision_glossary.go, mirrored asSTAGE_TRACKER_DECISION_GLOSSARY;TestStageTrackerDecisionGlossaryMirrorsGofails on drift;TestGlossaryCoversEveryRulescans policy.go/llm.go for rule slugs). Used by the toast head (adopted (the author's hive hasn't been connected since the nudge)),RowActionResult, the popover'sdecisionPlainReason, and the PR comment. Slugs are never shown bare.3. PR comment (
decision_comment.go). Every delegated decision comment now carries Hive decided / Why / What happens next (expected within 30 min) / If it doesn't happen above the attribution line; the/hive decisionfirst line and the machine marker are unchanged sodelegatedPriorDecisionand the sweep still match.4. Self-blocking guard (
pkg/github).eligibleUnparkCommandandreconcileAnsweredPRDecisionskip a comment carrying the delegated-decision marker, whichever login posted it. #14822 fixes theapprove <rationale>parse; this covers every other decision text the delegate can post. Regression:TestSweepIssueUnparkCommandsIgnoresHiveSelfDecision.Additive throughout:
RowActionResultgainswhy/options(omitempty), the request gainsforce,DelegateDecisionConfiggainseffect_timeout;CommentBodykeeps its signature. Does not touch #14992's or #15003's surfaces.Tests
pkg/delegatedecision(glossary coverage, aliases, JSON mirror, comment plain words, stalled body),pkg/config(effect_timeout parsing),pkg/github(self-decision guard, incl. reconcile path and a real decision still honoured),pkg/dashboard(TestDelegatedDecisionStuckReportsNoEffectreproduces the 🐛 fix: preserve owner intent through PR decision paths #14822 timeline incl. one-time follow-up and forced re-run;TestDelegatedStuckWhyReadsTheLane;TestDelegatedDecisionRepeatIsNoopupdated for the in-window wording; glossary mirror).stage_tracker_row_actions_test.go): no-effect toast text/type, options rendered as buttons, disabled option inert, Re-run acts on the toast target withforce: true,stageTrackerPlainWordsincl. lane-prefixed and unknown slugs.check-inline-js.js) clean;gofmt/go vetclean on touched packages.Docs
dashboard-sections.md(Let hive decide: plain words, stuck decisions, setting),labels-and-control-signals.md(new Decision glossary section, generated table),operator-reference.md(effect_timeout),changelog.d/fixed-stuck-decision-plain-words.md.