From 7ba45b366c6999b856e137175f4a1e0e36675278 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:22:46 -0500 Subject: [PATCH 1/4] fix(github): stop un-park sweep re-offering decisions on a held issue Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-16591.md | 1 + src/pkg/github/issue_unpark_command.go | 12 ++++++++++++ src/pkg/github/issue_unpark_command_test.go | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 changelog.d/fixed-16591.md diff --git a/changelog.d/fixed-16591.md b/changelog.d/fixed-16591.md new file mode 100644 index 0000000000..0377c63049 --- /dev/null +++ b/changelog.d/fixed-16591.md @@ -0,0 +1 @@ +The un-park sweep no longer treats an issue held after a human decision (`needs-human` + `approved-direction`, no stage/045) as parked, so it stops re-offering `/hive approve`/`/hive decision` on it (#16591). diff --git a/src/pkg/github/issue_unpark_command.go b/src/pkg/github/issue_unpark_command.go index 121ab354cb..e19b55f836 100644 --- a/src/pkg/github/issue_unpark_command.go +++ b/src/pkg/github/issue_unpark_command.go @@ -784,7 +784,13 @@ func isUnparkRemovableLabel(label string) bool { } // hasIssueParkingLabel reports whether the issue is parked on a person. +// `needs-human` beside the approval label and without a stage/045 park label +// is an issue held after a human decision: nothing is open to decide, so it is +// not parked (hivecommons/hive#16591). func hasIssueParkingLabel(labels []string) bool { + if isHeldAfterDecision(labels) { + return false + } if hasIssueNeedsHumanLabel(labels) { return true } @@ -1283,3 +1289,9 @@ func renderUnparkFixedReply(actor, note string, removed []string) string { b.WriteString("; any `hold` label is left exactly as it was.\n\nIf this was closed by mistake, the reporter or a maintainer can comment `/reopen`.") return b.String() } + +func isHeldAfterDecision(labels []string) bool { + return hasIssueNeedsHumanLabel(labels) && labelPresent(labels, HumanAckLabel) && + !labelPresent(labels, NeedsDecisionStageLabel) && !labelPresent(labels, legacyIssueNeedsDecisionStageLabel) && + !labelPresent(labels, issueNeedsDecisionLabel) && !labelPresent(labels, issueNeedsDirectionLabel) +} diff --git a/src/pkg/github/issue_unpark_command_test.go b/src/pkg/github/issue_unpark_command_test.go index a246e94a54..15a5441ac0 100644 --- a/src/pkg/github/issue_unpark_command_test.go +++ b/src/pkg/github/issue_unpark_command_test.go @@ -1269,3 +1269,12 @@ func TestParseUnparkCommandKeepsDecisionTextAfterFirstLine(t *testing.T) { t.Fatalf("single-line decision = %+v", single) } } + +func TestHasIssueParkingLabelHeldAfterDecision(t *testing.T) { + if hasIssueParkingLabel([]string{"needs-human", HumanAckLabel}) { + t.Fatal("needs-human + approved-direction without a park stage is held, not parked") + } + if !hasIssueParkingLabel([]string{"needs-human", HumanAckLabel, NeedsDecisionStageLabel}) { + t.Fatal("a stage/045 park label keeps the issue parked") + } +} From 44a07b42ae511f17c4fce6e487f354a531659c50 Mon Sep 17 00:00:00 2001 From: "hivecommons-hive[bot]" <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:23:38 +0000 Subject: [PATCH 2/4] changelog: fragment for #16594 Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-16594.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/fixed-16594.md diff --git a/changelog.d/fixed-16594.md b/changelog.d/fixed-16594.md new file mode 100644 index 0000000000..1195da6359 --- /dev/null +++ b/changelog.d/fixed-16594.md @@ -0,0 +1 @@ +- fix(github): stop un-park sweep re-offering decisions on a held issue (#16594) From 11a2915c5c21be5f1611804ead6ed58743594278 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:38:53 -0500 Subject: [PATCH 3/4] chore(changelog): make fragment a single '- ' entry bullet Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-16591.md | 2 +- changelog.d/fixed-16594.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 changelog.d/fixed-16594.md diff --git a/changelog.d/fixed-16591.md b/changelog.d/fixed-16591.md index 0377c63049..ce81b76330 100644 --- a/changelog.d/fixed-16591.md +++ b/changelog.d/fixed-16591.md @@ -1 +1 @@ -The un-park sweep no longer treats an issue held after a human decision (`needs-human` + `approved-direction`, no stage/045) as parked, so it stops re-offering `/hive approve`/`/hive decision` on it (#16591). +- The un-park sweep no longer treats an issue held after a human decision (`needs-human` + `approved-direction`, no stage/045) as parked, so it stops re-offering `/hive approve`/`/hive decision` on it ([#16591](https://github.com/hivecommons/hive/issues/16591)). diff --git a/changelog.d/fixed-16594.md b/changelog.d/fixed-16594.md deleted file mode 100644 index 1195da6359..0000000000 --- a/changelog.d/fixed-16594.md +++ /dev/null @@ -1 +0,0 @@ -- fix(github): stop un-park sweep re-offering decisions on a held issue (#16594) From d858b183299034b5e2e38677057c57be67d933f4 Mon Sep 17 00:00:00 2001 From: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:57:26 -0500 Subject: [PATCH 4/4] fix(github): keep held issues in the un-park sweep, only drop the re-offer Review of #16594: dropping needs-human + approved-direction from hasIssueParkingLabel took the held issue out of the sweep entirely, so a /hive decision, /hive help or /fixed posted on it was no longer parsed or answered. #16591 only asked to stop re-offering the decision. Keep the issue in scope and gate the "What to reply" notice and the prose hint on !isHeldAfterDecision instead; commands are still answered. 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> --- changelog.d/fixed-16591.md | 2 +- src/pkg/github/issue_unpark_command.go | 20 +++-- src/pkg/github/issue_unpark_command_test.go | 87 +++++++++++++++++++-- 3 files changed, 96 insertions(+), 13 deletions(-) diff --git a/changelog.d/fixed-16591.md b/changelog.d/fixed-16591.md index ce81b76330..b54e4c37f5 100644 --- a/changelog.d/fixed-16591.md +++ b/changelog.d/fixed-16591.md @@ -1 +1 @@ -- The un-park sweep no longer treats an issue held after a human decision (`needs-human` + `approved-direction`, no stage/045) as parked, so it stops re-offering `/hive approve`/`/hive decision` on it ([#16591](https://github.com/hivecommons/hive/issues/16591)). +- The un-park sweep no longer posts the "What to reply" notice or the `/hive approve` hint on an issue held after a human decision (`needs-human` + `approved-direction`, no stage/045), while still answering `/hive decision`, `/hive help` and `/fixed` on it ([#16591](https://github.com/hivecommons/hive/issues/16591)). diff --git a/src/pkg/github/issue_unpark_command.go b/src/pkg/github/issue_unpark_command.go index e19b55f836..65b94b17fe 100644 --- a/src/pkg/github/issue_unpark_command.go +++ b/src/pkg/github/issue_unpark_command.go @@ -445,7 +445,11 @@ func (c *Client) tryUnparkIssue(ctx context.Context, displayRepo, owner, repo st if err != nil { return false, err } - if !labelDriven { + // A held issue (hivecommons/hive#16591) has nothing open to decide: no + // "What to reply" notice and no prose hint, but every command it does + // get is still answered. + held := isHeldAfterDecision(issueLabelNames(issue.Labels)) + if !labelDriven && !held { if err := c.ensureUnparkNoticeComment(ctx, owner, repo, number, issue.GetBody(), comments); err != nil { return false, err } @@ -503,6 +507,9 @@ func (c *Client) tryUnparkIssue(ctx context.Context, displayRepo, owner, repo st return true, nil case unparkCommandNone: // Prose assent, no command. Say what to type; do not act on it. + if held { + return false, nil + } if err := c.postUnparkReply(ctx, owner, repo, number, candidate.GetID(), unparkProseHintReply); err != nil { return false, err } @@ -784,13 +791,7 @@ func isUnparkRemovableLabel(label string) bool { } // hasIssueParkingLabel reports whether the issue is parked on a person. -// `needs-human` beside the approval label and without a stage/045 park label -// is an issue held after a human decision: nothing is open to decide, so it is -// not parked (hivecommons/hive#16591). func hasIssueParkingLabel(labels []string) bool { - if isHeldAfterDecision(labels) { - return false - } if hasIssueNeedsHumanLabel(labels) { return true } @@ -1290,6 +1291,11 @@ func renderUnparkFixedReply(actor, note string, removed []string) string { return b.String() } +// isHeldAfterDecision reports an issue held after a human decision: +// `needs-human` beside the approval label and without a stage/045 park label. +// Nothing is open to decide on it, so the sweep stops offering `/hive approve` +// / `/hive decision` (hivecommons/hive#16591) while still answering any +// command a maintainer posts. func isHeldAfterDecision(labels []string) bool { return hasIssueNeedsHumanLabel(labels) && labelPresent(labels, HumanAckLabel) && !labelPresent(labels, NeedsDecisionStageLabel) && !labelPresent(labels, legacyIssueNeedsDecisionStageLabel) && diff --git a/src/pkg/github/issue_unpark_command_test.go b/src/pkg/github/issue_unpark_command_test.go index 15a5441ac0..f9f8bda079 100644 --- a/src/pkg/github/issue_unpark_command_test.go +++ b/src/pkg/github/issue_unpark_command_test.go @@ -1270,11 +1270,88 @@ func TestParseUnparkCommandKeepsDecisionTextAfterFirstLine(t *testing.T) { } } -func TestHasIssueParkingLabelHeldAfterDecision(t *testing.T) { - if hasIssueParkingLabel([]string{"needs-human", HumanAckLabel}) { - t.Fatal("needs-human + approved-direction without a park stage is held, not parked") +func heldIssue(number int, comments ...unparkWireComment) unparkWireIssue { + issue := parkedIssue(number, comments...) + issue.Labels = []wireLabel{{Name: "needs-human"}, {Name: HumanAckLabel}, {Name: "hold"}} + return issue +} + +func TestIsHeldAfterDecision(t *testing.T) { + if !isHeldAfterDecision([]string{"needs-human", HumanAckLabel}) { + t.Fatal("needs-human + approved-direction without a park stage is held") + } + if isHeldAfterDecision([]string{"needs-human", HumanAckLabel, NeedsDecisionStageLabel}) { + t.Fatal("a stage/045 park label means something is still open to decide") + } + if isHeldAfterDecision([]string{"needs-human"}) { + t.Fatal("needs-human alone is parked, not held") + } + if !hasIssueParkingLabel([]string{"needs-human", HumanAckLabel}) { + t.Fatal("a held issue stays in the sweep so its commands are still answered") + } +} + +func TestSweepIssueUnparkCommandsHeldIssueGetsNoNoticeOrProseHint(t *testing.T) { + issues := []unparkWireIssue{ + heldIssue(61), + heldIssue(62, humanComment(71, "maintainer", "sounds good, go ahead")), + } + server, rec := newUnparkServer(t, "org", "repo", issues, map[string]string{"maintainer": "admin"}) + c := newTestClient(t, server, "org", []string{"repo"}) + + result, err := c.SweepIssueUnparkCommands(context.Background(), IssueUnparkSweepOptions{}) + if err != nil { + t.Fatalf("sweep: %v", err) + } + if result.Seen != 2 || len(result.Unparked) != 0 || result.Replies != 0 { + t.Fatalf("seen=%d unparked=%+v replies=%d", result.Seen, result.Unparked, result.Replies) + } + for _, n := range []int{61, 62} { + if len(rec.posted[n]) != 0 { + t.Fatalf("held issue %d must not be re-offered a decision, got %v", n, rec.posted[n]) + } + } + if len(rec.edited) != 0 { + t.Fatalf("no notice to edit on a held issue, got %v", rec.edited) + } +} + +func TestSweepIssueUnparkCommandsHeldIssueStillAnswersDecision(t *testing.T) { + issues := []unparkWireIssue{heldIssue(63, humanComment(72, "maintainer", "/hive decision ship it as is"))} + server, rec := newUnparkServer(t, "org", "repo", issues, map[string]string{"maintainer": "admin"}) + c := newTestClient(t, server, "org", []string{"repo"}) + + result, err := c.SweepIssueUnparkCommands(context.Background(), IssueUnparkSweepOptions{}) + if err != nil { + t.Fatalf("sweep: %v", err) + } + if len(result.Unparked) != 1 || result.Unparked[0].Number != 63 || result.Unparked[0].Decision != "ship it as is" { + t.Fatalf("a /hive decision on a held issue must still be answered, got %+v", result.Unparked) + } + if len(rec.posted[63]) != 1 || !strings.Contains(rec.posted[63][0], "Decision: ship it as is") { + t.Fatalf("expected exactly the acceptance reply, got %v", rec.posted[63]) + } + if strings.Contains(rec.posted[63][0], unparkNoticeMarker) { + t.Fatalf("the notice must not be posted on a held issue: %v", rec.posted[63]) + } + if strings.Contains(strings.Join(rec.removed[63], ","), "hold") { + t.Fatalf("hold must never be removed, got %v", rec.removed[63]) + } +} + +func TestSweepIssueUnparkCommandsHeldIssueStillAnswersHelp(t *testing.T) { + issues := []unparkWireIssue{heldIssue(64, humanComment(73, "maintainer", "/hive help"))} + server, rec := newUnparkServer(t, "org", "repo", issues, map[string]string{"maintainer": "admin"}) + c := newTestClient(t, server, "org", []string{"repo"}) + + result, err := c.SweepIssueUnparkCommands(context.Background(), IssueUnparkSweepOptions{}) + if err != nil { + t.Fatalf("sweep: %v", err) + } + if result.Replies != 1 || len(rec.posted[64]) != 1 { + t.Fatalf("expected one help reply, replies=%d posted=%v", result.Replies, rec.posted[64]) } - if !hasIssueParkingLabel([]string{"needs-human", HumanAckLabel, NeedsDecisionStageLabel}) { - t.Fatal("a stage/045 park label keeps the issue parked") + if strings.Contains(rec.posted[64][0], unparkNoticeMarker) { + t.Fatalf("the help reply must be the only comment, got %v", rec.posted[64]) } }