Repository navigation
🐛 fix(controller): keep approved-direction after a human decision when the remainder is human-only - #16590
Conversation
…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>
|
[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 No conflicting open PRs or same-file overlaps were found. |
|
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: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Correctness review @ 180c1d0 (read 1. Regression: an explicit 045 re-park that the relay deliberately let through no longer lands — CI
CI job 126588470491 at this head: 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 Out-of-scope note (no action requested here): with stage None the un-park sweep still treats the issue as parked ( 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 Read One docs note (low): the new |
There was a problem hiding this comment.
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:
- Update the test expectation. The un-park sweep still answers the pending
/hive decision(it acts on open issues carryingneeds-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_pendingshould expect the issue held out of the pipeline with the ack kept, and the test comment at:418-423should be rewritten. - 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:235area) 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>
There was a problem hiding this comment.
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 newNonebranch whenApprovedDirectionLabelis 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), soParkedandReparkedOnNewDecisionboth 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 setsDecisionSuperseded— finds no ack and keeps 045 rather than flipping back toNone. The state converges.reparkDecisionRefusalonly fires on decision-park labels (containsDecisionParkLabel,issue_request_label.go:218), so an agent adding plainneeds-humangoes throughParkedand lands onNonewith 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
There was a problem hiding this comment.
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: plainneeds-human+approved-directionwith no structured blocker now derivesstagelabels.None;issueParkClear(derive_issue.go:112) returns nil forNone, 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-735callsReparkedOnNewDecision,parkedFactssetsPark.DecisionSuperseded, and the sink'sEnrich(stage_facts_sink.go:123-147) fillsApprovedDirectionLabelandPark.NeedsHumanfrom a fresh GitHub read, so the deriver does see the ack next to the flag. FactSinkgained 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
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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 withneeds-human— exactly what the re-park refusal tells agents to do.issueStagemapped anyneeds-humantostage/045-needs-decisionunconditionally, andissueParkClearthen strippedapproved-directionas "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 plainneeds-humannext toapproved-direction(no structured blocker) now derives out of the pipeline (stagelabels.None, reasondecided; 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 removesapproved-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-worklabel; the relay-refusal extension (2) and verified-open "ask once to close" (3) are left as follow-ups.Tests: new
TestDeriveIssueDecisionSticksOverHumanOnlyRemainderreplays 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