Skip to content

πŸ› [v6] delegate: name the option or leave the choice on an issue with competing options - #16935

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/v6-delegate-competing-options
Nov 6, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/v6-delegate-competing-options

Conversation

@Danathar

@Danathar Danathar commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary: On an issue that asks its owner to choose between options, "Let hive decide" offered a bare "Approve the direction of #N", which left the choice to whichever agent claimed it. Now, if the issue recommends one option, the hive goes with that option and names it in both the dialog and the recorded /hive decision. If it recommends none, the hive does nothing and offers Give direction.

Fixes #16934

What

projectbluefin/utah#920 asks to "Pick one:" of three ways to ship debugging tools: in the image, a ujust recipe, or a -dx flavor. Let hive decide planned Approve the direction of #920 and let the hive pick it up, under default-approve. With this change it plans one of two things:

Why

The plan sentence (api_repo_item_decide_delegated_plan.go) is the same for every issue approval. The verdict came from default-approve, whose recorded text tells the agent "where options remain, take the one that keeps work moving". No delegate rule read the options an issue lists.

How

  • github.IssueDecisionOptions reads lettered options through the same unparkMenuFor the "What to reply" notice uses, with the same parser and the same rule that the newest hive park comment wins. If there are none, it reads a numbered list, but only when the line before item 1 reads as a choice ("Pick one:", "competing", "options", "either"). utah#920's own numbered "What it cost" steps are therefore not taken as options. A numbered recommendation needs an explicit reference ("option 2", "I recommend 3"), so "saves 3 hours" doesn't count.
  • Sanitising: option summaries go through the notice's existing sanitiser, now factored out as unparkCleanOptionSummary. It strips HTML comments, defangs @mentions and cuts to one line.
  • Gathering: for an issue, the dashboard reads the comments (capped at 5 pages, and a read error falls back to the body alone) and fills Input.Options / Input.RecommendedOption.
  • delegatedecision.competingOptionsDecision runs before every approving issue rule, from flaky-test down to default-approve. Because the item no longer lands on the reversible default, the LLM decider (IsReversibleDefault) never picks an option either.
  • Glossary and docs: both new rules are in the Go glossary, the JS mirror and the glossary docs table, and the activity-monitor rules table describes them.

Files

  • src/pkg/delegatedecision/competing_options.go (new), policy.go, decision_glossary.go
  • src/pkg/github/issue_decision_options.go (new), issue_unpark_command.go (summary cleaner factored out, behaviour unchanged)
  • src/pkg/dashboard/api_repo_item_decide_delegated.go, api_repo_item_decide_delegated_plan.go, static-src/js/tracker-filter-fetch.js, static/index.html (regenerated)
  • src/docs/dashboard-sections/activity-monitor.md, src/docs/labels-and-control-signals/glossary-and-operations.md, changelog.d/fixed-delegate-competing-options.md

Tests

  • Parser: utah#920's body gives options 1, 2 and 3 from "Pick one:" and ignores its numbered steps. The contributor's 045 comment ("three competing delivery mechanisms") is read too. No options are read for: steps with no cue, a single item, a list not starting at 1, out-of-order numbers, fenced code, a cue that isn't directly before the list, or prose between items.
  • Recommendation and sanitising: an explicit reference is required, and summaries are cleaned of comments and mentions.
  • Comment precedence: a hive park comment counts; a non-hive comment, the delegate's own comment and a withdrawn ask don't.
  • Delegate rule: a refusal has no actions and survives ApplyRails. A recommendation approves and records "go with option 2: …". One option, or a recommendation of an option that isn't offered, doesn't count as a choice. The result is never IsReversibleDefault.
  • Dashboard: wording for both outcomes. On the plan endpoint, end to end: the refusal and the recommended option, with Give direction offered and nothing written. Executing the decision: the refusal writes nothing, and the recommendation posts /hive decision go with option 2: ….
  • Full suites: go test ./pkg/delegatedecision/ ./pkg/github/ ./pkg/dashboard/ all pass. go vet is clean. The docs and api-reference citation checks pass, as does the changelog guard.
  • Mutation: I disabled the rule, dropped the cue check, loosened the recommendation regex, removed the option plan sentence, unwired the dashboard input and skipped the summary sanitiser, one at a time. Each made a test fail.

