Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-19289-human-only-followups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Asks only a person can answer no longer pass through the owner-delegate's `default-approve` / `default-release`. A governor follow-up quoting the security review's `security requires human: …` hand-off (#19229, #19289) was approved as "an agent may claim it" and landed at `stage/010-actionable`, where agents claimed and dropped it. The decider now has a `person-only` rule ahead of the defaults: an issue with the `<!-- hive:human-only -->` marker, a `human-only` label or that governor follow-up shape, and a PR whose security perspective itself returned `requires_human` (new structured aggregate field `security_routed_to_person`), keep their 045 / 085 park, get `needs-owner` and one owner-action comment. The tracker shows them as *Needs the owner* with **Let hive decide** greyed out, and the contributor relay does not offer them. The reviewer-question auto-decide now treats a security hand-off as a policy sign-off, so the PR is not merged as-is and no claimable follow-up is filed. Separately, `owner-only` on a PR now reads the question and park reasons, or a grant-verb title, not just a title that names credentials: #19226, a credential-stripping code change, had been answered with "set or rotate the secret named in the title".
5 changes: 4 additions & 1 deletion src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,8 +801,11 @@ The rules live in one place — `src/pkg/delegatedecision/policy.go` (`PolicyTex
| a hive-filed proposal (`[quality]` / `[scanner]` / `[architect]` / `[strategist]` / `[outreach]` prefix, "Gate proposal", "RFC", or a `kind/design` / `kind/proposal` label) **with evidence** — an `incident #N`, breakage words (broke, regression, outage, uncompilable, blast radius), or a recurrence whose prior instances were each fixed one at a time ("fixed in #415", "Fixing PRs: #415, #417") | `proposal-approve-evidence` (verdict `approve`) | Approved as proposed; the rationale names the evidence ("it cites incident #15322", "the same class was already fixed one at a time in #415, #417"). |
| a hive-filed proposal **without** such evidence | `proposal-not-now` (verdict `not-now`) | Declined for now: a comment saying "no incident or recurrence justifies the cost yet; re-propose with evidence", then closed as not planned (the established declined-proposal path). Never applied to a person's proposal (those keep `default-approve`), never to the hive's own policy (`hive-policy` stays recommend-only). |
| a change to the hive's own policy (for example an RFC to hold unacknowledged hive-filed proposals) | `hive-policy` (recommend-only) | Unchanged in shape, but the recommendation is a real sentence in the owner's terms — "approve `<title>` as proposed — proposals nobody has acknowledged should not be actionable; make it default-on for the lanes it names rather than opt-in; owner to confirm" — never "no special rule applies". |
| an ask only a person can answer: the issue carries the `<!-- hive:human-only -->` marker or a `human-only` label (not `needs-human` alone, the ordinary park a decision lifts), or it is a governor follow-up (`origin/governor` + `follow-up`) quoting the security review's `security requires human: …` hand-off; on a PR, the security perspective's own report returned `requires_human` (the aggregate's `security_routed_to_person`, not the stamp every perspective gets on a decision question) | `person-only` (recommend-only, keeps the park) | Never `default-approve` or `default-release`: the item gets `needs-owner` and one comment, *owner action required: #N needs a person (…); read it yourself, then decide it or close it*, and stays at 045 / 085. The tracker row's decision says *Needs the owner* and greys out **Let hive decide**; the contributor relay is not offered the issue. The reviewer-question auto-decide (`governor.review.auto_decide_questions`) classifies such a head as a policy sign-off, so it no longer merges as-is and files the hand-off as follow-up work an agent claims and drops (#19229). A PR adopted in place keeps its own `adopted-security-finding` wording. |

Each decision names the rule that fired (`dedupe`, `owner-only`, `flaky-test`, `ci-ratchet`, `design-proposal`, `review-backlog`, `selfreport-operator-action`, `proposal-approve-evidence`, `proposal-not-now`, `default-approve`, `prefer-contributor`, `contributor-offline`, `sentinel-trusted`, `small-low-risk`, `reporter-trust`, `fix-then-merge`, `default-release`, `hive-policy`, `sentinel-untrusted`, `rail-hold`, `one-pr-per-issue`, `ci-pending`, `mid-flight`) in the comment and in the job's `decision.rule`.
Each decision names the rule that fired (`dedupe`, `owner-only`, `flaky-test`, `ci-ratchet`, `design-proposal`, `review-backlog`, `selfreport-operator-action`, `proposal-approve-evidence`, `proposal-not-now`, `person-only`, `default-approve`, `prefer-contributor`, `contributor-offline`, `sentinel-trusted`, `small-low-risk`, `reporter-trust`, `fix-then-merge`, `default-release`, `hive-policy`, `sentinel-untrusted`, `rail-hold`, `one-pr-per-issue`, `ci-pending`, `mid-flight`) in the comment and in the job's `decision.rule`.

On a **PR**, `owner-only` reads what the person is asked, not the PR's topic: the reviewer's question and the park reasons, or a title that leads with a grant verb (*Add org membership for bot*, *feat: rotate the release PAT*). A code change whose title only names credentials or tokens (*fix: consistent redirect policy and credential stripping for http clients*, #19226) is a code-review decision and is no longer answered with *set or rotate the secret named in the title*. Issues keep the title and body match.

**Safety rails** (`ApplyRails`, applied after the policy and before anything is written): the delegate never merges a PR — it only records the approval the auto-merge engine already acts on per repository settings (a merger/owner requester's approval is written as the queue line the sweep parses; anyone else's as `/lgtm` + `/approve` comments attributed to them); it does not touch an item wearing `hold` (refused, nothing written — release the hold first if you want it decided); it never grants org membership, secrets or permissions (those items get `needs-owner` + `hold` and the one owner-action comment, and keep their park); and a question that is a policy or scope change to the hive itself (settings, governance docs, security posture — the `governance` label or those words in the park reason) is left parked: the delegate posts "hive recommends: …; owner to confirm" and keeps 085.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The plain-words comment the delegate posts has four lines — **Hive decided** (
| `design-proposal` | a proposal with clear acceptance criteria, accepted as written | The proposal states concrete acceptance criteria, so it is accepted as written; anything not stated keeps today's behaviour. |
| `fix-then-merge` | the branch isn't mergeable yet | The branch cannot merge as it is (conflicts, red CI or a missing sign-off); the hive told the author agent exactly what to fix. |
| `flaky-test` | a flaky test, quarantined with a retry | The failure is a flaky test: it is quarantined with a retry and a separate deflake task is filed, so it blocks nothing. |
| `person-only` | only a person can answer this; the hive keeps it parked for the owner | The ask is a person's alone: a security review routed the change to a person, or the issue carries the human-only marker or label. A default approve would hand it to an agent that cannot act on it, so the hive labels it needs-owner and leaves it parked until a person decides or closes it. |
| `hive-policy` | this changes the hive's own rules | This changes the hive's own settings, governance or security posture; the hive only recommends and the owner confirms. |
| `llm-delegate` | decided by the hive's model under the owner's rules | No mechanical rule applied, so the hive's model decided under the owner's standing rules; the same safety rails applied. |
| `mergeable-as-is` | mergeable and green as it is; handed to the merge queue | The head is mergeable with green CI, so no adoption is needed: the hive approves it and the merge queue takes it as it is. |
Expand Down
4 changes: 4 additions & 0 deletions src/pkg/dashboard/api_repo_item_decide_delegated.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ func (s *Server) gatherDelegatedInput(ctx context.Context, repoFull string, numb
in.Author = author
in.HiveAuthored = client.IsHiveAuthorLogin(author)
in.TrustedAuthor = in.HiveAuthored
if !issue.IsPullRequest() && itemType != "pr" {

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.

This negates the if issue.IsPullRequest() || itemType == "pr" directly below; an else on that block avoids restating the condition.

in.HumanOnly = issueHumanOnlyAsk(s.deps.Config, repoFull, in.Labels, in.Body)
}
if issue.IsPullRequest() || itemType == "pr" {
in.Kind = delegatedecision.KindPR
pr, _, err := api.PullRequests.Get(ctx, owner, repoName, number)
Expand Down Expand Up @@ -889,6 +892,7 @@ func (s *Server) gatherDelegatedRecordedPark(repoFull string, number int, head s
}
in.ReviewerFinding = strings.TrimSpace(agg.DecisionFinding)
in.SecurityFinding = delegatedSecurityFinding(agg)
in.SecurityRequiresPerson = agg.SecurityRequiresPerson()
}

// delegatedSecurityFinding: the reviewer's finding is the security
Expand Down
52 changes: 52 additions & 0 deletions src/pkg/dashboard/contribute_umbrella.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package dashboard

import (
"strings"

"github.com/hivecommons/hive/pkg/config"
"github.com/hivecommons/hive/pkg/delegatedecision"
"github.com/hivecommons/hive/pkg/gfi"
"github.com/hivecommons/hive/pkg/github"
"github.com/hivecommons/hive/pkg/review"
"github.com/hivecommons/hive/pkg/stageengine"
"github.com/hivecommons/hive/pkg/worksource"
)

Expand Down Expand Up @@ -40,9 +45,54 @@ func (h *ContributeWSHub) contributorExclusion(repoFull string, issue map[string
if w, ok := pol.HumanOnlyReason(labels, body); ok {
return withheldReasonHumanOnly, w
}
if governorSecurityFollowUp(labels, body) {
return withheldReasonHumanOnly, humanOnlyWhySecurityFollowUp
}
return "", ""
}

// humanOnlyWhySecurityFollowUp is the owner-only rule name for a governor
// follow-up that quotes a security review's hand-off to a person.
const humanOnlyWhySecurityFollowUp = "security-review-follow-up"

// governorSecurityFollowUp reports a follow-up issue the governor filed
// (origin/governor + follow-up, fileReviewQuestionFollowUp) whose quoted
// question is the security perspective's requires_human summary, in the
// exact form the review aggregate writes it (review.SecurityRequiresHumanSummary).
// Such an issue asks a person for a security read; no agent can act on it
// (hivecommons/hive#19229, claimed and dropped repeatedly at 010).
func governorSecurityFollowUp(labels []string, body string) bool {
if !hasLabelFold(labels, reviewQuestionFollowUpLabel) || !hasLabelFold(labels, config.OriginLabelPrefix+config.OriginSourceGovernor) {
return false
}
return review.SecurityRequiresHumanSummary(body)
}

// issueHumanOnlyAsk names why an issue's ask is a person's alone, for the
// owner-delegate decider (delegatedecision.Input.HumanOnly): the
// structured human-only marker or a configured human-only label, or a
// governor security follow-up. `needs-human` alone does not count: it is
// the ordinary park label a delegated decision answers and lifts.
func issueHumanOnlyAsk(cfg *config.Config, repo string, labels []string, body string) string {
var pol gfi.UmbrellaPolicy
if cfg != nil {
pol = cfg.Hub.UmbrellaPolicyFor(repo)
}
kept := make([]string, 0, len(labels))
for _, l := range labels {
if !strings.EqualFold(strings.TrimSpace(l), stageengine.NeedsHumanLabel) {
kept = append(kept, l)
}
}
if why, ok := pol.HumanOnlyReason(kept, body); ok {
return "human-only " + why
}
if governorSecurityFollowUp(labels, body) {
return delegatedecision.HumanOnlySecurityReview
}
return ""
}

// issueChildrenTotal reads a decomposed parent's sub-issue count from the
// decoded issue map (`children: {total, completed}`); 0 when absent.
func issueChildrenTotal(issue map[string]any) int {
Expand Down Expand Up @@ -115,6 +165,8 @@ func stageTrackerOwnerFlags(cfg *config.Config, repo string, issue github.Issue)
}
if why, ok := pol.HumanOnlyReason(issue.Labels, issue.Body); ok {
ownerOnly = why
} else if governorSecurityFollowUp(issue.Labels, issue.Body) {
ownerOnly = humanOnlyWhySecurityFollowUp
}
return umbrella, ownerOnly
}
65 changes: 65 additions & 0 deletions src/pkg/dashboard/human_only_followup_19229_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package dashboard

import (
"testing"
"time"

"github.com/hivecommons/hive/pkg/delegatedecision"
"github.com/hivecommons/hive/pkg/gfi"
"github.com/hivecommons/hive/pkg/stagelabels"
)

const followUp19229Body = "A review perspective on #19227 ended with a question rather than a finding.\n\n" +
"> A reviewer handed this to a person: security requires human: Not deeply reviewed: the diff touches Hive proxy policy / egress trust surfaces.\n\n" +
"Source: hivecommons/hive#19227 (head `0c1450c`).\n"

func governorFollowUpLabels() []string {
return []string{"origin/governor", reviewQuestionFollowUpLabel, "help wanted"}
}

func TestGovernorSecurityFollowUp(t *testing.T) {
if !governorSecurityFollowUp(governorFollowUpLabels(), followUp19229Body) {
t.Fatal("#19229's shape must read as a governor security follow-up")
}
if governorSecurityFollowUp([]string{reviewQuestionFollowUpLabel}, followUp19229Body) {
t.Fatal("without origin/governor the issue is not the governor's follow-up")
}
if governorSecurityFollowUp(governorFollowUpLabels(), "> correctness requires human: unclear intent") {
t.Fatal("another perspective's hand-off is not a security one")
}
}

func TestIssueHumanOnlyAsk(t *testing.T) {
if got := issueHumanOnlyAsk(nil, "hivecommons/hive", governorFollowUpLabels(), followUp19229Body); got != delegatedecision.HumanOnlySecurityReview {
t.Fatalf("governor security follow-up = %q, want %q", got, delegatedecision.HumanOnlySecurityReview)
}
if got := issueHumanOnlyAsk(nil, "hivecommons/hive", nil, "please do this\n"+gfi.HumanOnlyMarker); got == "" {
t.Fatal("the human-only marker must count")
}
if got := issueHumanOnlyAsk(nil, "hivecommons/hive", []string{"human-only"}, ""); got == "" {
t.Fatal("the human-only label must count")
}
if got := issueHumanOnlyAsk(nil, "hivecommons/hive", []string{"needs-human"}, "agent stood down"); got != "" {
t.Fatalf("needs-human alone is the ordinary park a decision lifts, got %q", got)
}
}

func TestOwnerOnlyIssueDecisionDisablesDelegate(t *testing.T) {
it := StageTrackerItem{Kind: "issue", Number: 19229, Stage: stagelabels.IssueNeedsDecision.Number(), OwnerOnly: humanOnlyWhySecurityFollowUp}
d := stageTrackerDecisionNeededWith(it, nil, "", time.Date(2026, 11, 19, 12, 0, 0, 0, time.UTC), blockerOptionsContext{})
if d == nil || d.BlockerReason != "owner-only:"+humanOnlyWhySecurityFollowUp {
t.Fatalf("decision = %+v, want the owner-only issue decision", d)
}
if o := decisionOptionByAction(t, d, decisionActionDelegate); o.Enabled || o.ReasonIfDisabled == "" {
t.Fatalf("Let hive decide must be off with a reason: %+v", o)
}
if o := decisionOptionByAction(t, d, decisionActionApprove); !o.Enabled {
t.Fatalf("the person's own approve stays on: %+v", o)
}

it.OwnerOnly = "label:needs-human"
d = stageTrackerDecisionNeededWith(it, nil, "", time.Date(2026, 11, 19, 12, 0, 0, 0, time.UTC), blockerOptionsContext{})
if o := decisionOptionByAction(t, d, decisionActionDelegate); !o.Enabled {
t.Fatalf("control: a needs-human park keeps Let hive decide: %+v", o)
}
}
1 change: 1 addition & 0 deletions src/pkg/dashboard/review_question_autodecide.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ func (s *Server) autoDecideReviewQuestion(ctx context.Context, c reviewQuestionC
if lookup != nil {
if agg, ok := lookup(c.Repo, c.Number, c.Head, true); ok {
in.UnresolvedFindings = reviewQuestionUnresolvedFindings(agg)
in.SecurityRequiresPerson = agg.SecurityRequiresPerson()
if agg.HiveAuthoredKnown {
in.HiveAuthored = in.HiveAuthored || agg.HiveAuthored
}
Expand Down
9 changes: 9 additions & 0 deletions src/pkg/dashboard/stage_tracker_decision.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ const (
decisionAskedByTriage = "triage"
decisionAskedByHiveAgent = "the hive"
decisionAskedByEscalation = "the needs-human label"
decisionAskedByHumanOnly = "the human-only marker"
)

// decisionWhyPersonOnly is why "Let hive decide" is off on an owner-only ask.
const decisionWhyPersonOnly = "Only a person can decide this; the hive would hand it to an agent that cannot act on it"

// Blocker reason tokens the tracker coins when the lane left none. The
// token is for machines (filters, tests); the popover prints Blocker.
const (
Expand Down Expand Up @@ -223,6 +227,11 @@ func stageTrackerDecisionNeededWith(it StageTrackerItem, verdict *review.Aggrega
// The issue rides its covering PR; the PR's own row (nested under
// the issue) carries the decision.
return nil
case it.Kind == "issue" && issueOwnerOnlyAsk(it) && (it.Stage == stagelabels.IssueNeedsDecision.Number() || slices.Contains(it.Modifiers, modNeedsDecision) || slices.Contains(it.Modifiers, modNeedsHuman)):
// The ask is a person's alone (a security review hand-off, a
// human-only marker): "Let hive decide" would only send it to an
// agent that cannot act on it (hivecommons/hive#19229).
return decisionForOwnerOnlyIssue(it, held)
case it.Kind == "issue" && (it.Stage == stagelabels.IssueNeedsDecision.Number() || slices.Contains(it.Modifiers, modNeedsDecision)):
return decisionForIssue(it, held)
case it.Kind == "issue" && (it.Stage == stagelabels.TriageNeeded.Number() || slices.Contains(it.Modifiers, modNeedsTriage)):
Expand Down
35 changes: 35 additions & 0 deletions src/pkg/dashboard/stage_tracker_decision_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,41 @@ func decisionForIssue(it StageTrackerItem, held bool) *StageTrackerDecision {
return d
}

// issueOwnerOnlyAsk reports an issue row whose ask is a person's alone
// (StageTrackerItem.OwnerOnly from the human-only marker, a human-only
// label or a governor security follow-up). `needs-human` alone is the
// ordinary park a delegated decision answers, so it does not count.
func issueOwnerOnlyAsk(it StageTrackerItem) bool {
why := strings.TrimSpace(it.OwnerOnly)
return why != "" && !strings.EqualFold(why, "label:"+stageengine.NeedsHumanLabel)
}

// decisionForOwnerOnlyIssue is the popover of an issue parked for the owner
// on an ask only a person can answer: it says so, offers the person's own
// moves, and keeps "Let hive decide" off (hivecommons/hive#19229).
func decisionForOwnerOnlyIssue(it StageTrackerItem, held bool) *StageTrackerDecision {
why := strings.TrimSpace(it.OwnerOnly)
d := &StageTrackerDecision{Since: it.StageSince, AskedBy: decisionAskedByHumanOnly, BlockerReason: "owner-only:" + why}
if why == humanOnlyWhySecurityFollowUp {
d.AskedBy = decisionAskedByReviewer
d.Question = "A security review handed this to a person. Read the source PR's change yourself, then record your decision or close this issue."
} else {
d.Question = "This issue is marked for a person only. Decide it yourself, then approve a direction or close it."
}
d.Blocker = "Needs the owner: no agent can act on this, so the hive keeps it parked and does not decide it for you."
if held {
d.Blocker += " " + decisionHeldBlocker(it.Hold)
}
d.Options = []StageTrackerDecisionOption{
decisionOption(decisionActionApprove, "Approve direction", true, ""),
decisionOption(decisionActionCloseWontfix, "Close as won't fix", true, ""),
decisionOption(decisionActionCloseSuperseded, "Close as superseded", true, ""),
decisionOption(decisionActionDelegate, "Let hive decide", false, decisionWhyPersonOnly),
decisionHoldOption(held),
}
return d
}

func decisionForTriage(it StageTrackerItem, held bool) *StageTrackerDecision {
d := &StageTrackerDecision{Since: it.StageSince, AskedBy: decisionAskedByTriage, BlockerReason: strings.TrimSpace(it.Reason)}
d.Question = "Should the hive work on this issue? Accept triage so an agent can take it, hold it, or mark it needs-human."
Expand Down
Loading
Loading