Skip to content

πŸ› decide plan: pending CI is not red, WHY from recorded park reasons, adopted PRs go to the fixer - #15816

Merged
clubanderson merged 2 commits into
v5from
fix/decide-plan-adopted-pr
Oct 30, 2026
Merged

clubanderson merged 2 commits into
v5from
fix/decide-plan-adopted-pr

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Closes #15815

What

The "Let hive decide" preview for #15722 (a clanker's PR the hive adopted in place, parked at 085 on the reviewer's requires_human / high-risk marker, every check green) said:

Send #15722 back to its author with one instruction: make CI green, nothing else. β€” WHY: CI is red.

Root cause

GitHub reports mergeable_state: unstable when any context is pending or failing β€” the non-required tide included. delegatedHeadCIGreen treated anything but clean/has_hooks as not green without reading the head's checks, and !CIGreen read as "red" everywhere downstream. The plan also never read the stage record's reasons / the review verdict (the facts the 085 comment was built from), and had no notion of an adopted PR, so it offered to return the hive's own branch to the contributor.

Fix

  1. CI is red only when a check failed. delegatedHeadCI summarizes the head's checks (tide/meta excluded): red when one failed, pending while running. Input.CIPending + CIRed() carry that through policy, ladder (mergeBlockers β†’ "CI still running"), plan blockers and the glossary effect.
  2. WHY from the recorded park reasons. Gather reads the stage record (reasons, live adoption via AdoptionLive(head)) and the review verdict artifact; delegatedPlanParkReason says "the reviewer returned requires_human: ".
  3. Adopted PRs go to the hive's fixer. New rules adopted-fixer ("Have hive's fixer address the reviewer's finding (…) on #N; no action needed from you.") and adopted-security-finding (recommend-only, finding named in full β€” a person's policy call). Glossary + SPA mirrors updated. Direction on an adopted PR is recorded via RecordOperatorPullRequestDecision.
  4. Red CI β†’ 072, never 085 (verified). stagelabels.RouteHuman notes red checks as fix evidence before the requires_human β†’ NeedsDecision branch; regression test added for clanker + red check + requires_human β†’ ReturnedToContributor.

Complementary to #15757 (hive-authored superseding copies β†’ fixer); this covers in-place adoptions and uses separate fields/rules.

Tests

  • TestDelegatedDecisionPlanAdoptedRequiresHumanIsFixersNotCI β€” the exact live fixture (unstable, all checks green, tide pending, 085 via requires_human, adopted in place): rule adopted-fixer, no "CI" / "back to its author" anywhere; non-adopted variant never says "CI is red".
  • TestDelegatedPlanPendingCIIsNotRed, TestDecidePRAdoptedByHiveRoutesToFixer (fixer / pending / red / security / clean / not-adopted).
  • TestDelegatedDecisionPRBlockedStateReadsHeadChecks: "unstable" now split into green-checks β†’ approve and red-checks β†’ fix-then-merge.
  • TestRouteHumanFixEvidence: red CI + requires_human on a clanker PR β†’ 072.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 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 hanthor 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 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
#15817 πŸ› activity monitor: 'merging now' lingers, silent merges, closed rows vanish same files src/pkg/dashboard/static/index.html
#15830 ✨ dashboard: pop out the Hive activity monitor into its own window and a full-screen toggle same files src/pkg/dashboard/static/index.html
#15824 ✨ Activity Monitor settings: configurable toast durations and pre-merge soak same files src/pkg/dashboard/static/index.html
#15804 ✨ Show the upgrade animation for every roll (announce + SIGTERM fallback) same files src/pkg/dashboard/static/index.html
#15757 ✨ Auto-merge hive-authored superseding PRs without operator decision CONFLICT src/pkg/delegatedecision/policy.go
#15831 πŸ› Merge train seats only PRs green and reviewed on their current head; regressed members are ejected same files src/pkg/dashboard/static/index.html
#15812 πŸ› automerge: hold same-issue PRs across lanes until a decision is recorded same files src/pkg/dashboard/api_repo_item_decide_delegated_plan.go
src/pkg/dashboard/static/index.html
src/pkg/delegatedecision/policy.go
#15774 ✨ dashboard: onboarding and GitHub App errors point to the Getting Started guide same files src/pkg/dashboard/static/index.html
#15783 πŸ› stage tracker: Let hive decide shows it is working, covered issues drop the PR's chip, πŸ‘€ says why same files src/pkg/dashboard/static/index.html