Out of scope

The "What to reply" notice still offers letters only. It doesn't yet offer /hive decision 1|2|3 for numbered options.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_0113KwWU4TkJ8wfy3XjusyGo

…ompeting options

"Let hive decide" on projectbluefin/utah#920 (carry debugging tools in
the image, a ujust recipe, or a -dx flavor) planned "Approve the
direction of hivecommons#920 and let the hive pick it up" under default-approve.
That recorded no choice, so the claiming agent would pick an option
itself.

The delegate now reads the options an issue offers: the lettered options
the "What to reply" notice reads (same parser, same hive-comment
precedence), or a numbered list a choice lead-in introduces ("Pick one:",
"competing", "options"), so a numbered list of steps is not read as one.
When the same text recommends an option, it goes with that one and names
it in the plan and the recorded /hive decision (recommended-option).
When it recommends none, it writes nothing and leaves the choice to a
person, offering Give direction (competing-options).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0113KwWU4TkJ8wfy3XjusyGo
Signed-off-by: Douglas Baggett <doug.baggett@gmail.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 6, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16884 ✨ feat(adminmcp): read and act on the Activity monitor; writes run as the verified caller same files src/pkg/dashboard/api_repo_item_decide_delegated.go
#16688 🌱 Forward-merge v5 into v6 (2 commits) same files src/pkg/dashboard/static/index.html

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

docs-currency (read at head f4ec633)

The AC-required text is all present and consistent: Go glossary (decision_glossary.go:152-155), JS mirror (tracker-filter-fetch.js:105-106, regenerated index.html), glossary docs table, the activity-monitor rules table row and rule list (activity-monitor.md:720,723), and the changelog fragment.

One operator-facing text was left behind:

PolicyText still contradicts the new rule β€” src/pkg/delegatedecision/policy.go:47 reads "never ask the owner a question back. Pick the option that keeps work moving and is reversible", and the Issues: clause (policy.go:50) lists every issue rule one by one (selfreport, hive-filed proposal, hive advisory were each added as clauses when their rules landed). competing-options is a new exception to that headline β€” it hands the choice back to the owner β€” but has no clause. The header comment (policy.go:40-44) calls this "the single place the delegate's policy lives" and the docs (activity-monitor.md:707) quote it as the owner's words verbatim; it is also fed verbatim to the LLM decider (llm.go:116). The rules table now documents behaviour the policy text it claims to implement forbids.

Suggested addition at the end of the Issues: clause in policy.go:50 (before the closing .):

-… while items remain open nothing is written.
+… while items remain open nothing is written; an issue that asks its owner to choose between two or more options (lettered, or a numbered list a "Pick one:" / "competing" / "options" lead-in introduces) β†’ go with the option the issue itself recommends and name it in the recorded decision; when it recommends none, write nothing and leave the choice to the owner (Give direction).

and in activity-monitor.md:707 ("In short: …never ask the owner a question back") add ", except for a choice between options the issue does not itself recommend" so the summary matches the table row below it.

β€” hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

hivecommons-hive Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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

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

Style review (head f4ec633). No blocker from this perspective; two maintainability notes with fixes.

1. The new rule slugs escape the glossary ratchet. TestGlossaryCoversEveryRuleSlug (src/pkg/delegatedecision/decision_glossary_test.go:17-26) scans only policy.go and llm.go, and only for string literals / a fixed list of named constants. RuleRecommendedOption and RuleCompetingOptions are declared in the new competing_options.go:17-23 and used by identifier, so neither is matched β€” the entries you added to decision_glossary.go:152-155 are correct, but nothing guards them (or the JS mirror, via TestGlossaryJSONMirror) if the slug is renamed later. Cheap fix: scan the new file and the RuleXxx = "…" shape.

--- a/src/pkg/delegatedecision/decision_glossary_test.go
+++ b/src/pkg/delegatedecision/decision_glossary_test.go
@@
 		regexp.MustCompile(`\bRuleLLM\s*=\s*"([a-z0-9-]+)"`),
 		regexp.MustCompile(`\bRuleReturnToAuthor\s*=\s*"([a-z0-9-]+)"`),
+		regexp.MustCompile(`\bRule(?:RecommendedOption|CompetingOptions)\s*=\s*"([a-z0-9-]+)"`),
 	}
 	found := map[string]bool{}
