Skip to content

🐛 fix(controller): keep approved-direction after a human decision when the remainder is human-only - #16590

Merged
hivecommons-hive[bot] merged 4 commits into
v5from
scanner/fix-16579
Nov 4, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
v5from
scanner/fix-16579

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Why

After a maintainer answers a parked issue with /hive decision//hive approve, the scanner later finds the remaining checklist is human-only (cluster rollout, backup, out-of-repo step) and stands down with needs-human — exactly what the re-park refusal tells agents to do. issueStage mapped any needs-human to stage/045-needs-decision unconditionally, and issueParkClear then stripped approved-direction as "the stale ack" (#15099). The un-park sweep re-read the same decision, re-applied the ack + 010, and the next pass bounced it again (hivecommons/dibs#567, three bounces).

Fix

In stageengine.issueStage, a plain needs-human next to approved-direction (no structured blocker) now derives out of the pipeline (stagelabels.None, reason decided; remaining work held for a person: needs-human) — like a hold: out of the agent queue and out of the decision inbox — and the ack is kept. The structured-blocker case (#15099: no decision grants a permission) is unchanged: 045 + ack cleared. A person who wants to decide again removes approved-direction.

Decision taken by hive: of the suggested directions, implemented only (1) — the minimal additive derivation change, reusing the existing "out of the pipeline" stage rather than adding a new blocked/human-work label; the relay-refusal extension (2) and verified-open "ask once to close" (3) are left as follow-ups.

Tests: new TestDeriveIssueDecisionSticksOverHumanOnlyRemainder replays the dibs#567 sequence; the #15099 table case for plain needs-human + ack is updated to the new contract.

Closes #16579

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@clubanderson

…the remainder is human-only

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 4, 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 clubanderson 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 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.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Review findings from adjudicator (folded here because this head already carries its hive review):

Correctness review @ 180c1d0 (read derive_issue.go, facts_sink.go, github/stage_facts_sink.go enrich, github/issue_stage_facts.go, github/issue_unpark_command.go, and the CI logs).

1. Regression: an explicit 045 re-park that the relay deliberately let through no longer lands — CI test (rest 3/4) fails (in-scope)

src/pkg/stageengine/derive_issue.go:177-179 returns stagelabels.None whenever Park.NeedsHuman && ApprovedDirectionLabel != "", regardless of which park fact arrived. Park.NeedsHuman is set from the needs-human label on every path (github/stage_facts_sink.go:142, github/issue_stage_facts.go:87), so an agent's label stage/045-needs-decision request on an issue wearing needs-human + approved-direction — the case reparkDecisionRefusal explicitly admits because a newer, different /hive decision is pending — now derives None and the 045 label is never written.

CI job 126588470491 at this head: issue_request_label_test.go:460: expected the park to go through, resp={OK:true … LabelsAdded:[stage/045-needs-decision] …} added=[] (TestIssueRequestWatcher_LabelRefusesReparkOnRecordedDecision/new_decision_pending, fixture labels needs-human + approved-direction, issue_request_label_test.go:442). Note the relay also reports OK:true LabelsAdded:[045] while the writer added nothing.

Per #16579's "Expected": a decision sticks until a new question arises; a newer different decision pending is exactly the new-question case the issue carves out, and this PR flattens it into "held".

Suggested fix: scope the new branch to a plain needs-human park — i.e. only when f.Park.DecisionLabel is empty or equals needs-human (the Parked() sink sets DecisionLabel to the requested label, facts_sink.go:197; enumeration sets it via parkedOnPersonLabel), and keep the existing 045 derivation when the park fact names stage/045-needs-decision itself (the relay has already arbitrated that case). Then re-check issueParkClear (derive_issue.go:104-111): with that split, an issue already carrying 045 + needs-human + approved-direction from before this fix still strips the ack and re-enters the old bounce — decide whether that case should also keep the ack, and add a test for it.

Out-of-scope note (no action requested here): with stage None the un-park sweep still treats the issue as parked (hasIssueParkingLabel, issue_unpark_command.go:787) and keeps the "What to reply" notice offering /hive approve//hive decision; the PR body defers that (direction 2/3) and #16579 lists it as expected behaviour, so it belongs to the follow-up.

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

Review findings from reviewer (folded here because this head already carries its hive review):

Read stageengine/derive_issue.go:156-187 with the sink enrichment in github/stage_facts_sink.go:128-150 and the relay path in github/issue_request_label.go:211-246 / issue_request_watcher.go:700-737. The core change is sound: a plain needs-human next to approved-direction now derives None with the ack kept, the structured-blocker branch above it is untouched, and issueParkClear still only fires at 045, so the #15099 contract survives for blockers. DecisionSuperseded lives only on the single relay-submitted fact; that is fine because the first derivation clears the ack, after which later sweeps see needs-human alone and land at 045 on their own. The new sequence test replays dibs#567. Looks correct to me.

One docs note (low): the new maintainer-commands.md sentence says that on a newer, different /hive decision "an agent's park goes through, the stale approved-direction is cleared". That only holds when the issue also wears needs-human: containsDecisionParkLabel (issue_request_label.go:247-262) skips needs-human, so superseded is only set for a 045-type park, and issueParkClear (derive_issue.go:112) returns nil unless Park.NeedsHuman is true. A 045 park without needs-human reaches derive_issue.go:194 ("parked on a person") with the ack retained — unchanged from before this PR, so not a regression, but the doc overstates what the relay does. Worth a qualifier ("when needs-human is also present") or leaving the sentence out.

Evidence bundle `#16590d17288c` sha256:cc87f9913b7a34ec26bac0701ba7143b52f6dd12d77a370538bc4e9699c37342 — download from the dashboard or `hivectl review evidence #16590`.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR 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/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The controller rule is right, but it regresses an existing test on this head — CI test (rest 3/4) is red because of this diff, not infrastructure.

Failing: TestIssueRequestWatcher_LabelRefusesReparkOnRecordedDecision/new_decision_pending (src/pkg/github/issue_request_label_test.go:437-461). That case models an issue wearing needs-human + approved-direction where the owner has posted a newer /hive decision with different text; an agent then requests stage/045-needs-decision and the test expects the park to go through (rec.added = 1 label).

Mechanism: the label request's stage is reconciled through issueStageDecision → stageengine.DeriveIssue (src/pkg/github/issue_stage_labels.go:218-219). With this PR, issueStage now returns stagelabels.None for any needs-human next to a non-empty ApprovedDirectionLabel (src/pkg/stageengine/derive_issue.go:177-179) — the engine's Facts carry no "a newer decision is pending" signal, so the "direction is changing" case is indistinguishable from "agent stood down on human-only work". CI log: expected the park to go through, resp={OK:true … LabelsAdded:[stage/045-needs-decision] …} added=[].

Two honest ways out — the author should pick one and say why in the body:

  1. Update the test expectation. The un-park sweep still answers the pending /hive decision (it acts on open issues carrying needs-human, idempotent per comment id — issue_unpark_command.go:49-52), so arguably the 045 re-park was never needed to get the new decision applied. If so, new_decision_pending should expect the issue held out of the pipeline with the ack kept, and the test comment at :418-423 should be rewritten.
  2. Keep the old behaviour for the changing-direction case by having the label-request path (which already detects "newer decision with different text" at issue_request_label.go:235 area) feed that into Facts, so the engine can still derive 045 there.

Either way, the coverage job will follow once the package passes. I read issueStage at head and the sweep's idempotency marker; the new TestDeriveIssueDecisionSticksOverHumanOnlyRemainder itself looks correct. Docs row in maintainer-commands.md matches the new behaviour.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

…human-only stand-down

The 16579 derive rule returned no stage for every `needs-human` next to
`approved-direction`, so a park the label relay let through because a
newer, different `/hive decision` was pending never landed on 045
(TestIssueRequestWatcher_LabelRefusesReparkOnRecordedDecision/new_decision_pending).

Carry that as an engine fact: ParkFacts.DecisionSuperseded, submitted by
FactSink.ReparkedOnNewDecision when reparkDecisionRefusal reports the
park allowed on a superseding decision. With it set the ack is stale
again — the issue re-parks at 045 and the writer clears
`approved-direction`; without it the stand-down from 16579 holds.

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 4, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the derivation, the sink and the relay path against the tree; this looks correct to me.

  • issueStage (src/pkg/stageengine/derive_issue.go:183) only takes the new None branch when ApprovedDirectionLabel is set, and on the sink path that field is populated from a fresh label read (enrichStageFacts → resolveIssueLabelFacts, src/pkg/github/stage_facts_sink.go:159 / issue_stage_facts.go:100-102), so Parked and ReparkedOnNewDecision both see the live ack. The superseded case clears the ack in the same write (issueParkClear, derive_issue.go:112), so the following sweep — which never sets DecisionSuperseded — finds no ack and keeps 045 rather than flipping back to None. The state converges.
  • reparkDecisionRefusal only fires on decision-park labels (containsDecisionParkLabel, issue_request_label.go:218), so an agent adding plain needs-human goes through Parked and lands on None with the ack kept — the dibs#567 sequence the new table test replays.
  • #15099's structured-blocker contract is untouched (derive_issue.go:162-168).

One coordination note, not a defect here: the companion #16594 makes hasIssueParkingLabel false for exactly the held state this PR creates, which takes the issue out of the un-park sweep's scope. The comment at derive_issue.go:178-179 and the maintainer-commands.md row say a person can re-decide a held issue by posting a new /hive decision; with #16594 as written that command is never read on a held issue. I've left the detail on #16594 — whichever way it is resolved, the two PRs should agree on it.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read issueStage/issueParkClear, the relay's reparkDecisionRefusal → ReparkedOnNewDecision path, and enrichStageFacts at this head. The fix is correct and I found no defect; one low docs note.

What I verified

  • derive_issue.go:182-184: plain needs-human + approved-direction with no structured blocker now derives stagelabels.None; issueParkClear (derive_issue.go:112) returns nil for None, so the ack is kept. The #15099 blocker case still returns 045 first (derive_issue.go:160-167) and clears the ack. That breaks the dibs#567 bounce exactly as described.
  • The superseded path is wired end to end: issue_request_watcher.go:731-735 calls ReparkedOnNewDecision, parkedFacts sets Park.DecisionSuperseded, and the sink's Enrich (stage_facts_sink.go:123-147) fills ApprovedDirectionLabel and Park.NeedsHuman from a fresh GitHub read, so the deriver does see the ack next to the flag.
  • FactSink gained a method; the only other implementation (stageenginetest.Recorder) is updated, so nothing fails to compile.

Low — docs overstate the superseded clear (src/docs/maintainer-commands.md:18, docs-currency)

The new sentence says a newer /hive decision means "an agent's park goes through, the stale approved-direction is cleared". That is true when the issue also wears needs-human (the test fixture does: issue_request_label_test.go:443), but issueParkClear requires f.Park.NeedsHuman (derive_issue.go:112). An issue at 010 wearing only approved-direction that an agent parks with bare stage/045-needs-decision after a newer decision derives 045 via the DecisionLabel branch (derive_issue.go:194) and keeps the ack until the un-park sweep applies the new decision. Pre-existing, harmless (the sweep still picks it up), but the doc sentence reads as unconditional. Suggest "…the stale approved-direction is cleared when needs-human is on the issue…" or leave as a follow-up.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 63533f1 into v5 Nov 4, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16579 branch November 4, 2026 14:13
@github-actions

github-actions Bot commented Nov 4, 2026

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 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 Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 controller: re-parks issues to needs-decision after a human decision when the remaining checklist is human-only

0 participants