Skip to content

πŸ› decision: move an answered PR out of needs-decision and dispatch the fix - #14684

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
fix/decision-unpark-stage
Oct 27, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
fix/decision-unpark-stage

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #14679

What broke (hive#14628, head 3b4a2b5)

The owner commented /hive decision approve + three numbered instructions on a hive-authored PR parked at stage/085-needs-decision. The hive replied "Decision recorded … this PR moves to the fixing stage", then nothing moved: 40 minutes later the PR still wore 085, the lane kept logging contributor-lane:decision-requested, and the fix that eventually went out carried the instruction text approve.

Root causes

Where What
(a) text pkg/github/issue_unpark_command.go parseUnparkCommand Only the first non-empty line was parsed; the numbered instructions under /hive decision approve were dropped, so the store held body: "approve" and the fix prompt quoted that.
(b) stage pkg/stageengine/derive_pr_classify.go ClassifyStage The Detail.Verdict.DecisionRequested / RequiresHumanStage branches ran before stageFixingReasons (which contains human-changes-requested). Only a trusted human approval on the head cleared requires_human; a recorded human change request on the same head had no equivalent, so the reviewer's question outranked the owner's answer and the PR re-derived 085 every pass.
(c) kick pkg/review/dispatch.go PlanDispatch The HumanChangeRequest branch runs before the aggregate lookup (not body_digest dependent, so #14676 was not the blocker); the kick went out, late, with the wrong text from (a). A bare /hive decision approve was also recorded as a change request, which would kick a fix whose instruction is "approve".

Fix

  • unparkCommand.Text keeps the whole decision (rest of the command line + every line below); Decision stays the first line so the issue-side Decision: round-trip is unchanged. BareApproval() recognises approve/approved/lgtm/yes with nothing else.
  • review.HumanChangeRequest.Kind ("" = changes, "approve"). HumanChangeRequestFor (planner input) returns nil for approvals; HumanApprovalFor is the inverse. Lookup(repo, number, source, id) is the cheap "already seen" test.
  • Stage: prstage.Detail.HumanChangeRequester/Head + ReviewFacts.HumanChangeRequester, noted by the self lane from the store (noteStageHumanChangeRequest), copied across lanes in drain, folded in ReviewFactsFrom/ObservationsFromPRFacts. ClassifyStage gains HumanChangeRequestStage (fixing, owned, human-changes-requested) checked before the decision-requested block and in the admission branch; RequiresHumanStage also yields to it. Hold labels (excluded-label:*, needs-human reasons) still win.
  • Bare approve: trustedHumanApprovalForRequiresHuman falls back to a recorded approval on the head (recordedHumanApprovalForHead), which notes the human approval on the stage detail β†’ requires_human released β†’ 090/merge path per existing rules (including the ✨ merge: owner approval releases the workflow-path fenceΒ #14672 workflow fence).
  • FactSink.PRDecided(ref, PRDecisionFact): the un-park path submits the decision to the stage engine in the same pass as the reply (instruction β†’ self-lane human-changes-requested observation β†’ 070; bare approve β†’ abstain, lanes take it next pass). A failed write is logged and the store record makes the next sweep converge.
  • One log line per transition: decision: unpark pr=14628 head=3b4a2b5 mode=changes_requested by=clubanderson β†’ stage=stage/070-fixing (stage=next-sweep when the write was deferred).
  • Restart/idempotency: the reply now carries <!-- hive:decision-head <sha> mode=… -->. reconcileAnsweredPRDecision runs when no new command is pending: the newest answered /hive decision by a trusted merger whose reply names the live head (marker, or the 7-char prose prefix for older replies) and whose store record is missing or kept only the first line is re-recorded silently and the stage fact re-submitted; a decision answered for an older head is ignored.

Behaviour matrix

Decision on head H Record Stage Fix kick Lane reason
/hive decision approve + instructions kind changes, full text 070 now (same pass as reply) yes, text verbatim, to the in-pod author agent human-changes-requested (no more decision-requested)
bare /hive decision approve kind approve requires_human released β†’ 090/merge path next pass no merge gates / ready-for-human-merge
/hive decision <text> (no approve word) kind changes 070 now yes human-changes-requested
decision answered for old head, new head pushed ignored swarm re-review as before no unchanged
restart after acknowledgement, record lost / first-line-only rebuilt from thread, no second reply re-submitted planner sees the full text β€”

Tests (CI is the verdict; no go test locally)

  • TestParseUnparkCommandKeepsDecisionTextAfterFirstLine
  • TestHumanChangeRequestApprovalKindIsNotAFixRequest (store + planner)
  • TestClassifyStageHumanDecisionSupersedesDecisionRequested (table: instructions β†’ 070; bare approve β†’ not 085; stale head β†’ 085 stands), …OnAdmission, TestReviewFactsCarryHumanChangeRequesterForHeadOnly, TestFactSinkPRDecidedDerivesFixingForInstruction
  • TestSweepIssueUnparkCommandsDecisionApproveModes, TestSweepIssueUnparkCommandsReconcilesAnsweredDecisionAfterRestart (live head / first-line repair / pre-marker reply / old head), TestParsePRDecisionHeadMarker
  • TestTrySweepSelfAuthoredPRRecordedDecisionNotesStageAndApprovalReleases

No time.Sleep added.

Not in this PR

… the fix

A trusted merger's /hive decision on a hive-authored PR at
stage/085-needs-decision was acknowledged but never acted on:

- parseUnparkCommand kept only the first line, so the recorded
  instruction (and the fix kick) read "approve" instead of the
  numbered instructions under it;
- ClassifyStage answered the swarm's decision-requested verdict before
  the lane's human-changes-requested reason, so the owner's decision on
  the current head never outranked the question it answered and the PR
  stayed at 085;
- a bare /hive decision approve was recorded as a change request too.

Now the whole comment is the decision text; the recorded requester is
noted on the stage detail and folded through ReviewFacts, and a decision
on the current head derives fixing (owned rank, human-changes-requested)
ahead of RequiresHumanStage. A bare approve is recorded with kind
approve: HumanChangeRequestFor hides it from the planner and the lanes
treat it as a trusted human approval that releases requires_human. The
un-park path submits a PRDecided fact so 070 is written in the same pass
as the reply, logs one 'decision: unpark pr=… head=… mode=… by=… β†’
stage=…' line, tags the reply with the exact head, and on later sweeps
rebuilds a missing or first-line-only record from the acknowledged
comment thread for the live head only.

Fixes #14679

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 27, 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 kellyaa 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 27, 2026
@github-actions

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.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@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.

…decisions through the same mode/stage path

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 27, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • build-and-test

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.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 27, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit b352ac8 into v5 Oct 27, 2026
82 of 85 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/decision-unpark-stage branch October 27, 2026 20:10
@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

@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#146849f62e2a` sha256:9eb7880f5a808102afc3fc0cdd390e044125c5c4114fd9e12282039d61f7db0d β€” download from the dashboard or `hivectl review evidence #14684`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 9f62e2a.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/human A person pushed this PR themselves dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

decision: PR acknowledged as 'moves to fixing' but stays at 085 with no fix kick

1 participant