-	for _, file := range []string{"policy.go", "llm.go"} {
+	for _, file := range []string{"policy.go", "llm.go", "competing_options.go"} {

2. The hive-comment precedence loop is duplicated. IssueDecisionOptions (src/pkg/github/issue_decision_options.go:31-51) re-lists the same "not park text" markers that unparkMenuFor already special-cases (issue_unpark_menu.go:104-145: accepted, recheck, reply, withdrawn, notice, delegated). The two lists agree today, but the next marker added to unparkMenuFor will silently not be skipped here and a numbered list in, say, a future notice would be read as options. A small shared predicate keeps them in step:

--- a/src/pkg/github/issue_unpark_menu.go
+++ b/src/pkg/github/issue_unpark_menu.go
@@
+// unparkIsHiveNoticeText reports a hive comment that is never park text:
+// the notice, a command reply, an accepted reply, the re-check note or the
+// delegate's verdict. Options and recommendations are not read from it.
+func unparkIsHiveNoticeText(body string) bool {
+	return strings.Contains(body, unparkNoticeMarker) || strings.Contains(body, unparkReplyMarkerPrefix) ||
+		strings.Contains(body, unparkAcceptedMarker) || strings.Contains(body, parkRecheckMarker) ||
+		delegatedecision.IsDelegatedComment(body)
+}
--- a/src/pkg/github/issue_decision_options.go
+++ b/src/pkg/github/issue_decision_options.go
@@
 		switch {
 		case strings.Contains(body, parkWithdrawnMarkerPrefix):
 			source = ""
-		case strings.Contains(body, unparkNoticeMarker), strings.Contains(body, unparkReplyMarkerPrefix),
-			strings.Contains(body, unparkAcceptedMarker), strings.Contains(body, parkRecheckMarker),
-			delegatedecision.IsDelegatedComment(body):
+		case unparkIsHiveNoticeText(body):
 		case numberedDecisionOptions(body) != nil:

Nit, same file line 101: im[1] != string(rune('1'+len(opts))) reads as a puzzle; im[1] != strconv.Itoa(len(opts)+1) says what it checks.

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 adjudicator (folded here because this head already carries its hive review):

Correctness review (read at head f4ec633; files opened: policy.go, competing_options.go, issue_decision_options.go, issue_unpark_menu.go, api_repo_item_decide_delegated{,_plan}.go).

The parser, the dashboard wiring, the summary-sanitiser refactor and the plan wording all match #16934 and are well covered. One regression in rule ordering:

competing-options / recommended-option now pre-empt proposal-not-now β€” src/pkg/delegatedecision/policy.go:583-587

The comment says "Every rule below approves a direction", but notNowDecision(ref) at policy.go:611-613 is below the new call and declines a hive-filed proposal with no incident/recurrence evidence. Hive-filed proposals routinely list options with a recommendation (that is the --needs-decision menu shape unparkMenuFor exists for). At this head such an issue, labelled kind/proposal and carrying "Recommendation: option B", is approved under recommended-option (competing_options.go:55-59, approveIssue β†’ ActionCommentDecision + triage/accepted) instead of being closed not-now β€” the speculative-proposal gate is silently bypassed. Without a recommendation it is refused rather than closed, which is a smaller change but still differs from today. None of the new tests sets HiveAuthored/proposal labels, so this is not exercised.

Suggested fix β€” keep the placement (so flaky/ratchet/design-proposal/default-approve never approve a bare direction) but let the not-now gate win for an evidence-less hive-filed proposal:

 	// Every rule below approves a direction. An issue that offers a choice
 	// is approved only as the option it recommends, never as a bare one.
+	// A hive-filed proposal with no evidence behind it is still declined
+	// (proposal-not-now), options or not.
 	if d, ok := competingOptionsDecision(in); ok {
+		if IsProposal(in.Title, in.Labels) && hiveFiled(in) {
+			if _, _, evidence := ProposalEvidence(in.Title, in.Body); !evidence {
+				return notNowDecision(ref)
+			}
+		}
 		return d
 	}

plus a test in competing_options_test.go with HiveAuthored: true, Labels: {"kind/proposal", …}, RecommendedOption: "2" asserting Rule == "proposal-not-now".

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

Read the new rule and its wiring against the v6 tree at 6c59e41; this looks correct to me.

What I verified:

  • src/pkg/delegatedecision/policy.go:585 places competingOptionsDecision after the review-backlog rule and before every approving rule (flaky-test … default-approve), so an issue with β‰₯2 options can no longer land on the reversible default. competing_options.go:46 returns ok=false for <2 options, so single-option and option-less issues keep today's path.
  • src/pkg/github/issue_decision_options.go:20-27 reuses unparkMenuFor for lettered options, and the numbered fallback (lines 33-50) mirrors the precedence in issue_unpark_menu.go:102-133: hive-only comments, parkWithdrawnMarkerPrefix clears body options too, notice/reply/accepted/recheck/delegated comments are skipped. Consistent with the "What to reply" notice.
  • numberedDecisionOptions requires the cue on the nearest non-blank line before item 1 and strictly sequential labels (issue_decision_options.go:94), so utah#920's numbered "What it cost" steps are not read β€” matches the test in issue_decision_options_test.go.
  • Option summaries pass through the factored-out unparkCleanOptionSummary (issue_unpark_command.go:1575-1586): HTML comments stripped, mentions defanged, one line, capped β€” the same cleaning the notice already applied, so the untrusted issue text quoted in the recorded /hive decision go with option N: … is no more exposed than before. The refactor at unparkOptionSummary is behaviour-preserving (rest[1:] β†’ same pipeline).
  • api_repo_item_decide_delegated.go:724 only gathers options in the issue (non-PR) branch; delegatedIssueComments (lines 827-841) returns what it has on error, so a comment read failure degrades to body-only as the body states.
  • The recorded text is free-form /hive decision <text>, same shape parseUnparkCommand already accepts for the other issue rules (issue_unpark_command.go:1276-1281).

No defects found. Diff matches the PR description; no scope beyond #16934.

Evidence bundle `#169356c59e41` sha256:fdcb0852b034ecfc36462492e73654eda8b0dfc25538f2a889c787e9f39694cf β€” download from the dashboard or `hivectl review evidence #16935`.

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

Correctness re-review at 6c59e41 (delta since f4ec633 is the v6 merge: 8 upstream commits + merge commit; build clean, CI green).

Still present (in-scope, blocks): src/pkg/delegatedecision/policy.go:585 β€” competingOptionsDecision runs before the IsProposal && hiveFiled β†’ notNowDecision branch at policy.go:612-613. A hive-filed proposal that lists options and recommends one now gets approveIssue(RuleRecommendedOption, …) (competing_options.go:58), i.e. the hive approves its own proposal, where before this PR it was deferred with not-now. Suggested fix β€” decide the hive-filed/no-evidence case before the options rule, since not-now is not an approving rule:

--- a/src/pkg/delegatedecision/policy.go
+++ b/src/pkg/delegatedecision/policy.go
@@ -582,6 +582,12 @@
 	// Every rule below approves a direction. An issue that offers a choice
 	// is approved only as the option it recommends, never as a bare one.
+	if IsProposal(in.Title, in.Labels) && hiveFiled(in) {
+		if _, _, ok := ProposalEvidence(in.Title, in.Body); !ok {
+			return notNowDecision(ref)
+		}
+	}
 	if d, ok := competingOptionsDecision(in); ok {
 		return d
 	}

(and a test: hive-filed proposal, two options, "Recommendation: option 2" β†’ rule proposal-not-now, not recommended-option.)

New in the delta (out-of-scope, low): the merged "What hive saw" panel promises "every fact the decision rules read" (api_repo_item_decide_delegated_plan.go:72-73), but Input.Facts() (src/pkg/delegatedecision/facts.go:33-181) has no entry for Input.Options / Input.RecommendedOption, which competingOptionsDecision reads. On a competing-options or recommended-option decision the panel shows the rule but none of the options it was decided on. Cheap to close:

--- a/src/pkg/delegatedecision/facts.go
+++ b/src/pkg/delegatedecision/facts.go
@@ -177,6 +177,15 @@
 	if q := strings.TrimSpace(in.Question); q != "" {
 		add("Question for a person", q, FactInfo)
 	}
+	if len(in.Options) > 0 {
+		names := make([]string, len(in.Options))
+		for i, o := range in.Options {
+			names[i] = o.Name()
+		}
+		add("Options offered", strings.Join(names, "; "), FactInfo)
+		if in.RecommendedOption != "" {
+			add("Recommended option", "option "+in.RecommendedOption, FactInfo)
+		}
+	}
 	return out
 }

Previous docs-currency note (policy.go:50 PolicyText) is unchanged by the delta; style notes unchanged.

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

Read the diff against the v6 tree at 6c59e41, then the body. The change does what it says and I found no defect.

Verified

  • policy.go decideIssue: competingOptionsDecision sits after the review-backlog approve and before flaky-test, so it precedes every rule that would otherwise approve a bare direction (flaky, ratchet, design-proposal, proposal-approve-evidence, default-approve). competing_options.go:44-69: fewer than two options β†’ ok=false, no behaviour change for ordinary issues; a recommended label not in the offered set falls through to the refusal rather than approving.
  • issue_decision_options.go:20-26 reuses unparkMenuFor (issue_unpark_menu.go:90), so lettered options inherit the existing newest-hive-comment-wins, withdrawn-ask and delegate-comment-skip semantics; the numbered fallback at lines 30-52 mirrors the same marker set.
  • api_repo_item_decide_delegated.go:724-726 only runs the gather on the issue branch; delegatedIssueComments (lines 828-842) is page-capped and degrades to body-only on error, so an API hiccup cannot turn a decidable issue into a refusal.
  • api_repo_item_decide_delegated_plan.go:339-344: the Option != nil case is ordered before the generic KindIssue approve case, so it is reachable. JS rule map and the generated static/index.html carry the same two keys.
  • issue_unpark_command.go:1567: the factor-out of unparkCleanOptionSummary keeps unparkOptionSummary byte-for-byte equivalent (rest[1:] then the same trims).

One open question, not a defect β€” issue_decision_options.go:62 numberedOptionCueRE matches any lead line containing option(s), either or one of. A bug report whose repro list is introduced by e.g. "Either of these reproduces it:" would now be read as a two-way choice and land on competing-options (refused, park kept) instead of default-approve. The failure direction is conservative (nothing is written; Give direction is offered), so I'd not block on it, but you may want the cue to require the pick/choose verbs or the plural-nouns-with-colon form. Your call.

Looks correct to me. I have not approved or changed anything.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Danathar this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the review swarm requested changes

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (14 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Intent-alignment (delta re-review @ 6c59e41) β€” the delta is a v6 merge-in only (8 upstream commits, no author commits). The PR's own changes against #16934 are unchanged and still satisfy it: the competing-options plan wording and the recommended-option plan survived the merge intact (src/pkg/dashboard/api_repo_item_decide_delegated_plan.go:339-344 and :375-381). No new scope creep.

One adjacent gap the merge exposes (not blocking for #16934):

Input.Facts() never lists the options the new rules read. Upstream #16936 added "What hive saw" with the contract "Only facts the rules use are listed" (src/pkg/delegatedecision/facts.go:28-31), but at this head Facts() reads Question (facts.go:177-179) and nothing of Options/RecommendedOption (policy.go:206-207), which competingOptionsDecision depends on (competing_options.go:45-66). So for utah#920 the preview says "Leave the choice to you … 3 options" while the facts panel shows no option at all. Suggested addition after the Question fact in facts.go:

 	if q := strings.TrimSpace(in.Question); q != "" {
 		add("Question for a person", q, FactInfo)
 	}
+	if len(in.Options) >= 2 {
+		names := make([]string, 0, len(in.Options))
+		for _, o := range in.Options {
+			names = append(names, o.Name())
+		}
+		add("Options offered", strings.Join(names, "; "), FactInfo)
+		if in.RecommendedOption != "" {
+			add("Recommended option", "option "+in.RecommendedOption, FactInfo)
+		} else {
+			add("Recommended option", "none", FactBlocks)
+		}
+	}
 	return out

Prior findings at f4ec633: correctness (policy.go:585 competing-options runs before proposal-not-now at policy.go:688) and docs-currency (policy.go:47 PolicyText still says "never ask the owner a question back") are still present β€” policy.go was not touched by the delta; those belong to their perspectives, not repeated here.

β€” hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at 6c59e41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› [v6] "Let hive decide" approves a bare "direction" on an issue that offers competing options

1 participant