@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 diff at 0628f5b against v5 (delegatedecision/policy.go, ladder.go, dashboard/api_repo_item_decide_delegated{,_plan}.go) and the callers. The policy change is sound; CI is red because of the PR's own test fixture, one line to fix.

1. TestDelegatedDecisionPlanAdoptedRequiresHumanIsFixersNotCI panics on a nil store (high β€” this is why test (dashboard 2/4), test (dashboard shuffle 1/3) and coverage are red).
src/pkg/dashboard/api_repo_item_decide_delegated_plan_test.go:352 calls srv.stageStore.Observe(...) right after newDelegatedServer(t, mock), which never sets stageStore. (*Store).ObserveProgress dereferences the receiver at stagelabels/store.go:645 β†’ SIGSEGV (job 124172225235). The other delegated tests that touch the store set it first β€” e.g. api_repo_item_decide_delegated_test.go:827: srv.stageStore = stagelabels.NewStore("", func() time.Time { return now }). Add that line before :352 (production code is fine: gatherDelegatedRecordedPark goes through stageStoreOrShared(), stage_tracker_caption.go:1008, which falls back to the shared store).

2. Pending CI with no other blocker is now released with "green head" wording (low, wording only).
With fixList (ladder.go:303-316) no longer listing a pending head, a PR with CIPending && !Conflicting && !DCOMissing falls through fix-then-merge (policy.go:713) to small-low-risk / default-release (policy.go:720-724), whose texts say "on a green head" / "green head". The action itself is fine β€” ActionApproveReview queues via QueuePRAutoMergeWithNoteResult (api_repo_item_decide_delegated.go:889) and the engine still waits for checks β€” but the recorded rationale is false for that head. Consider "checks still running; merges when green" when in.CIPending. Not blocking.

Verified as described: delegatedHeadCI dropping the conflicting short-circuit makes ladder rung 3 (ladder.go:195, conflicts-only) reachable for the first time β€” previously Conflicting forced CIGreen=false so that branch was dead; that is an improvement, not a regression. decideAdoptedByHive is gated on !HiveAuthored && !PersonAuthored() so #15757's superseding-copy path and this one do not overlap. go build ./pkg/delegatedecision/ ./pkg/dashboard/ is clean on the head (go test is disabled for agents here, so I read the CI log instead).

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

…pted PRs go to the fixer

The "Let hive decide" preview for #15722 said "make CI green" / "CI is
red" of a PR with every check green: GitHub reports mergeable_state
"unstable" when any context β€” the non-required tide included β€” is
pending, and the plan treated anything but clean as red without reading
the checks. It also ignored the stage record's reasons (reviewer
requires_human, high-risk) and had no notion of a PR the hive adopted in
place, so it offered to send the hive's own branch back to the contributor.

- delegatedHeadCI inspects the head's checks: red only when one failed,
  pending while running; Input.CIPending / CIRed() carry that through the
  policy, ladder, blockers and glossary effect.
- gather reads the stage record (reasons, adoption) and the review verdict
  artifact; the WHY names the recorded park reason.
- New rules adopted-fixer / adopted-security-finding: an adopted PR's
  finding goes to the hive's fixer (no action needed); a security finding
  stays a person's call, named in full.
- Regression test: red CI on a clanker PR routes 072, never 085.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the fix/decide-plan-adopted-pr branch from 0628f5b to b3770d3 Compare October 30, 2026 16:55
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 050-review-pending: required-check-pending:Sign-off survives the squash

@clubanderson
clubanderson merged commit 074530a into v5 Oct 30, 2026
77 of 78 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/decide-plan-adopted-pr branch October 30, 2026 17:15
@github-actions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› "Let hive decide" says CI is red and sends an adopted PR back to its author when the park reason was reviewer requires_human

1 participant