From 88d389b66b0103a8893f547c91ba7a40a9f38086 Mon Sep 17 00:00:00 2001 From: Danathar Date: Sat, 7 Nov 2026 11:13:16 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(unpark):=20a=20re-parked=20o?= =?UTF-8?q?wner=20step=20recommends=20/hive=20done,=20not=20the=20/hive=20?= =?UTF-8?q?approve=20that=20looped?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An owner step the hive parks again after an accepted reply is now read from its own text, so the issue body's answered recommendation no longer keeps /hive approve bolded. /hive done is the recommended reply when the owner-step text asks for it or when an accepted /hive approve already answered the same step; /hive approve is dropped there, and a second approve gets a reply pointing at /hive done while the issue stays parked. Lane policies now ask for -R (or the web path) on every gh command handed to the owner, so it works outside a clone. Refs Danathar/goodreads-mcp#443 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- .../fixed-owner-step-menu-recommends-done.md | 1 + src/docs/maintainer-commands.md | 9 ++ src/pkg/github/issue_unpark_command.go | 56 +++++-- src/pkg/github/issue_unpark_menu.go | 89 ++++++++++- .../github/issue_unpark_notice_last_test.go | 7 +- .../issue_unpark_owner_step_reapprove_test.go | 138 ++++++++++++++++++ src/pkg/policies/defaults/architect-full.md | 4 + .../policies/defaults/architect-holdgated.md | 4 + .../defaults/ci-maintainer-advisory.md | 2 +- .../policies/defaults/ci-maintainer-full.md | 4 + .../defaults/ci-maintainer-holdgated.md | 4 + src/pkg/policies/defaults/ci-maintainer.md | 2 +- src/pkg/policies/defaults/guide-full.md | 4 + src/pkg/policies/defaults/guide-holdgated.md | 4 + src/pkg/policies/defaults/guide-issues.md | 4 + src/pkg/policies/defaults/guide.md | 2 +- src/pkg/policies/defaults/outreach-full.md | 4 + src/pkg/policies/defaults/quality-full.md | 4 + .../policies/defaults/quality-holdgated.md | 4 + src/pkg/policies/defaults/quality-measured.md | 4 + src/pkg/policies/defaults/scanner-advisory.md | 2 +- .../policies/defaults/scanner-automerge.md | 4 + src/pkg/policies/defaults/scanner-full.md | 4 + .../policies/defaults/scanner-holdgated.md | 4 + src/pkg/policies/defaults/scanner-issues.md | 4 + src/pkg/policies/defaults/scanner.md | 2 +- src/pkg/policies/defaults/sec-check-full.md | 4 + .../policies/defaults/sec-check-holdgated.md | 4 + src/pkg/policies/defaults/strategist-full.md | 4 + .../policies/defaults/strategist-holdgated.md | 4 + .../policies/needs_decision_filing_test.go | 10 ++ src/policies/architect-full.md | 4 + src/policies/architect-holdgated.md | 4 + src/policies/ci-maintainer-advisory.md | 2 +- src/policies/ci-maintainer-full.md | 4 + src/policies/ci-maintainer-holdgated.md | 4 + src/policies/ci-maintainer.md | 2 +- src/policies/guide-full.md | 4 + src/policies/guide-holdgated.md | 4 + src/policies/guide-issues.md | 4 + src/policies/guide.md | 2 +- src/policies/outreach-full.md | 4 + src/policies/quality-full.md | 4 + src/policies/quality-holdgated.md | 4 + src/policies/quality-measured.md | 4 + src/policies/scanner-advisory.md | 2 +- src/policies/scanner-automerge.md | 4 + src/policies/scanner-full.md | 4 + src/policies/scanner-holdgated.md | 4 + src/policies/scanner-issues.md | 4 + src/policies/scanner.md | 2 +- src/policies/sec-check-full.md | 4 + src/policies/sec-check-holdgated.md | 4 + src/policies/strategist-full.md | 4 + src/policies/strategist-holdgated.md | 4 + 55 files changed, 449 insertions(+), 33 deletions(-) create mode 100644 changelog.d/fixed-owner-step-menu-recommends-done.md create mode 100644 src/pkg/github/issue_unpark_owner_step_reapprove_test.go diff --git a/changelog.d/fixed-owner-step-menu-recommends-done.md b/changelog.d/fixed-owner-step-menu-recommends-done.md new file mode 100644 index 0000000000..dcd6ed1587 --- /dev/null +++ b/changelog.d/fixed-owner-step-menu-recommends-done.md @@ -0,0 +1 @@ +- Fix the "What to reply" notice on a re-parked owner step recommending `/hive approve` again after an accepted `/hive approve` did not do the step, which looped: it now recommends `/hive done` when the owner step asks for it or approve already answered that step, drops `/hive approve` on such a step, and a second `/hive approve` there gets a reply pointing at `/hive done`. Lane policies now ask for `-R ` on every `gh` command handed to the owner (Danathar/goodreads-mcp#443). diff --git a/src/docs/maintainer-commands.md b/src/docs/maintainer-commands.md index cc0b7270f6..fd4d951593 100644 --- a/src/docs/maintainer-commands.md +++ b/src/docs/maintainer-commands.md @@ -82,6 +82,15 @@ recommendation; the issue stays parked. On a `blocked` park and on an owner step `/hive approve` keeps its meaning (the blocker is cleared; accept the proposed step) and needs no recommendation. +On an owner step, `/hive done` is the recommended reply when the owner-step +text asks for it, or when an accepted `/hive approve` already answered the +same step and an agent parked the issue again (approving cannot do a step only +the owner can take). A step parked again after an accepted reply is read from +its own text: the options and recommendation that reply answered do not carry +over. On a step `/hive approve` already answered, the notice drops +`/hive approve`, and a second `/hive approve` gets a reply pointing at +`/hive done`; the issue stays parked (Danathar/goodreads-mcp#443). + The notice is always the newest comment on a parked issue. While nothing newer is posted it is edited in place when the options change; once a later comment pushes it up the thread (an agent's new owner step, a question, a re-check diff --git a/src/pkg/github/issue_unpark_command.go b/src/pkg/github/issue_unpark_command.go index 702cd146a8..c0a9e106e9 100644 --- a/src/pkg/github/issue_unpark_command.go +++ b/src/pkg/github/issue_unpark_command.go @@ -602,6 +602,17 @@ func (c *Client) tryUnparkIssue(ctx context.Context, displayRepo, owner, repo st // Approve needs no recommendation on a `blocked` park, where it means // "the blocker is cleared" (hivecommons/hive#12376), or on an owner // step, where it accepts the step the hive proposed. + // An owner step an accepted `/hive approve` already answered, parked + // again, is not answered by a second approve: it would un-park the + // issue only for the agent to park it once more. + if command.Kind == unparkCommandApprove && !(releasePolicy.enabled && menu.releaseStep != nil) && (!labelDriven || la.enabled) && + menu.ownerStep && menu.approveAnswered { + if err := c.postUnparkReply(ctx, owner, repo, number, candidate.GetID(), unparkApproveAnsweredReply); err != nil { + return false, err + } + result.Replies++ + return true, nil + } if command.Kind == unparkCommandApprove && !(releasePolicy.enabled && menu.releaseStep != nil) && (!labelDriven || la.enabled) && !menu.ownerStep && menu.releaseStep == nil && !unparkTextsProposeOwnerStep(issue, comments) && !labelPresent(issueLabelNames(issue.Labels), issueBlockedLabel) { decision, ok := menu.approveDecision() @@ -1143,24 +1154,45 @@ func (c *Client) answeredUnparkCommentIDs(comments []*gh.IssueComment) map[int64 if cm == nil || !c.markerAuthorTrusted(cm.GetUser()) { continue } - body := cm.GetBody() - idx := strings.Index(body, unparkReplyMarkerPrefix) - if idx < 0 { - continue - } - rest := body[idx+len(unparkReplyMarkerPrefix):] - end := strings.Index(rest, " ") - if end < 0 { - continue - } - var id int64 - if _, err := fmt.Sscanf(rest[:end], "%d", &id); err == nil && id > 0 { + if id := unparkReplyAnsweredID(cm.GetBody()); id > 0 { answered[id] = true } } return answered } +// unparkReplyAnsweredID reads the comment ID a hive reply's marker names, +// or 0 when body carries no well-formed reply marker. +func unparkReplyAnsweredID(body string) int64 { + idx := strings.Index(body, unparkReplyMarkerPrefix) + if idx < 0 { + return 0 + } + rest := body[idx+len(unparkReplyMarkerPrefix):] + end := strings.Index(rest, " ") + if end < 0 { + return 0 + } + var id int64 + if _, err := fmt.Sscanf(rest[:end], "%d", &id); err != nil || id <= 0 { + return 0 + } + return id +} + +// unparkReplyAnswersApprove reports whether the hive reply body answers a +// `/hive approve` command: the comment its marker names, read from byID, +// carries one. A reply whose command comment is not in byID (deleted, or +// a dashboard release with no marker) does not count. +func (c *Client) unparkReplyAnswersApprove(body string, byID map[int64]*gh.IssueComment) bool { + cm := byID[unparkReplyAnsweredID(body)] + if cm == nil || c.isHiveAccount(cm.GetUser()) { + return false + } + cmd, ok := parseUnparkCommand(cm.GetBody()) + return ok && cmd.Kind == unparkCommandApprove +} + // unparkCandidateLimit bounds the permission lookups one issue can cost in a // single pass. A maintainer's instruction is always among the last few // comments; anything older has had cycles to be answered already. diff --git a/src/pkg/github/issue_unpark_menu.go b/src/pkg/github/issue_unpark_menu.go index 76edcd0ec7..79e55e3915 100644 --- a/src/pkg/github/issue_unpark_menu.go +++ b/src/pkg/github/issue_unpark_menu.go @@ -58,6 +58,27 @@ type unparkMenu struct { // whether `/hive approve` may execute it; without that opt-in it remains // descriptive metadata and the legacy manual-step menu is unchanged. releaseStep *IssueOwnerStep + // asksDone is true when the owner-step text itself asks the owner to + // reply `/hive done`; that reply is then the recommended one. + asksDone bool + // approveAnswered is true when an accepted `/hive approve` already + // answered this same owner step and the hive parked it again: approving + // did not do the step, so the menu recommends `/hive done` and offers + // no `/hive approve` (Danathar/goodreads-mcp#443). + approveAnswered bool +} + +// doneRecommended reports whether `/hive done` is the recommended reply: +// the issue waits on an owner step that either asks for `/hive done` or +// was already approved once without being done. +func (m unparkMenu) doneRecommended() bool { + return m.ownerStep && (m.asksDone || m.approveAnswered) +} + +// unparkAsksDone reports whether park text asks the owner to reply +// `/hive done`. +func unparkAsksDone(text string) bool { + return strings.Contains(strings.ToLower(text), "/hive done") } // unparkMenuFromBody reads the menu from the issue body alone. An issue @@ -73,6 +94,7 @@ func unparkMenuFromBody(issueBody string) unparkMenu { m.ownerStep = isUnparkOwnerStepText(issueBody) if m.ownerStep { m.releaseStep = parseIssueOwnerStep(issueBody) + m.asksDone = unparkAsksDone(issueBody) } return m } @@ -92,18 +114,38 @@ func isUnparkOwnerStepText(text string) bool { // recommended option is read from the newest text that states a // recommendation, so a body-level recommendation is never pinned onto // options a later comment listed. +// +// An owner step the hive parks again after an accepted reply answered the +// earlier ask is read from its own text: the earlier options and +// recommendation were answered, so they do not carry over. When the +// accepted reply was a `/hive approve` on the same owner step, approving did +// not do it, and the menu says so (approveAnswered). func (c *Client) unparkMenuFor(issueBody string, issueAuthor *gh.User, comments []*gh.IssueComment) unparkMenu { m := unparkMenuFromBody(issueBody) if !c.isHiveAccount(issueAuthor) { // Only a hive-authored body can park the issue on an owner step; the // author of any other issue could otherwise edit the marker in. - m.ownerStep, m.releaseStep = false, nil + m.ownerStep, m.releaseStep, m.asksDone = false, nil, false } recommendationSource := "" if m.hasRecommendation { recommendationSource = issueBody } ownerStep := m.ownerStep + // pendingStep is the marker of the newest unanswered owner step; + // approvedStep is the marker of the owner step an accepted `/hive + // approve` answered. answered is true from an accepted reply until the + // next owner-step park. + pendingStep, approvedStep, answered := "", "", false + if ownerStep { + pendingStep = ownerStepMarkerRE.FindString(issueBody) + } + byID := make(map[int64]*gh.IssueComment, len(comments)) + for _, cm := range comments { + if cm != nil && cm.GetID() != 0 { + byID[cm.GetID()] = cm + } + } for _, cm := range comments { if cm == nil || !c.isHiveAccount(cm.GetUser()) { continue @@ -113,8 +155,12 @@ func (c *Client) unparkMenuFor(issueBody string, issueAuthor *gh.User, comments // Accepted command replies and dashboard release replies both // answer the step. Only command replies carry a per-comment // unparkReplyMarkerPrefix. - ownerStep = false + if ownerStep && pendingStep != "" && c.unparkReplyAnswersApprove(body, byID) { + approvedStep = pendingStep + } + ownerStep, pendingStep, answered = false, "", true m.releaseStep = nil + m.asksDone, m.approveAnswered = false, false m.landedBy = "" continue } @@ -132,8 +178,9 @@ func (c *Client) unparkMenuFor(issueBody string, issueAuthor *gh.User, comments if strings.Contains(body, parkWithdrawnMarkerPrefix) { // The agent took its ask back: its options and recommendation // go with it, so a later park starts from its own text. - ownerStep = false + ownerStep, pendingStep = false, "" m.releaseStep = nil + m.asksDone, m.approveAnswered = false, false m.options, m.optionText, m.optionSource, m.optionsFromBody = nil, nil, "", false m.hasRecommendation, recommendationSource = false, "" continue @@ -152,9 +199,20 @@ func (c *Client) unparkMenuFor(issueBody string, issueAuthor *gh.User, comments if hasOwnerStepMarker(body) { ownerStep = isUnparkOwnerStepText(body) m.releaseStep = nil + m.asksDone, m.approveAnswered, pendingStep = false, false, "" if ownerStep { m.releaseStep = parseIssueOwnerStep(body) + pendingStep = ownerStepMarkerRE.FindString(body) + m.asksDone = unparkAsksDone(body) + m.approveAnswered = approvedStep != "" && pendingStep == approvedStep + if answered { + // A re-park after an answered ask: what was answered + // does not carry over to the new step. + m.options, m.optionText, m.optionSource, m.optionsFromBody = nil, nil, "", false + m.hasRecommendation, recommendationSource = false, "" + } } + answered = false } if opts := unparkOptionLabels(body); len(opts) > 0 { m.options = opts @@ -214,15 +272,24 @@ func (m unparkMenu) replies(releaseOnApprove bool) []unparkReply { if m.landedBy != "" { out = append(out, unparkReply{command: "/fixed", does: "the change this issue asks for already landed in " + m.landedBy + "; close it as completed", recommended: true}) } + doneFirst := m.doneRecommended() if m.ownerStep { - add("/hive done", "you did the step only you can do; Hive re-checks it and closes the issue once it is verified", false) + add("/hive done", "you did the step only you can do; Hive re-checks it and closes the issue once it is verified", doneFirst) + } + // addApprove offers `/hive approve`; it is never the recommended reply + // when `/hive done` is. + addApprove := func(does string, recommended bool) { + add("/hive approve", does, recommended && !doneFirst) } switch { case releaseOnApprove && m.releaseStep != nil: add("/hive approve", fmt.Sprintf("Hive creates release `%s` from `%s`", m.releaseStep.Tag, m.releaseStep.Target), false) add("/hive decision ", "go ahead, following your instructions", false) + case m.ownerStep && m.approveAnswered: + // `/hive approve` already answered this step and did not do it. + add("/hive decision ", "go ahead, following your instructions", false) case len(m.options) > 0 && m.recommended != "": - add("/hive approve", "go with the recommendation (option "+m.recommended+")"+m.summaryFor(m.recommended), true) + addApprove("go with the recommendation (option "+m.recommended+")"+m.summaryFor(m.recommended), true) for _, opt := range m.options { if opt == m.recommended { continue @@ -233,18 +300,18 @@ func (m unparkMenu) replies(releaseOnApprove bool) []unparkReply { // A recommendation is stated but names none of the listed options, // so no option is attributed to it; every option stays an explicit // decision. - add("/hive approve", "go with the recommendation", true) + addApprove("go with the recommendation", true) for _, opt := range m.options { add("/hive decision "+opt, "go with option "+opt+m.summaryFor(opt), false) } case len(m.options) > 0: first := m.options[0] - add("/hive approve", "go with option "+first+m.summaryFor(first), false) + addApprove("go with option "+first+m.summaryFor(first), false) for _, opt := range m.options[1:] { add("/hive decision "+opt, "go with option "+opt+m.summaryFor(opt), false) } case m.hasRecommendation: - add("/hive approve", "go with the recommendation", true) + addApprove("go with the recommendation", true) add("/hive decision ", "go ahead, following your instructions", false) default: add("/hive decision ", "go ahead, following your instructions", false) @@ -298,6 +365,12 @@ func (m unparkMenu) approveDecision() (string, bool) { return "", false } +// unparkApproveAnsweredReply answers `/hive approve` on an owner step an +// earlier `/hive approve` already answered: the hive parked it again because +// approving does not do a step only the owner can take, so a second approve +// would only repeat the loop (Danathar/goodreads-mcp#443). +const unparkApproveAnsweredReply = "`/hive approve` was already accepted for this step, and the hive parked the issue again because approving does not do a step only you can take. The issue stays parked. Do the step the newest park comment names, then reply `/hive done`; or reply `/hive decision ` to un-park it with your own instructions, or `/hive help` for the commands." + // unparkApproveNothingReply answers `/hive approve` on a park with no // recommendation and no options; the park stays. const unparkApproveNothingReply = "`/hive approve` accepts the recommendation a park names, and this one names none: neither the issue nor the hive's comments on it recommend an option. The issue stays parked. Reply `/hive decision ` to un-park it with your own instructions, or `/hive help` for the commands." diff --git a/src/pkg/github/issue_unpark_notice_last_test.go b/src/pkg/github/issue_unpark_notice_last_test.go index f0bc183018..22c310f1fd 100644 --- a/src/pkg/github/issue_unpark_notice_last_test.go +++ b/src/pkg/github/issue_unpark_notice_last_test.go @@ -51,8 +51,9 @@ func TestUnparkNoticeMovesBelowAgentOwnerStep(t *testing.T) { if len(posted) != 1 { t.Fatalf("want one fresh notice below the owner step, got %v", rec.posted[12]) } - if !strings.Contains(posted[0], "> - `/hive done` →") { - t.Fatalf("the fresh notice should offer the owner step's /hive done, got %q", posted[0]) + // The owner step asks for `/hive done`, so that is the recommended reply. + if !strings.Contains(posted[0], "> - **`/hive done` →") || strings.Contains(posted[0], "**`/hive approve`") { + t.Fatalf("the fresh notice should recommend the owner step's /hive done, got %q", posted[0]) } if len(rec.deleted) != 1 || rec.deleted[0] != 61 { t.Fatalf("the buried notice should be deleted, got %v", rec.deleted) @@ -131,7 +132,7 @@ func TestUnparkNoticeMoveHonoursWritebackGate(t *testing.T) { if len(rec.posted[18]) != 0 || len(rec.deleted) != 0 { t.Fatalf("a refused gate must not move the notice: posted=%v deleted=%v", rec.posted[18], rec.deleted) } - if body, ok := rec.edited[72]; !ok || !strings.Contains(body, "> - `/hive done` →") { + if body, ok := rec.edited[72]; !ok || !strings.Contains(body, "> - **`/hive done` →") { t.Fatalf("the buried notice should still be edited in place, got %v", rec.edited) } } diff --git a/src/pkg/github/issue_unpark_owner_step_reapprove_test.go b/src/pkg/github/issue_unpark_owner_step_reapprove_test.go new file mode 100644 index 0000000000..2edc141dd3 --- /dev/null +++ b/src/pkg/github/issue_unpark_owner_step_reapprove_test.go @@ -0,0 +1,138 @@ +package github + +import ( + "context" + "strings" + "testing" + + gh "github.com/google/go-github/v72/github" +) + +// The Danathar/goodreads-mcp#443 shape: a hive-filed owner step (a typed +// release) whose body recommends running the release command, a maintainer +// `/hive approve` the hive accepted, and the architect parking the same step +// again because approving did not start the release. The re-park asks for +// `/hive done`; the notice used to keep recommending `/hive approve` off the +// body's stale "Recommendation" heading, so following it looped. +const reapproveStepMarker = "" + +const reapproveIssueBody = "**What I need from you:** Run the one command under Recommendation.\n\n" + + "## Recommendation\n\nRun the release by hand now:\n\n```bash\ngh workflow run release.yml --ref main\n```\n\n" + + reapproveStepMarker + +const reapproveRepark = "**What I need from you:** Run the command below, then reply `/hive done`.\n\n" + + "```bash\ngh workflow run release.yml --ref main\n```\n\n" + + "Approving did not start the release and this agent cannot start it.\n\n" + + reapproveStepMarker + +func reapproveComments(repark string) []*gh.IssueComment { + approve := &gh.IssueComment{ID: gh.Ptr(int64(101)), User: &gh.User{Login: gh.Ptr("owner")}, Body: gh.Ptr("/hive approve")} + accepted := &gh.IssueComment{ID: gh.Ptr(int64(102)), User: menuTestHiveUser, Body: gh.Ptr(unparkReplyMarkerPrefix + "101 -->\n" + + renderUnparkAcceptedReply("owner", "go with the recommendation", []string{issueNeedsDecisionLabel}))} + reparked := &gh.IssueComment{ID: gh.Ptr(int64(103)), User: menuTestHiveUser, Body: gh.Ptr(repark)} + return []*gh.IssueComment{approve, accepted, reparked} +} + +func TestUnparkMenuReparkedOwnerStepRecommendsDone(t *testing.T) { + c := menuTestClient() + + // Before the approve: the body's recommendation still offers approve. + first := c.unparkMenuFor(reapproveIssueBody, menuTestHiveUser, nil) + if !first.ownerStep || !strings.Contains(first.bullets(), "`/hive approve`") { + t.Fatalf("the first park offers /hive done and /hive approve:\n%s", first.bullets()) + } + + m := c.unparkMenuFor(reapproveIssueBody, menuTestHiveUser, reapproveComments(reapproveRepark)) + bullets := m.bullets() + if !m.ownerStep { + t.Fatal("the re-park is an owner step") + } + if !strings.Contains(bullets, "- **`/hive done` → ") || !strings.Contains(bullets, "(recommended)**") { + t.Fatalf("/hive done must be the recommended reply:\n%s", bullets) + } + if strings.Contains(bullets, "/hive approve") { + t.Fatalf("/hive approve already answered this step and must not be offered again:\n%s", bullets) + } + if !strings.Contains(bullets, "`/hive decision `") { + t.Fatalf("/hive decision stays available:\n%s", bullets) + } + if m.hasRecommendation { + t.Fatal("the body's answered recommendation must not carry over to the re-park") + } + + // A re-park that does not say `/hive done` still recommends it once + // approve was answered on the same step, even if it recommends something. + quiet := "I recommend running the command below yourself.\n\n```bash\ngh workflow run release.yml --ref main\n```\n\n" + reapproveStepMarker + m = c.unparkMenuFor(reapproveIssueBody, menuTestHiveUser, reapproveComments(quiet)) + if b := m.bullets(); !strings.Contains(b, "- **`/hive done`") || strings.Contains(b, "/hive approve") { + t.Fatalf("an approved-then-re-parked step recommends /hive done and drops approve:\n%s", b) + } + + // A different owner step after the approve is a new ask, so approve was + // not answered for it; it recommends `/hive done` because it asks for it. + other := strings.Replace(reapproveRepark, "tag=2026.11.0", "tag=2026.11.1", 1) + m = c.unparkMenuFor(reapproveIssueBody, menuTestHiveUser, reapproveComments(other)) + if b := m.bullets(); !strings.Contains(b, "- **`/hive done`") || strings.Contains(b, "**`/hive approve`") { + t.Fatalf("a step that asks for /hive done recommends it:\n%s", b) + } + // The same new step re-parked with a recommendation of its own still + // offers approve (it was never approved), just not as the recommendation + // when it asks for `/hive done`. + otherRec := "Recommendation: run it now, then reply `/hive done`.\n\n" + strings.Replace(reapproveStepMarker, "tag=2026.11.0", "tag=2026.11.1", 1) + if b := c.unparkMenuFor(reapproveIssueBody, menuTestHiveUser, reapproveComments(otherRec)).bullets(); !strings.Contains(b, "- `/hive approve`") || !strings.Contains(b, "- **`/hive done`") { + t.Fatalf("a new, never-approved step keeps approve on offer:\n%s", b) + } + + // An accepted `/hive decision` is not an approve: nothing is dropped + // for it, but the re-park is still read from its own text. + comments := reapproveComments(reapproveRepark) + comments[0].Body = gh.Ptr("/hive decision go ahead") + m = c.unparkMenuFor(reapproveIssueBody, menuTestHiveUser, comments) + if b := m.bullets(); !strings.Contains(b, "- **`/hive done`") || m.hasRecommendation { + t.Fatalf("decision-answered re-park recommends /hive done from its own text (hasRecommendation=%v):\n%s", m.hasRecommendation, b) + } + + // A body-level owner step that asks for `/hive done` recommends it, and + // approve is not bolded beside it. + body := ownerStepCommentBody("Recommendation: add the secret yourself, then reply `/hive done`.", true) + b := c.unparkMenuFor(body, menuTestHiveUser, nil).bullets() + if !strings.Contains(b, "- **`/hive done`") || strings.Contains(b, "**`/hive approve`") { + t.Fatalf("an owner step that asks for /hive done recommends it, not approve:\n%s", b) + } +} + +// A second `/hive approve` on the re-parked step is answered with a pointer +// to `/hive done` and leaves the issue parked, so the loop cannot restart. +func TestSweepIssueUnparkReapproveOnAnsweredOwnerStepStaysParked(t *testing.T) { + issue := unparkWireIssue{ + Number: 443, + Title: "release not published", + Body: reapproveIssueBody, + User: wireUser{Login: "hive[bot]"}, + Labels: []wireLabel{{Name: issueNeedsDecisionLabel}}, + Comments: []unparkWireComment{ + humanComment(101, "maintainer", "/hive approve"), + hiveComment(102, unparkReplyMarkerPrefix+"101 -->\n"+renderUnparkAcceptedReply("maintainer", "go with the recommendation", []string{issueNeedsDecisionLabel})), + hiveComment(103, reapproveRepark), + humanComment(104, "maintainer", "/hive approve"), + }, + } + server, rec := newUnparkServer(t, "org", "repo", []unparkWireIssue{issue}, map[string]string{"maintainer": "write"}) + c := newTestClient(t, server, "org", []string{"repo"}) + c.SetAppBotLogin("hive[bot]") + + result, err := c.SweepIssueUnparkCommands(context.Background(), IssueUnparkSweepOptions{}) + if err != nil { + t.Fatalf("sweep: %v", err) + } + if len(result.Unparked) != 0 || len(rec.removed[443]) != 0 { + t.Fatalf("a second approve on the same step must not un-park: unparked=%+v removed=%v", result.Unparked, rec.removed[443]) + } + joined := strings.Join(rec.posted[443], "\n") + if !strings.Contains(joined, unparkReplyMarkerPrefix+"104 ") || !strings.Contains(joined, "was already accepted for this step") { + t.Fatalf("expected the already-approved reply to comment 104, got %v", rec.posted[443]) + } + if strings.Contains(joined, "**`/hive approve`") { + t.Fatalf("the notice must not recommend /hive approve:\n%s", joined) + } +} diff --git a/src/pkg/policies/defaults/architect-full.md b/src/pkg/policies/defaults/architect-full.md index 6f0920b054..44fd10e826 100644 --- a/src/pkg/policies/defaults/architect-full.md +++ b/src/pkg/policies/defaults/architect-full.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/architect-holdgated.md b/src/pkg/policies/defaults/architect-holdgated.md index e40476c106..b3a44a0ffb 100644 --- a/src/pkg/policies/defaults/architect-holdgated.md +++ b/src/pkg/policies/defaults/architect-holdgated.md @@ -38,6 +38,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/ci-maintainer-advisory.md b/src/pkg/policies/defaults/ci-maintainer-advisory.md index a5379a3852..5b375d69be 100644 --- a/src/pkg/policies/defaults/ci-maintainer-advisory.md +++ b/src/pkg/policies/defaults/ci-maintainer-advisory.md @@ -123,7 +123,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Workflow diff --git a/src/pkg/policies/defaults/ci-maintainer-full.md b/src/pkg/policies/defaults/ci-maintainer-full.md index 76d0aaa3d0..cb758111c3 100644 --- a/src/pkg/policies/defaults/ci-maintainer-full.md +++ b/src/pkg/policies/defaults/ci-maintainer-full.md @@ -44,6 +44,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/ci-maintainer-holdgated.md b/src/pkg/policies/defaults/ci-maintainer-holdgated.md index 52938b3c18..e6ce7c8a76 100644 --- a/src/pkg/policies/defaults/ci-maintainer-holdgated.md +++ b/src/pkg/policies/defaults/ci-maintainer-holdgated.md @@ -43,6 +43,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/ci-maintainer.md b/src/pkg/policies/defaults/ci-maintainer.md index 6cc42b6294..c79b83909c 100644 --- a/src/pkg/policies/defaults/ci-maintainer.md +++ b/src/pkg/policies/defaults/ci-maintainer.md @@ -29,7 +29,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Shared CI Baseline Triage (MANDATORY) diff --git a/src/pkg/policies/defaults/guide-full.md b/src/pkg/policies/defaults/guide-full.md index 19c4d6f0ed..f4efcb1676 100644 --- a/src/pkg/policies/defaults/guide-full.md +++ b/src/pkg/policies/defaults/guide-full.md @@ -38,6 +38,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/guide-holdgated.md b/src/pkg/policies/defaults/guide-holdgated.md index 70c913d72a..e86c9875a2 100644 --- a/src/pkg/policies/defaults/guide-holdgated.md +++ b/src/pkg/policies/defaults/guide-holdgated.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/guide-issues.md b/src/pkg/policies/defaults/guide-issues.md index 429d0701ee..1ebdd3331a 100644 --- a/src/pkg/policies/defaults/guide-issues.md +++ b/src/pkg/policies/defaults/guide-issues.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/guide.md b/src/pkg/policies/defaults/guide.md index ef3c16745e..ec1abb4762 100644 --- a/src/pkg/policies/defaults/guide.md +++ b/src/pkg/policies/defaults/guide.md @@ -30,7 +30,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Surge-coach lens (flow health) diff --git a/src/pkg/policies/defaults/outreach-full.md b/src/pkg/policies/defaults/outreach-full.md index dcc4519f9e..df691b522b 100644 --- a/src/pkg/policies/defaults/outreach-full.md +++ b/src/pkg/policies/defaults/outreach-full.md @@ -161,6 +161,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/quality-full.md b/src/pkg/policies/defaults/quality-full.md index 75ca0ea1a5..2cadf9ef1e 100644 --- a/src/pkg/policies/defaults/quality-full.md +++ b/src/pkg/policies/defaults/quality-full.md @@ -292,6 +292,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/quality-holdgated.md b/src/pkg/policies/defaults/quality-holdgated.md index 9fdc69b5ba..61570d24f2 100644 --- a/src/pkg/policies/defaults/quality-holdgated.md +++ b/src/pkg/policies/defaults/quality-holdgated.md @@ -339,6 +339,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/quality-measured.md b/src/pkg/policies/defaults/quality-measured.md index 3324098842..0dde91374d 100644 --- a/src/pkg/policies/defaults/quality-measured.md +++ b/src/pkg/policies/defaults/quality-measured.md @@ -222,6 +222,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/scanner-advisory.md b/src/pkg/policies/defaults/scanner-advisory.md index aa3e3e343f..87efe26fa1 100644 --- a/src/pkg/policies/defaults/scanner-advisory.md +++ b/src/pkg/policies/defaults/scanner-advisory.md @@ -39,7 +39,7 @@ Record each analysis as a bead. The bead title should be a one-line diagnosis, n only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Analyzing PRs diff --git a/src/pkg/policies/defaults/scanner-automerge.md b/src/pkg/policies/defaults/scanner-automerge.md index 3cd1ff8f50..cd796d1b39 100644 --- a/src/pkg/policies/defaults/scanner-automerge.md +++ b/src/pkg/policies/defaults/scanner-automerge.md @@ -142,6 +142,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/scanner-full.md b/src/pkg/policies/defaults/scanner-full.md index 33c6e7a3d2..a61ac3dc3b 100644 --- a/src/pkg/policies/defaults/scanner-full.md +++ b/src/pkg/policies/defaults/scanner-full.md @@ -139,6 +139,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/scanner-holdgated.md b/src/pkg/policies/defaults/scanner-holdgated.md index 6e9526ba36..34022765b4 100644 --- a/src/pkg/policies/defaults/scanner-holdgated.md +++ b/src/pkg/policies/defaults/scanner-holdgated.md @@ -144,6 +144,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/scanner-issues.md b/src/pkg/policies/defaults/scanner-issues.md index 6d2af94ce0..f9db1b2bef 100644 --- a/src/pkg/policies/defaults/scanner-issues.md +++ b/src/pkg/policies/defaults/scanner-issues.md @@ -97,6 +97,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/scanner.md b/src/pkg/policies/defaults/scanner.md index aeb829cc5a..0c4747332a 100644 --- a/src/pkg/policies/defaults/scanner.md +++ b/src/pkg/policies/defaults/scanner.md @@ -34,7 +34,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Shared CI Baseline Triage (MANDATORY) diff --git a/src/pkg/policies/defaults/sec-check-full.md b/src/pkg/policies/defaults/sec-check-full.md index af0cfa1c03..3d57e20f7b 100644 --- a/src/pkg/policies/defaults/sec-check-full.md +++ b/src/pkg/policies/defaults/sec-check-full.md @@ -38,6 +38,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/sec-check-holdgated.md b/src/pkg/policies/defaults/sec-check-holdgated.md index bd50b012b1..eff0d3d38b 100644 --- a/src/pkg/policies/defaults/sec-check-holdgated.md +++ b/src/pkg/policies/defaults/sec-check-holdgated.md @@ -50,6 +50,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/strategist-full.md b/src/pkg/policies/defaults/strategist-full.md index 6c5e8be6e1..f51c5bcf3c 100644 --- a/src/pkg/policies/defaults/strategist-full.md +++ b/src/pkg/policies/defaults/strategist-full.md @@ -40,6 +40,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/defaults/strategist-holdgated.md b/src/pkg/policies/defaults/strategist-holdgated.md index 06f08a925b..7f541f8a53 100644 --- a/src/pkg/policies/defaults/strategist-holdgated.md +++ b/src/pkg/policies/defaults/strategist-holdgated.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/pkg/policies/needs_decision_filing_test.go b/src/pkg/policies/needs_decision_filing_test.go index a65b43a48a..f6cff7c91e 100644 --- a/src/pkg/policies/needs_decision_filing_test.go +++ b/src/pkg/policies/needs_decision_filing_test.go @@ -55,6 +55,11 @@ func TestLanePoliciesParkOwnerOnlyHandOffs(t *testing.T) { rule := []byte("**Park an existing issue when only the owner can finish it.**") command := []byte("`hive-open-issue comment --repo --body-file --needs-decision`") releaseCommand := []byte("`--step-kind release --release-tag --release-target `") + // A command handed to the owner must work outside a clone of the repo: + // `gh workflow run release.yml --ref main` without -R fails anywhere + // else (Danathar/goodreads-mcp#443). + repoFlag := []byte("`gh` command `-R `") + beadRepoFlag := []byte("(each `gh` command with `-R `)") entries, err := fs.ReadDir(DefaultPolicies, "defaults") if err != nil { @@ -78,6 +83,8 @@ func TestLanePoliciesParkOwnerOnlyHandOffs(t *testing.T) { // Lanes that cannot comment record the step in the bead instead. if !bytes.Contains(data, []byte("**Owner-only steps.**")) { t.Errorf("%s has no owner-only rule", e.Name()) + } else if !bytes.Contains(data, beadRepoFlag) { + t.Errorf("%s does not ask for -R on the owner's gh commands", e.Name()) } continue } @@ -91,6 +98,9 @@ func TestLanePoliciesParkOwnerOnlyHandOffs(t *testing.T) { if !bytes.Contains(data, rule) || !bytes.Contains(data, command) || !bytes.Contains(data, releaseCommand) { t.Errorf("%s lacks the owner-only park rule naming %s and the typed release flags %s", e.Name(), command, releaseCommand) } + if !bytes.Contains(data, repoFlag) { + t.Errorf("%s does not ask for -R on the owner's gh commands", e.Name()) + } } if checked == 0 { t.Fatal("no lane policies found; the guard would pass vacuously") diff --git a/src/policies/architect-full.md b/src/policies/architect-full.md index 6f0920b054..44fd10e826 100644 --- a/src/policies/architect-full.md +++ b/src/policies/architect-full.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/architect-holdgated.md b/src/policies/architect-holdgated.md index e40476c106..b3a44a0ffb 100644 --- a/src/policies/architect-holdgated.md +++ b/src/policies/architect-holdgated.md @@ -38,6 +38,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/ci-maintainer-advisory.md b/src/policies/ci-maintainer-advisory.md index a5379a3852..5b375d69be 100644 --- a/src/policies/ci-maintainer-advisory.md +++ b/src/policies/ci-maintainer-advisory.md @@ -123,7 +123,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Workflow diff --git a/src/policies/ci-maintainer-full.md b/src/policies/ci-maintainer-full.md index 76d0aaa3d0..cb758111c3 100644 --- a/src/policies/ci-maintainer-full.md +++ b/src/policies/ci-maintainer-full.md @@ -44,6 +44,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/ci-maintainer-holdgated.md b/src/policies/ci-maintainer-holdgated.md index 52938b3c18..e6ce7c8a76 100644 --- a/src/policies/ci-maintainer-holdgated.md +++ b/src/policies/ci-maintainer-holdgated.md @@ -43,6 +43,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/ci-maintainer.md b/src/policies/ci-maintainer.md index 6cc42b6294..c79b83909c 100644 --- a/src/policies/ci-maintainer.md +++ b/src/policies/ci-maintainer.md @@ -29,7 +29,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Shared CI Baseline Triage (MANDATORY) diff --git a/src/policies/guide-full.md b/src/policies/guide-full.md index 19c4d6f0ed..f4efcb1676 100644 --- a/src/policies/guide-full.md +++ b/src/policies/guide-full.md @@ -38,6 +38,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/guide-holdgated.md b/src/policies/guide-holdgated.md index 70c913d72a..e86c9875a2 100644 --- a/src/policies/guide-holdgated.md +++ b/src/policies/guide-holdgated.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/guide-issues.md b/src/policies/guide-issues.md index 429d0701ee..1ebdd3331a 100644 --- a/src/policies/guide-issues.md +++ b/src/policies/guide-issues.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/guide.md b/src/policies/guide.md index ef3c16745e..ec1abb4762 100644 --- a/src/policies/guide.md +++ b/src/policies/guide.md @@ -30,7 +30,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Surge-coach lens (flow health) diff --git a/src/policies/outreach-full.md b/src/policies/outreach-full.md index dcc4519f9e..df691b522b 100644 --- a/src/policies/outreach-full.md +++ b/src/policies/outreach-full.md @@ -161,6 +161,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/quality-full.md b/src/policies/quality-full.md index 75ca0ea1a5..2cadf9ef1e 100644 --- a/src/policies/quality-full.md +++ b/src/policies/quality-full.md @@ -292,6 +292,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/quality-holdgated.md b/src/policies/quality-holdgated.md index 9fdc69b5ba..61570d24f2 100644 --- a/src/policies/quality-holdgated.md +++ b/src/policies/quality-holdgated.md @@ -339,6 +339,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/quality-measured.md b/src/policies/quality-measured.md index 3324098842..0dde91374d 100644 --- a/src/policies/quality-measured.md +++ b/src/policies/quality-measured.md @@ -222,6 +222,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/scanner-advisory.md b/src/policies/scanner-advisory.md index aa3e3e343f..87efe26fa1 100644 --- a/src/policies/scanner-advisory.md +++ b/src/policies/scanner-advisory.md @@ -39,7 +39,7 @@ Record each analysis as a bead. The bead title should be a one-line diagnosis, n only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Analyzing PRs diff --git a/src/policies/scanner-automerge.md b/src/policies/scanner-automerge.md index 3cd1ff8f50..cd796d1b39 100644 --- a/src/policies/scanner-automerge.md +++ b/src/policies/scanner-automerge.md @@ -142,6 +142,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/scanner-full.md b/src/policies/scanner-full.md index 33c6e7a3d2..a61ac3dc3b 100644 --- a/src/policies/scanner-full.md +++ b/src/policies/scanner-full.md @@ -139,6 +139,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/scanner-holdgated.md b/src/policies/scanner-holdgated.md index 6e9526ba36..34022765b4 100644 --- a/src/policies/scanner-holdgated.md +++ b/src/policies/scanner-holdgated.md @@ -144,6 +144,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/scanner-issues.md b/src/policies/scanner-issues.md index 6d2af94ce0..f9db1b2bef 100644 --- a/src/policies/scanner-issues.md +++ b/src/policies/scanner-issues.md @@ -97,6 +97,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/scanner.md b/src/policies/scanner.md index aeb829cc5a..0c4747332a 100644 --- a/src/policies/scanner.md +++ b/src/policies/scanner.md @@ -34,7 +34,7 @@ Follow ADR-0019 when an item is stalled (any `hold` for more than 48h, or at lea only the owner can take (repository settings, rulesets, branch protection, secrets, app installs, billing, or anything else agents are barred from), say so in the bead title and put the exact command or step the owner must run in -the bead, so it is clear the issue waits on a person rather than on an agent. +the bead (each `gh` command with `-R `), so it is clear the issue waits on a person rather than on an agent. You cannot park issues at this level. ## Shared CI Baseline Triage (MANDATORY) diff --git a/src/policies/sec-check-full.md b/src/policies/sec-check-full.md index af0cfa1c03..3d57e20f7b 100644 --- a/src/policies/sec-check-full.md +++ b/src/policies/sec-check-full.md @@ -38,6 +38,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/sec-check-holdgated.md b/src/policies/sec-check-holdgated.md index bd50b012b1..eff0d3d38b 100644 --- a/src/policies/sec-check-holdgated.md +++ b/src/policies/sec-check-holdgated.md @@ -50,6 +50,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/strategist-full.md b/src/policies/strategist-full.md index 6c5e8be6e1..f51c5bcf3c 100644 --- a/src/policies/strategist-full.md +++ b/src/policies/strategist-full.md @@ -40,6 +40,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag diff --git a/src/policies/strategist-holdgated.md b/src/policies/strategist-holdgated.md index 06f08a925b..7f541f8a53 100644 --- a/src/policies/strategist-holdgated.md +++ b/src/policies/strategist-holdgated.md @@ -39,6 +39,10 @@ command or step the owner must run, and park the issue in the same request: When that owner-only remainder is a release, the same command MUST include `--step-kind release --release-tag --release-target ` so Hive keeps the typed release step in "Your turn" until the owner answers. +Write every command you ask the owner to run so it works from any +directory: give each `gh` command `-R ` (for example +`gh workflow run release.yml -R --ref main`), or name the web +path instead (Actions → → Run workflow). Hive applies its configured needs-decision label itself, so the issue leaves the work queue and reaches the owner's "Your turn" inbox. The label relay refuses `needs-human` and `needs-decision` from agents, so use this flag