From 3a4a8f3682e70b58c16c2db891b230a8a247b55e Mon Sep 17 00:00:00 2001 From: Andy Anderson Date: Thu, 19 Nov 2026 12:20:32 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20Keep=20human-only=20follow-u?= =?UTF-8?q?ps=20out=20of=20the=20owner-delegate's=20default=20approve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A governor follow-up quoting the security review's hand-off to a person was default-approved and landed at 010 where no agent can act (#19229). Add a structured security_routed_to_person aggregate field, classify a security hand-off as a policy sign-off, add a human-only delegate rule ahead of the defaults that keeps the park with needs-owner, show such issues as needing the owner on the dashboard, and stop owner-only from matching a PR's topic words in its title (#19226). Fixes #19289 Signed-off-by: Andy Anderson --- .../fixed-19289-human-only-followups.md | 1 + .../dashboard-sections/activity-monitor.md | 5 +- .../glossary-and-operations.md | 1 + .../api_repo_item_decide_delegated.go | 4 + src/pkg/dashboard/contribute_umbrella.go | 52 ++++++++ .../human_only_followup_19229_test.go | 65 ++++++++++ .../dashboard/review_question_autodecide.go | 1 + src/pkg/dashboard/stage_tracker_decision.go | 9 ++ .../dashboard/stage_tracker_decision_pr.go | 35 ++++++ src/pkg/delegatedecision/decision_glossary.go | 2 + .../delegatedecision/human_only_19229_test.go | 113 ++++++++++++++++++ src/pkg/delegatedecision/policy.go | 77 +++++++++++- src/pkg/review/decision_question_class.go | 13 ++ src/pkg/review/review.go | 50 ++++++-- src/pkg/review/security_routed_19229_test.go | 61 ++++++++++ 15 files changed, 475 insertions(+), 14 deletions(-) create mode 100644 changelog.d/fixed-19289-human-only-followups.md create mode 100644 src/pkg/dashboard/human_only_followup_19229_test.go create mode 100644 src/pkg/delegatedecision/human_only_19229_test.go create mode 100644 src/pkg/review/security_routed_19229_test.go diff --git a/changelog.d/fixed-19289-human-only-followups.md b/changelog.d/fixed-19289-human-only-followups.md new file mode 100644 index 0000000000..ec440724dc --- /dev/null +++ b/changelog.d/fixed-19289-human-only-followups.md @@ -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) 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 `human-only` rule ahead of the defaults: an issue with the `` 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". diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index bc57a90865..14b2fe9827 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -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 `` 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) | `human-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`, `human-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. diff --git a/src/docs/labels-and-control-signals/glossary-and-operations.md b/src/docs/labels-and-control-signals/glossary-and-operations.md index 48fc0c860f..1e11d8efb2 100644 --- a/src/docs/labels-and-control-signals/glossary-and-operations.md +++ b/src/docs/labels-and-control-signals/glossary-and-operations.md @@ -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. | +| `human-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. | diff --git a/src/pkg/dashboard/api_repo_item_decide_delegated.go b/src/pkg/dashboard/api_repo_item_decide_delegated.go index 7e7ed8550c..e0ee072007 100644 --- a/src/pkg/dashboard/api_repo_item_decide_delegated.go +++ b/src/pkg/dashboard/api_repo_item_decide_delegated.go @@ -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" { + 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) @@ -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 diff --git a/src/pkg/dashboard/contribute_umbrella.go b/src/pkg/dashboard/contribute_umbrella.go index 43a23525e6..ea49974895 100644 --- a/src/pkg/dashboard/contribute_umbrella.go +++ b/src/pkg/dashboard/contribute_umbrella.go @@ -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" ) @@ -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 { @@ -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 } diff --git a/src/pkg/dashboard/human_only_followup_19229_test.go b/src/pkg/dashboard/human_only_followup_19229_test.go new file mode 100644 index 0000000000..2e155777ca --- /dev/null +++ b/src/pkg/dashboard/human_only_followup_19229_test.go @@ -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) + } +} diff --git a/src/pkg/dashboard/review_question_autodecide.go b/src/pkg/dashboard/review_question_autodecide.go index e37d8d127b..c031f2a20b 100644 --- a/src/pkg/dashboard/review_question_autodecide.go +++ b/src/pkg/dashboard/review_question_autodecide.go @@ -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 } diff --git a/src/pkg/dashboard/stage_tracker_decision.go b/src/pkg/dashboard/stage_tracker_decision.go index cf773809d6..feac91bae0 100644 --- a/src/pkg/dashboard/stage_tracker_decision.go +++ b/src/pkg/dashboard/stage_tracker_decision.go @@ -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 ( @@ -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)): diff --git a/src/pkg/dashboard/stage_tracker_decision_pr.go b/src/pkg/dashboard/stage_tracker_decision_pr.go index 5fc5fbc303..c0a5d9bf03 100644 --- a/src/pkg/dashboard/stage_tracker_decision_pr.go +++ b/src/pkg/dashboard/stage_tracker_decision_pr.go @@ -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." diff --git a/src/pkg/delegatedecision/decision_glossary.go b/src/pkg/delegatedecision/decision_glossary.go index cafeb9bda6..fcfd2fe163 100644 --- a/src/pkg/delegatedecision/decision_glossary.go +++ b/src/pkg/delegatedecision/decision_glossary.go @@ -109,6 +109,8 @@ var glossary = []GlossaryEntry{ Detail: "The hive adopted this PR in place, but the reviewer's finding is the security review's. That policy call is a person's: read the finding and reply /hive decision with the instruction for the hive's fixer, or close the PR."}, {Slug: RuleReturnToAuthor, Kind: GlossaryRule, Plain: "a person pushed this PR; the hive asked them, not adopted it", Detail: "The PR was pushed by a person (author/human or one of this hive's owners), so the hive never adopts it. It told the author by name what to fix (rebase, sign-off, CI) and relayed the reviewer's question."}, + {Slug: RuleHumanOnly, Kind: GlossaryRule, Plain: "only a person can answer this; the hive keeps it parked for the owner", + Detail: "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."}, {Slug: "owner-only", Kind: GlossaryRule, Plain: "only the hive owner can do this", Detail: "This needs a secret, token or organization permission that only the hive owner holds; the hive cannot do it for you.", Aliases: []string{"owner_only"}}, {Slug: RuleOnePRPerIssue, Kind: GlossaryRule, Plain: "two PRs fix the same issue; the merge queue keeps one", diff --git a/src/pkg/delegatedecision/human_only_19229_test.go b/src/pkg/delegatedecision/human_only_19229_test.go new file mode 100644 index 0000000000..e766c25c20 --- /dev/null +++ b/src/pkg/delegatedecision/human_only_19229_test.go @@ -0,0 +1,113 @@ +package delegatedecision + +import ( + "slices" + "strings" + "testing" +) + +func addedLabels(d Decision) []string { + var out []string + for _, a := range d.Actions { + if a.Kind == ActionLabelsAdd { + out = append(out, a.Labels...) + } + } + return out +} + +// hivecommons/hive#19229: a governor follow-up asking for a person's +// security read was default-approved ("an agent may claim it") and landed at +// 010 where no agent could act. A human-only ask keeps its park. +func TestHumanOnlyIssueKeepsPark(t *testing.T) { + in := Input{Kind: KindIssue, Number: 19229, + Title: "[governor] follow-up: A reviewer handed this to a person: security requires human: Not deeply reviewed", + HumanOnly: HumanOnlySecurityReview} + d := Run(in) + if d.Rule != RuleHumanOnly || !d.KeepsPark || d.Verdict != VerdictRecommendOnly { + t.Fatalf("decision = %+v, want %s keeping the park", d, RuleHumanOnly) + } + if !slices.Contains(addedLabels(d), LabelNeedsOwner) { + t.Fatalf("labels added = %v, want needs-owner", addedLabels(d)) + } + for _, a := range d.Actions { + if a.Kind == ActionCommentDecision || slices.Contains(a.Labels, LabelTriageAccepted) { + t.Fatalf("a human-only ask must not be approved for an agent: %+v", d.Actions) + } + } + if !strings.Contains(d.Text, HumanOnlySecurityReview) { + t.Fatalf("text %q must say why", d.Text) + } + if e, ok := Explain(d.Rule); !ok || e.Kind != GlossaryRule { + t.Fatalf("rule %q has no glossary entry", d.Rule) + } +} + +func TestHumanOnlyIssueControlDefaultApproves(t *testing.T) { + d := Run(Input{Kind: KindIssue, Number: 19230, Title: "follow-up: also cover the docs page"}) + if d.Rule != "default-approve" { + t.Fatalf("control: an ordinary follow-up is %q, want default-approve", d.Rule) + } +} + +func TestHumanOnlyPRSecurityRoutedKeepsPark(t *testing.T) { + in := Input{Kind: KindPR, Number: 19227, Title: "🐛 fix: proxy egress policy", CIGreen: true, HiveAuthored: true, TrustedAuthor: true, + ReviewerRequiresHuman: true, SecurityRequiresPerson: true, Small: true} + d := Run(in) + if d.Rule != RuleHumanOnly || !d.KeepsPark { + t.Fatalf("decision = %+v, want %s", d, RuleHumanOnly) + } + for _, a := range d.Actions { + if a.Kind == ActionApproveReview { + t.Fatalf("a security hand-off must not be released: %+v", d.Actions) + } + } + in.SecurityRequiresPerson = false + if d := Run(in); d.Rule == RuleHumanOnly { + t.Fatalf("control: without the security hand-off the PR is not human-only: %+v", d) + } +} + +func TestHumanOnlyPRAdoptedKeepsItsOwnRule(t *testing.T) { + in := Input{Kind: KindPR, Number: 15722, Title: "fix: thing", CIGreen: true, AdoptedByHive: true, + ReviewerRequiresHuman: true, SecurityFinding: true, SecurityRequiresPerson: true} + if d := Run(in); d.Rule != RuleAdoptedSecurityFinding { + t.Fatalf("adopted PR rule = %q, want %q", d.Rule, RuleAdoptedSecurityFinding) + } +} + +// hivecommons/hive#19226: rule owner-only fired on a code-review PR because +// its title named credentials ("set or rotate the secret named in the +// title"). A PR title is its topic; only a grant-shaped title or a question +// that names a secret is an owner ask. +func TestOwnerOnlyPRTitleTopicIsNotAnAsk(t *testing.T) { + for _, title := range []string{ + "🐛 fix: consistent redirect policy and credential stripping for http clients", + "fix(proxy): redact tokens in egress logs", + "Credential helper refactor", + } { + in := Input{Kind: KindPR, Number: 19226, Title: title, CIGreen: true} + if OwnerOnly(in) { + t.Errorf("PR %q is a code change, not an owner-only ask", title) + } + if d := Run(in); d.Rule == "owner-only" { + t.Errorf("PR %q decided owner-only: %+v", title, d) + } + } + for _, in := range []Input{ + {Kind: KindPR, Number: 50, Title: "Add org membership for bot"}, + {Kind: KindPR, Number: 50, Title: "✨ feat: rotate the release PAT"}, + {Kind: KindPR, Number: 50, Title: "fix: release job", Question: "This needs a new repository secret REGISTRY_TOKEN; can the owner add it?"}, + {Kind: KindPR, Number: 50, Title: "fix: release job", Reasons: []string{"needs a PAT with packages:write"}}, + } { + if !OwnerOnly(in) { + t.Errorf("%+v asks the owner for a grant and must stay owner-only", in) + } + } +} + +func TestOwnerOnlyIssueTitleStillMatches(t *testing.T) { + if !OwnerOnly(Input{Kind: KindIssue, Title: "Workflow fails: GITHUB_TOKEN lacks packages:write"}) { + t.Fatal("issue titles keep the topic match: an issue is the ask") + } +} diff --git a/src/pkg/delegatedecision/policy.go b/src/pkg/delegatedecision/policy.go index da1a128d1f..1d66aa7af2 100644 --- a/src/pkg/delegatedecision/policy.go +++ b/src/pkg/delegatedecision/policy.go @@ -344,8 +344,32 @@ type Input struct { // anyway ("" when the park is an ordinary one the rule overrides). HiveSuperseding bool HiveSupersederHardStop string + // HumanOnly names why the ask is a person's alone ("" = it is not): + // the structured human-only marker or label on an issue + // (gfi.HumanOnlyMarker, `human-only`), or a governor follow-up that + // carries a security review's hand-off to a person. The caller sets it; + // RuleHumanOnly keeps such an item parked for the owner instead of + // approving it for an agent that cannot act (hivecommons/hive#19229). + HumanOnly string + // SecurityRequiresPerson: the PR head's review aggregate says the + // security perspective itself routed it to a person + // (review.Aggregate.SecurityRequiresPerson), a structured field rather + // than the reviewer's wording. + SecurityRequiresPerson bool } +// RuleHumanOnly keeps an item whose ask only a person can answer (a +// security review routed to a person, a human-only marker) parked for the +// owner: no default approve, no agent, needs-owner on it. +const RuleHumanOnly = "human-only" + +// Human-only reasons the caller may set on Input.HumanOnly. +const ( + // HumanOnlySecurityReview: the security review routed the work to a + // person (on a PR head, or quoted by the governor follow-up it filed). + HumanOnlySecurityReview = "security review routed to a person" +) + // CIRed reports a head that is not green because a check failed (or none // ever reported), as opposed to one still waiting on running checks. func (in Input) CIRed() bool { return !in.CIGreen && !in.CIPending } @@ -396,8 +420,12 @@ var ( // workflow headlines ("the App cannot push workflows") that name no // permission or path shape the ledger's workflows rule recognises. appPermissionRE = regexp.MustCompile(`(?i)\b(?:app(?: token)?|installation|github app)\b[^\n]{0,80}\b(?:cannot|can't|lacks?|missing|without|no)\b[^\n]{0,60}\b(?:workflows?|permissions?)\b`) - duplicateOfRE = regexp.MustCompile(`(?i)\bduplicate of #(\d+)`) - blockedOnPRRE = regexp.MustCompile(`(?i)\b(review backlog|blocked on (?:its|their|the) PR)\b`) + // prOwnerGrantTitleRE: a PR title that opens (after an emoji and a + // conventional-commit prefix) with a verb that grants or sets + // something, the only title shape that is an owner ask on a PR. + prOwnerGrantTitleRE = regexp.MustCompile(`(?i)^[^\pL\pN]*(?:[\pL\pN]+(?:\([^)]*\))?!?:\s*)?(?:add|grant|set|rotate|provision|create|regenerate|renew|re-?scope|revoke)\b`) + duplicateOfRE = regexp.MustCompile(`(?i)\bduplicate of #(\d+)`) + blockedOnPRRE = regexp.MustCompile(`(?i)\b(review backlog|blocked on (?:its|their|the) PR)\b`) ) // Classifier labels. @@ -481,12 +509,22 @@ func CapabilityGap(in Input) bool { in.Kind == KindIssue && isCapability(firstLines(in.Body, 12)) } -// OwnerOnly reports a secrets / PAT / org-permission item. +// OwnerOnly reports a secrets / PAT / org-permission item. On an issue the +// title, question, park reasons and the body's opening lines are read. A PR +// is a code change, so its title names its topic, not an ask: a PR titled +// "credential stripping for http clients" is a code review, not "set the +// secret named in the title" (hivecommons/hive#19226). A PR is owner-only +// when the question or a park reason names a secret / PAT / permission, or +// when its title leads with a grant verb ("Add org membership for bot"). func OwnerOnly(in Input) bool { + if in.Kind == KindPR { + asked := strings.Join(append([]string{in.Question}, in.Reasons...), "\n") + return secretsRE.MatchString(asked) || prOwnerGrantTitleRE.MatchString(in.Title) && secretsRE.MatchString(in.Title) + } if secretsRE.MatchString(in.headline()) { return true } - return in.Kind == KindIssue && secretsRE.MatchString(firstLines(in.Body, 12)) + return secretsRE.MatchString(firstLines(in.Body, 12)) } func firstLines(s string, n int) string { @@ -519,6 +557,21 @@ func ownerOnlyDecision(in Input, rationale string) Decision { } } +// humanOnlyDecision keeps an item parked for the owner: the ask is one no +// delegate decision and no agent can answer, so approving it only sends it +// to an agent that claims it and drops it again (hivecommons/hive#19229). +func humanOnlyDecision(ref, why string) Decision { + text := "owner action required: " + ref + " needs a person (" + why + "); read it yourself, then decide it or close it" + return Decision{ + Verdict: VerdictRecommendOnly, Rule: RuleHumanOnly, Text: text, KeepsPark: true, + Rationale: "the ask is a person's alone (" + why + "); a default approve would hand it to an agent that cannot act on it", + Actions: []Action{ + {Kind: ActionLabelsAdd, Labels: []string{LabelNeedsOwner}}, + {Kind: ActionRecommendOnly, Text: text}, + }, + } +} + func decideIssue(in Input) Decision { ref := "#" + strconv.Itoa(in.Number) if in.Advisory != nil { @@ -542,6 +595,9 @@ func decideIssue(in Input) Decision { if OwnerOnly(in) { return ownerOnlyDecision(in, "secrets, PATs and org permissions are the owner's alone; the hive stops opening further failure issues for this root cause") } + if why := strings.TrimSpace(in.HumanOnly); why != "" { + return humanOnlyDecision(ref, why) + } if target := in.duplicateTarget(); target > 0 && target < in.Number { text := fmt.Sprintf("Duplicate of #%d", target) return Decision{ @@ -710,6 +766,19 @@ func decidePR(in Input) Decision { if d, ok := decideHiveSuperseder(in, ref); ok { return d } + // A head the security review routed to a person is a person's to read, + // whatever else holds: no release, no fixer direction. The adopted-in- + // place branch below says the same in its own words + // (RuleAdoptedSecurityFinding), so it keeps that case. + if !in.AdoptedByHive { + why := strings.TrimSpace(in.HumanOnly) + if why == "" && in.SecurityRequiresPerson { + why = HumanOnlySecurityReview + } + if why != "" { + return humanOnlyDecision(ref, why) + } + } if in.SentinelAlert { if !in.TrustedAuthor { return recommendOnly("sentinel-untrusted", "a sentinel alert on a PR from an author without write access is a human review", "review the sentinel finding on "+ref+" and remove the sentinel label if intended") diff --git a/src/pkg/review/decision_question_class.go b/src/pkg/review/decision_question_class.go index f945614b3d..263c149c2a 100644 --- a/src/pkg/review/decision_question_class.go +++ b/src/pkg/review/decision_question_class.go @@ -35,6 +35,10 @@ const ( DecisionQuestionIneligible DecisionQuestionClass = "ineligible" ) +// ReasonSecurityRoutedToPerson is the classifier reason for a head the +// security review routed to a person. +const ReasonSecurityRoutedToPerson = "the security review routed this head to a person" + // DecisionQuestionInput is what the classifier sees. It is a value, not a // GitHub read: callers gather the head's files and status first. type DecisionQuestionInput struct { @@ -52,6 +56,12 @@ type DecisionQuestionInput struct { // Files are the head's changed files with their patches (patch may be // empty when the caller did not fetch it). Files []DecisionQuestionFile + // SecurityRequiresPerson: the head's aggregate says the security + // review routed it to a person (Aggregate.SecurityRequiresPerson). + // That ask is a person's however it is worded: the hive never decides + // it for them and never files it as follow-up work an agent may claim + // (hivecommons/hive#19229). + SecurityRequiresPerson bool } // DecisionQuestionFile is one changed file of the PR under question. @@ -110,6 +120,9 @@ func ClassifyDecisionQuestion(in DecisionQuestionInput) (DecisionQuestionClass, if q == "" { return DecisionQuestionIneligible, "no reviewer question" } + if in.SecurityRequiresPerson { + return DecisionQuestionPolicySignOff, ReasonSecurityRoutedToPerson + } for _, f := range in.Files { p := strings.TrimSpace(f.Path) if p == "" { diff --git a/src/pkg/review/review.go b/src/pkg/review/review.go index c0dd98a0c1..03ac01a1f4 100644 --- a/src/pkg/review/review.go +++ b/src/pkg/review/review.go @@ -273,14 +273,21 @@ type Aggregate struct { DecisionFinding string `json:"decision_finding,omitempty"` // RedundantOf is the PR a reviewer named as already carrying this // change, carried from the first report that set one. - RedundantOf int `json:"redundant_of,omitempty"` - HumanSummaries []string `json:"human_summaries,omitempty"` - FixAttempts int `json:"fix_attempts,omitempty"` - MaxFixAttempts int `json:"max_fix_attempts,omitempty"` - Threshold outputschema.Severity `json:"human_threshold"` - Reasons []string `json:"reasons,omitempty"` - Findings []PerspectiveFinding `json:"findings,omitempty"` - Perspectives map[Perspective]Verdict `json:"perspectives"` + RedundantOf int `json:"redundant_of,omitempty"` + HumanSummaries []string `json:"human_summaries,omitempty"` + // SecurityRoutedToPerson: the security perspective's own report + // returned requires_human (not a decision question the relay stamped + // across every perspective), so the head is routed to a person for a + // security read no delegate or fixer can give. Read it through + // SecurityRequiresPerson, which also needs the aggregate to still + // require a human (hivecommons/hive#19229, #19226). + SecurityRoutedToPerson bool `json:"security_routed_to_person,omitempty"` + FixAttempts int `json:"fix_attempts,omitempty"` + MaxFixAttempts int `json:"max_fix_attempts,omitempty"` + Threshold outputschema.Severity `json:"human_threshold"` + Reasons []string `json:"reasons,omitempty"` + Findings []PerspectiveFinding `json:"findings,omitempty"` + Perspectives map[Perspective]Verdict `json:"perspectives"` // Heads lists, per perspective, the review heads whose reports this // aggregate holds. Empty unless reports came from review_heads; with // several heads Perspectives holds the strictest of their verdicts. @@ -520,6 +527,9 @@ func aggregateReports(reports []PerspectiveReport, opts AggregateOptions) Aggreg decisionQuestions = append(decisionQuestions, strings.TrimSpace(r.DecisionQuestion)) agg.Reasons = append(agg.Reasons, decisionReason(r.DecisionQuestion)) } + if effective.Verdict == VerdictRequiresHuman && r.Perspective == PerspectiveSecurity && !r.DecisionRequested { + agg.SecurityRoutedToPerson = true + } if effective.Verdict == VerdictRequiresHuman { if summary := humanSummaryReason(r); summary != "" { agg.HumanSummaries = append(agg.HumanSummaries, summary) @@ -1236,12 +1246,34 @@ func decisionReason(question string) string { return "maintainer decision requested: " + question } +// RequiresHumanSummarySeparator joins a perspective and its summary in a +// HumanSummaries entry: "<perspective> requires human: <summary>". The +// governor's follow-up issues quote that entry verbatim, so +// SecurityRequiresHumanSummary can recognise one filed before the +// structured marker existed. +const RequiresHumanSummarySeparator = " requires human: " + func humanSummaryReason(r PerspectiveReport) string { summary := strings.TrimSpace(r.Summary) if summary == "" { return "" } - return fmt.Sprintf("%s requires human: %s", r.Perspective, summary) + return string(r.Perspective) + RequiresHumanSummarySeparator + summary +} + +// SecurityRequiresPerson reports a head the security review routed to a +// person: its own report returned requires_human and the aggregate still +// requires a human (a policy resolution or the hive-superseding fix route +// clears RequiresHuman, and with it this answer). +func (a Aggregate) SecurityRequiresPerson() bool { + return a.SecurityRoutedToPerson && a.RequiresHuman +} + +// SecurityRequiresHumanSummary reports whether text carries the security +// perspective's HumanSummaries entry ("security requires human: …"), the +// exact form humanSummaryReason writes. +func SecurityRequiresHumanSummary(text string) bool { + return strings.Contains(strings.ToLower(text), string(PerspectiveSecurity)+RequiresHumanSummarySeparator) } // incompleteCoverageReason names the configured perspectives this head has diff --git a/src/pkg/review/security_routed_19229_test.go b/src/pkg/review/security_routed_19229_test.go new file mode 100644 index 0000000000..57d889655d --- /dev/null +++ b/src/pkg/review/security_routed_19229_test.go @@ -0,0 +1,61 @@ +package review + +import "testing" + +// hivecommons/hive#19229: the security perspective's own requires_human is +// a structured "a person must read this" the aggregate carries, distinct +// from the requires_human the relay stamps on every perspective of a +// decision-requested review. +func TestAggregateSecurityRoutedToPerson(t *testing.T) { + got := AggregateReports([]PerspectiveReport{ + baseReport(PerspectiveCorrectness, VerdictApprove), + baseReport(PerspectiveSecurity, VerdictRequiresHuman), + }, AggregateOptions{}) + if !got.SecurityRoutedToPerson || !got.SecurityRequiresPerson() { + t.Fatalf("security requires_human must route to a person: %+v", got) + } + if len(got.HumanSummaries) == 0 || !SecurityRequiresHumanSummary("A reviewer handed this to a person: "+got.HumanSummaries[0]) { + t.Fatalf("human summary %v must read as the security hand-off", got.HumanSummaries) + } +} + +func TestAggregateSecurityRoutedIgnoresStampedDecision(t *testing.T) { + sec := baseReport(PerspectiveSecurity, VerdictRequiresHuman) + sec.DecisionRequested = true + sec.DecisionQuestion = "should this merge ahead of the docs PR?" + got := AggregateReports([]PerspectiveReport{baseReport(PerspectiveCorrectness, VerdictApprove), sec}, AggregateOptions{}) + if got.SecurityRoutedToPerson { + t.Fatalf("a decision question stamped across perspectives is not a security hand-off: %+v", got) + } +} + +func TestAggregateSecurityRoutedNeedsRequiresHuman(t *testing.T) { + a := Aggregate{SecurityRoutedToPerson: true} + if a.SecurityRequiresPerson() { + t.Fatal("an aggregate whose requires_human was cleared is not routed to a person") + } +} + +func TestSecurityRequiresHumanSummaryOtherPerspective(t *testing.T) { + for _, text := range []string{"correctness requires human: unclear intent", "the security of the change looks fine", ""} { + if SecurityRequiresHumanSummary(text) { + t.Errorf("%q must not read as a security hand-off", text) + } + } +} + +func TestClassifyDecisionQuestionSecurityRoutedIsSignOff(t *testing.T) { + in := DecisionQuestionInput{ + Question: "A reviewer handed this to a person: security requires human: Not deeply reviewed: the diff touches Hive proxy policy", + HiveAuthored: true, CIGreen: true, SecurityRequiresPerson: true, + } + class, reason := ClassifyDecisionQuestion(in) + if class != DecisionQuestionPolicySignOff || reason != ReasonSecurityRoutedToPerson { + t.Fatalf("class = %s (%s), want policy sign-off for a security hand-off", class, reason) + } + in.SecurityRequiresPerson = false + in.Question = "should this also cover the docs page?" + if class, _ := ClassifyDecisionQuestion(in); class != DecisionQuestionScope { + t.Fatalf("control: a scope question without the security hand-off stays %s, got %s", DecisionQuestionScope, class) + } +} From 9ac4c5badcf5ffd54908e9ca49c7ed3f847e7a3f Mon Sep 17 00:00:00 2001 From: Andy Anderson <andy@clubanderson.com> Date: Thu, 19 Nov 2026 12:20:53 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9D=20Cite=20the=20tracking=20issu?= =?UTF-8?q?e=20in=20the=20human-only=20changelog=20entry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Anderson <andy@clubanderson.com> --- changelog.d/fixed-19289-human-only-followups.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/fixed-19289-human-only-followups.md b/changelog.d/fixed-19289-human-only-followups.md index ec440724dc..91f691e1aa 100644 --- a/changelog.d/fixed-19289-human-only-followups.md +++ b/changelog.d/fixed-19289-human-only-followups.md @@ -1 +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) 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 `human-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". +- 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 `human-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". From 193cdd6454aa4b124ea5545239287a961457c01b Mon Sep 17 00:00:00 2001 From: Andy Anderson <andy@clubanderson.com> Date: Thu, 19 Nov 2026 12:38:33 -0500 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9B=20Name=20the=20human-only=20de?= =?UTF-8?q?legate=20rule=20person-only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The glossary already uses human-only as an alias of the blocker family, so the rule slug collided and resolved to the wrong entry. Signed-off-by: Andy Anderson <andy@clubanderson.com> --- changelog.d/fixed-19289-human-only-followups.md | 2 +- src/docs/dashboard-sections/activity-monitor.md | 4 ++-- .../labels-and-control-signals/glossary-and-operations.md | 2 +- src/pkg/delegatedecision/policy.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog.d/fixed-19289-human-only-followups.md b/changelog.d/fixed-19289-human-only-followups.md index 91f691e1aa..17d37133e7 100644 --- a/changelog.d/fixed-19289-human-only-followups.md +++ b/changelog.d/fixed-19289-human-only-followups.md @@ -1 +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 `human-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". +- 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". diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index 14b2fe9827..9685c33092 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -801,9 +801,9 @@ 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) | `human-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. | +| 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`, `human-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`. +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. diff --git a/src/docs/labels-and-control-signals/glossary-and-operations.md b/src/docs/labels-and-control-signals/glossary-and-operations.md index 1e11d8efb2..d062dd25f2 100644 --- a/src/docs/labels-and-control-signals/glossary-and-operations.md +++ b/src/docs/labels-and-control-signals/glossary-and-operations.md @@ -26,7 +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. | -| `human-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. | +| `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. | diff --git a/src/pkg/delegatedecision/policy.go b/src/pkg/delegatedecision/policy.go index 1d66aa7af2..95455db376 100644 --- a/src/pkg/delegatedecision/policy.go +++ b/src/pkg/delegatedecision/policy.go @@ -361,7 +361,7 @@ type Input struct { // RuleHumanOnly keeps an item whose ask only a person can answer (a // security review routed to a person, a human-only marker) parked for the // owner: no default approve, no agent, needs-owner on it. -const RuleHumanOnly = "human-only" +const RuleHumanOnly = "person-only" // Human-only reasons the caller may set on Input.HumanOnly. const ( From 383f75e0d33c9ad674551dd407e5b6accb3032bf Mon Sep 17 00:00:00 2001 From: Andy Anderson <andy@clubanderson.com> Date: Thu, 19 Nov 2026 12:51:18 -0500 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A7=AA=20Mirror=20the=20person-only?= =?UTF-8?q?=20rule=20into=20the=20SPA=20decision=20glossary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Anderson <andy@clubanderson.com> --- src/pkg/dashboard/static-src/js/tracker-filter-fetch.js | 1 + src/pkg/dashboard/static/index.html | 1 + 2 files changed, 2 insertions(+) diff --git a/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js b/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js index 592140ddee..b2a67b3c60 100644 --- a/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js +++ b/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js @@ -135,6 +135,7 @@ "owner-only": {"kind": "rule", "plain": "only the hive owner can do this", "detail": "This needs a secret, token or organization permission that only the hive owner holds; the hive cannot do it for you."}, "owner_only": {"kind": "rule", "plain": "only the hive owner can do this", "detail": "This needs a secret, token or organization permission that only the hive owner holds; the hive cannot do it for you."}, "park-label-stuck": {"kind": "reason", "plain": "stage/045-needs-decision is still on the issue; the scanner skips it until that label clears", "detail": "The hive approved the issue and applied approved-direction, but the stage/045-needs-decision park label was never removed, so the scanner still skips the issue. Lift the park (it removes the label through the hive's audited label path) or re-evaluate the issue so the stage engine re-reads it."}, + "person-only": {"kind": "rule", "plain": "only a person can answer this; the hive keeps it parked for the owner", "detail": "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."}, "prefer-contributor": {"kind": "rule", "plain": "a contributor's PR and a hive PR do the same work", "detail": "A contributor's PR and a hive-authored PR cover the same work; the hive prefers the contributor's when it is mergeable and current."}, "proposal-approve-evidence": {"kind": "rule", "plain": "a proposal backed by an incident or a repeated class; approved", "detail": "The hive-filed proposal names an incident it would have prevented, or prior instances of the same class fixed one at a time, so its cost is justified and it is approved as proposed."}, "proposal-not-now": {"kind": "rule", "plain": "a hive-filed proposal with no incident or recurrence behind it; declined for now", "detail": "The proposal shows neither an incident it would have prevented nor a repeated class it would end, so its value is speculative. The hive declines it for now and closes it as not planned; re-propose with evidence."}, diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f69b920f56..b066cd57e8 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -25245,6 +25245,7 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2> "owner-only": {"kind": "rule", "plain": "only the hive owner can do this", "detail": "This needs a secret, token or organization permission that only the hive owner holds; the hive cannot do it for you."}, "owner_only": {"kind": "rule", "plain": "only the hive owner can do this", "detail": "This needs a secret, token or organization permission that only the hive owner holds; the hive cannot do it for you."}, "park-label-stuck": {"kind": "reason", "plain": "stage/045-needs-decision is still on the issue; the scanner skips it until that label clears", "detail": "The hive approved the issue and applied approved-direction, but the stage/045-needs-decision park label was never removed, so the scanner still skips the issue. Lift the park (it removes the label through the hive's audited label path) or re-evaluate the issue so the stage engine re-reads it."}, + "person-only": {"kind": "rule", "plain": "only a person can answer this; the hive keeps it parked for the owner", "detail": "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."}, "prefer-contributor": {"kind": "rule", "plain": "a contributor's PR and a hive PR do the same work", "detail": "A contributor's PR and a hive-authored PR cover the same work; the hive prefers the contributor's when it is mergeable and current."}, "proposal-approve-evidence": {"kind": "rule", "plain": "a proposal backed by an incident or a repeated class; approved", "detail": "The hive-filed proposal names an incident it would have prevented, or prior instances of the same class fixed one at a time, so its cost is justified and it is approved as proposed."}, "proposal-not-now": {"kind": "rule", "plain": "a hive-filed proposal with no incident or recurrence behind it; declined for now", "detail": "The proposal shows neither an incident it would have prevented nor a repeated class it would end, so its value is speculative. The hive declines it for now and closes it as not planned; re-propose with evidence."},