From 50b3112943548efb45f7de0b6ed970f4746525a6 Mon Sep 17 00:00:00 2001 From: Danathar Date: Thu, 5 Nov 2026 17:27:34 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix(ownership):=20issues=20t?= =?UTF-8?q?he=20issue=20filter=20refuses=20reach=20the=20inbox=20as=20ADMI?= =?UTF-8?q?T?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A decided issue (approved-direction from /hive decision or /hive approve) and an agent finding where agents self-authorize sat in band "outside" with no verb when project.issue_filter.require_labels refused them: projectbluefin/testsuite#1091, server#622, dakota-iso#294 (decided) and testsuite#1085, documentation#1630 (L6 findings). Rule (9b) gives them ADMIT (decided_not_admitted, agent_finding_not_admitted) with a reason naming the labels that admit them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- .../fixed-admit-filter-refused-issues.md | 1 + src/docs/dashboard.md | 7 +- src/pkg/dashboard/ownership.go | 40 ++++++++ src/pkg/dashboard/ownership_11565_test.go | 4 +- .../ownership_issue_filter_admit_test.go | 99 +++++++++++++++++++ .../dashboard/static-src/js/label-filter.js | 4 +- src/pkg/dashboard/static/index.html | 4 +- src/pkg/dashboard/your_turn_ui_11566_test.go | 4 + src/pkg/github/issue_admitter.go | 4 + src/pkg/hiveadvisor/human_gate.go | 2 + 10 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 changelog.d/fixed-admit-filter-refused-issues.md create mode 100644 src/pkg/dashboard/ownership_issue_filter_admit_test.go diff --git a/changelog.d/fixed-admit-filter-refused-issues.md b/changelog.d/fixed-admit-filter-refused-issues.md new file mode 100644 index 0000000000..b800d566ca --- /dev/null +++ b/changelog.d/fixed-admit-filter-refused-issues.md @@ -0,0 +1 @@ +- Issues that the issue filter (`project.issue_filter.require_labels`) keeps off every agent queue now reach the inbox as `ADMIT` when someone has to let them in. That covers an issue carrying `approved-direction`: `/hive decision` and `/hive approve` apply that label, not the filter's. It also covers an agent's finding where agents self-authorize and no `TRIAGE` row applies (by default at L6). The reason names the labels that admit the issue. Before, on projectbluefin, testsuite#1091, server#622, dakota-iso#294 and others got an un-park reply saying "still outside the agent queue", while sitting in band "outside" with no verb. Agent findings such as testsuite#1085 and documentation#1630 had no inbox row either. diff --git a/src/docs/dashboard.md b/src/docs/dashboard.md index 06baa1d9f3..4cc75e94a4 100644 --- a/src/docs/dashboard.md +++ b/src/docs/dashboard.md @@ -729,6 +729,7 @@ so the reason text can change without breaking them. | `parked_needs_decision` | `DECIDE` | | `parked_needs_spec` | `SPEC` | | `untrusted_reporter` | `ADMIT` | +| `decided_not_admitted`, `agent_finding_not_admitted` | `ADMIT` | | `reporter_confirmation_stale` | `CLOSE` | | `verified_done` | `CLOSE` | | `agent_filed_unacknowledged` | `TRIAGE` | @@ -762,6 +763,8 @@ means the situation cannot occur at that level. | Unclaimed issue filed by a person | Not yours — backlog | Not yours — backlog, or a lane will act | Not yours — a lane will act | same | | Issue filed by an agent, not yet acknowledged, while the self-authorization hold is active (by default below L6) | — (no agent files issues) | Yours — `TRIAGE` | Yours — `TRIAGE` | Not yours by default (agents self-authorize); Yours — `TRIAGE` when the hold is configured on | | Issue from an untrusted reporter awaiting an admission label | Yours — `ADMIT` | same | same | same | +| Issue the issue filter (`project.issue_filter.require_labels`) refuses that carries `approved-direction` (a `/hive decision` or `/hive approve` applies it, not the filter's label) | Yours — `ADMIT` (`decided_not_admitted`; the reason names the labels that admit it) | same | same | same | +| Agent-filed issue the issue filter refuses, where the TRIAGE row above does not apply (agents self-authorize, by default at L6) | — (no agent files issues) | — (TRIAGE applies) | — (TRIAGE applies) | Yours — `ADMIT` (`agent_finding_not_admitted`: admit it, or close it if it no longer applies) | | Parked: `needs-decision` / `needs-direction` / `needs-human` | Yours — `DECIDE` / `STEER` / `REVIEW` | same | same | same — no lane ever takes a parked issue | | Parked: `needs-spec` | Yours — `SPEC` | same | same | same | | Agent PR held by the level gate (decided from the hold's recorded source, not from the repository's level) | — (no agent opens PRs) | Yours — `REVIEW` | Yours — `REVIEW` | A level hold placed before the level was raised stays until released: Yours — `REVIEW`. Outreach-lane PRs keep their hold: Yours — `REVIEW` | @@ -802,7 +805,9 @@ admission → `ADMIT`; (7) awaiting reporter confirmation → Not yours until it has had no activity for the stale period, then `CLOSE` (`reporter_confirmation_stale`); (8) verified done but not closed → `CLOSE`; (9) agent-filed and unacknowledged where acknowledgment is required → -`TRIAGE`; (10) for a pull request with a hold, the hold sources decide and no +`TRIAGE`; (9b) an issue the issue filter refuses that carries +`approved-direction` → `ADMIT` (`decided_not_admitted`), or that an agent filed +→ `ADMIT` (`agent_finding_not_admitted`); (10) for a pull request with a hold, the hold sources decide and no later row applies; for any other pull request, the PR rows of the table; (11) otherwise Not yours. The safety net then applies only to items that came out Not yours. Last, the gate rules apply to items diff --git a/src/pkg/dashboard/ownership.go b/src/pkg/dashboard/ownership.go index 3ffce4537e..2415380bf3 100644 --- a/src/pkg/dashboard/ownership.go +++ b/src/pkg/dashboard/ownership.go @@ -74,6 +74,12 @@ const ( OwnershipReasonPersonPRNeedsHuman = "person_pr_needs_human" OwnershipReasonReviewRequiresHuman = "review_requires_human" OwnershipReasonStaleSafetyNet = "stale_safety_net" + // The issue filter (project.issue_filter.require_labels) keeps these off + // every agent queue, so only a maintainer adding a required label lets + // them move: a decided issue, and an agent's finding where agents + // self-authorize (no TRIAGE row covers it). + OwnershipReasonDecidedNotAdmitted = "decided_not_admitted" + OwnershipReasonAgentFindingNotAdmitted = "agent_finding_not_admitted" ) // ownershipReasonVerbs is the fixed reason-code set with the one verb each @@ -103,6 +109,8 @@ var ownershipReasonVerbs = map[string]string{ OwnershipReasonPersonPRNeedsHuman: OwnershipVerbReview, OwnershipReasonReviewRequiresHuman: OwnershipVerbReview, OwnershipReasonStaleSafetyNet: OwnershipVerbReview, + OwnershipReasonDecidedNotAdmitted: OwnershipVerbAdmit, + OwnershipReasonAgentFindingNotAdmitted: OwnershipVerbAdmit, } // OwnershipActionReleaseHold is the dashboard's existing release-hold action. @@ -282,6 +290,9 @@ type ownershipEnv struct { // author in repo (automerge.Engine.MergeLaneTakesAuthor); nil turns the // hand-merge rule off. mergeLaneTakesAuthor func(repo, author string) bool + // admitLabels are project.issue_filter.require_labels: the labels that + // let an issue the filter refuses onto the agent queues. + admitLabels []string } func (e ownershipEnv) laneCanOpenPRFor(lane, repo string) bool { @@ -308,6 +319,20 @@ func (e ownershipEnv) selfAuthorizationHoldFor(repo string) bool { return e.selfAuthorizationHold(repo) } +// admitPhrase names what admits an issue the filter refuses. +func (e ownershipEnv) admitPhrase() string { + var named []string + for _, l := range e.admitLabels { + if l = strings.TrimSpace(l); l != "" { + named = append(named, "`"+l+"`") + } + } + if len(named) == 0 { + return "add an admission label to admit it" + } + return "add " + strings.Join(named, " or ") + " to admit it" +} + func (e ownershipEnv) releaseOnApproveFor(repo string) bool { return e.releaseOnApprove != nil && e.releaseOnApprove(repo) } @@ -608,6 +633,20 @@ func decideIssueOwnership(in issueOwnershipInput, env ownershipEnv) Ownership { if role := issueAgentRole(in.labels); role != "" && !in.acknowledged && !labels[ownershipLabelApprovedDirection] && env.selfAuthorizationHoldFor(in.repo) { return yourTurn(OwnershipReasonAgentFiledUnacknowledged, "Filed by agent "+role+" — acknowledge it or close it") } + // (9b) refused by the issue filter: no lane will ever see it, so a + // decided issue (`/hive decision` and `/hive approve` apply + // approved-direction, not the filter's label) or an agent's finding + // waits on a maintainer admitting it. projectbluefin/testsuite#1091 was + // approved at 20:31Z on 11-05; the un-park reply said "still outside the + // agent queue", and no inbox listed it. + if in.bucket == repoWorkBucketFiltered && in.bucketReason == github.IssueFilterReason { + if labels[ownershipLabelApprovedDirection] { + return yourTurn(OwnershipReasonDecidedNotAdmitted, "Decided, but the issue filter keeps it off the agent queue — "+env.admitPhrase()) + } + if role := issueAgentRole(in.labels); role != "" { + return yourTurn(OwnershipReasonAgentFindingNotAdmitted, "Filed by agent "+role+"; the issue filter keeps it off the agent queue — "+env.admitPhrase()+", or close it if it no longer applies") + } + } // (11) otherwise not your turn; the safety net may still apply. if issueSafetyNetCovers(in, labels, env) && env.stale(in.createdAt, in.updatedAt) { return safetyNetOwnership(env.untouchedDays(in.createdAt, in.updatedAt)) @@ -1012,6 +1051,7 @@ func newOwnershipEnv(cfg *config.Config, agentStatuses map[string]*crux.Process, } env.unparkCommandsRefused = func(repo string) bool { return labelDrivenRefusesUnparkCommands(cfg, repo) } env.releaseOnApprove = cfg.RepoReleaseOnApprove + env.admitLabels = cfg.Project.IssueFilter.RequireLabelsForNotice() env.laneCanOpenPR = laneCanOpenPRAt(env, agentStatuses) return env } diff --git a/src/pkg/dashboard/ownership_11565_test.go b/src/pkg/dashboard/ownership_11565_test.go index 898267c877..9e891d1ce3 100644 --- a/src/pkg/dashboard/ownership_11565_test.go +++ b/src/pkg/dashboard/ownership_11565_test.go @@ -502,8 +502,8 @@ func TestOwnershipSafetyNet11565(t *testing.T) { } func TestOwnershipFixedSets11565(t *testing.T) { - if len(ownershipReasonVerbs) != 32+len(operatorWaitReasonVerbs) { - t.Fatalf("reason codes = %d, want the 20 of #11507, review_requires_human (#12329), blocked_unexplained (#12376), the three review-hold codes of #12377, the three PR gates of #12378, superseded_recommended_close (#13114), superseded_extra_files_review (#14176), adjudicator_handed_off (#13183), adopted_push_refused and the run and approval waits (#12380)", len(ownershipReasonVerbs)) + if len(ownershipReasonVerbs) != 34+len(operatorWaitReasonVerbs) { + t.Fatalf("reason codes = %d, want the 20 of #11507, review_requires_human (#12329), blocked_unexplained (#12376), the three review-hold codes of #12377, the three PR gates of #12378, superseded_recommended_close (#13114), superseded_extra_files_review (#14176), adjudicator_handed_off (#13183), adopted_push_refused, the two issue-filter ADMIT codes and the run and approval waits (#12380)", len(ownershipReasonVerbs)) } verbs := map[string]bool{} for _, verb := range ownershipVerbOrder { diff --git a/src/pkg/dashboard/ownership_issue_filter_admit_test.go b/src/pkg/dashboard/ownership_issue_filter_admit_test.go new file mode 100644 index 0000000000..51104dfde0 --- /dev/null +++ b/src/pkg/dashboard/ownership_issue_filter_admit_test.go @@ -0,0 +1,99 @@ +package dashboard + +import ( + "strings" + "testing" + "time" + + "github.com/hivecommons/hive/pkg/config" + "github.com/hivecommons/hive/pkg/github" +) + +// The issue filter (project.issue_filter.require_labels) keeps an issue off +// every agent queue until a maintainer adds a required label. On +// projectbluefin (L6) the un-park replies of 11-05 20:19-20:37Z said "still +// outside the agent queue … A maintainer adding it admits this one" on +// testsuite#1091, server#622, dakota-iso#294 and others, and the agent +// findings testsuite#1085/#1090/#1094 and documentation#1630 had no TRIAGE +// row at L6: all sat in band "outside" with no verb and no inbox row. +func filterRefused(labels ...string) issueOwnershipInput { + return nonActionable11565(repoWorkBucketFiltered, github.IssueFilterReason, labels...) +} + +func TestIssueFilterRefusedDecidedAndAgentFindingsAreAdmit(t *testing.T) { + l6 := ownershipEnv11565(6) + l6.selfAuthorizationHold = func(string) bool { return false } + l6.admitLabels = []string{"triage/accepted"} + l5 := ownershipEnv11565(5) + l5.selfAuthorizationHold = func(string) bool { return true } + l5.admitLabels = []string{"triage/accepted"} + + decided := want11565{OwnershipVerbAdmit, OwnershipReasonDecidedNotAdmitted} + finding := want11565{OwnershipVerbAdmit, OwnershipReasonAgentFindingNotAdmitted} + for _, tc := range []struct { + name string + env ownershipEnv + in issueOwnershipInput + want want11565 + }{ + {"testsuite#1091: agent finding, /hive decision applied approved-direction", l6, filterRefused("security", "agent/sec-check", "approved-direction", "hive/workflows-lane"), decided}, + {"server#622: needs-triage too", l6, filterRefused("agent/ci-maintainer", "needs-kind", "needs-triage", "approved-direction", "ci", "hive/workflows-lane"), decided}, + {"utah-packages#882: a lapsed claim label does not hide it", l6, filterRefused("security", "agent/sec-check", "hive/claimed-by-sec-check", "approved-direction"), decided}, + {"a person's decided issue", l6, filterRefused("kind/feature", "approved-direction"), decided}, + {"decided at L5 too", l5, filterRefused("agent/quality", "approved-direction"), decided}, + {"testsuite#1085: reviewer finding at L6", l6, filterRefused("agent/reviewer"), finding}, + {"testsuite#1100: quality finding at L6", l6, filterRefused("testing", "agent/quality"), finding}, + {"agent finding at L5 stays TRIAGE", l5, filterRefused("agent/reviewer"), want11565{OwnershipVerbTriage, OwnershipReasonAgentFiledUnacknowledged}}, + {"a person's undecided issue stays outside", l6, filterRefused("kind/bug"), notYours11565}, + {"a decision park keeps DECIDE", l6, nonActionable11565(repoWorkBucketFiltered, config.DefaultNeedsDecisionLabel, "approved-direction", "stage/045-needs-decision"), want11565{OwnershipVerbDecide, OwnershipReasonParkedNeedsDecision}}, + {"filtered for another reason is not the filter's", l6, nonActionable11565(repoWorkBucketFiltered, "epic", "approved-direction", "epic"), notYours11565}, + {"an admitted decided issue is not ADMIT", l6, freshIssue11565("approved-direction", "triage/accepted"), notYours11565}, + } { + t.Run(tc.name, func(t *testing.T) { + checkOwnership11565(t, decideIssueOwnership(tc.in, tc.env), tc.want) + }) + } + + got := decideIssueOwnership(filterRefused("agent/sec-check", "approved-direction"), l6) + if !strings.Contains(got.Reason, "`triage/accepted`") { + t.Fatalf("reason %q must name the label that admits it", got.Reason) + } + l6.admitLabels = []string{"triage/accepted", "hive-ok"} + if got := decideIssueOwnership(filterRefused("agent/reviewer"), l6); !strings.Contains(got.Reason, "add `triage/accepted` or `hive-ok` to admit it, or close it") { + t.Fatalf("reason %q must name every admitting label and offer closing", got.Reason) + } + l6.admitLabels = nil + if got := decideIssueOwnership(filterRefused("approved-direction"), l6); !strings.Contains(got.Reason, "add an admission label") { + t.Fatalf("reason %q without configured labels", got.Reason) + } +} + +// End to end from the enumeration rows the dashboard stores, with the labels +// read from configuration: the rows are in the inbox as ADMIT. +func TestRepoOwnershipAdmitsFilterRefusedRows(t *testing.T) { + now := ownershipNow11565 + row := func(n int, labels ...string) github.RepoWorkIssue { + return github.RepoWorkIssue{Repo: "projectbluefin/testsuite", Number: n, Labels: labels, + Bucket: repoWorkBucketFiltered, Reason: github.IssueFilterReason, + CreatedAt: now.Add(-24 * time.Hour), UpdatedAt: now.Add(-time.Hour)} + } + cfg := &config.Config{} + cfg.Project.IssueFilter.RequireLabels = []string{"triage/accepted"} + env := newOwnershipEnv(cfg, nil, "", now, nil) + env.selfAuthorizationHold = func(string) bool { return false } + repos := []FrontendRepo{{Name: "testsuite", Full: "projectbluefin/testsuite", NonActionableIssues: []any{ + row(1091, "security", "agent/sec-check", "approved-direction"), + row(1085, "agent/reviewer"), + row(1087), + }}} + decideRepoOwnership(repos, config.DashboardIssueBandsConfig{}, env) + for n, code := range map[int]string{1091: OwnershipReasonDecidedNotAdmitted, 1085: OwnershipReasonAgentFindingNotAdmitted} { + d := ownershipFor(repos[0].Ownership, ownershipKindIssue, n) + if d == nil || !d.YourTurn || d.Verb != OwnershipVerbAdmit || d.ReasonCode != code || !strings.Contains(d.Reason, "`triage/accepted`") { + t.Errorf("#%d = %+v, want ADMIT %s naming triage/accepted", n, d, code) + } + } + if d := ownershipFor(repos[0].Ownership, ownershipKindIssue, 1087); d != nil && d.YourTurn { + t.Errorf("#1087 (a person's, undecided) = %+v, want not your turn", d) + } +} diff --git a/src/pkg/dashboard/static-src/js/label-filter.js b/src/pkg/dashboard/static-src/js/label-filter.js index c47bcc3070..2c67e84026 100644 --- a/src/pkg/dashboard/static-src/js/label-filter.js +++ b/src/pkg/dashboard/static-src/js/label-filter.js @@ -100,7 +100,9 @@ if (own.verb === 'TRIAGE') { after.push({ type: 'note', text: 'Adding the approved-direction label, assigning a person, or closing it acknowledges it.' }); } - if (own.verb === 'ADMIT') { + // The issue-filter ADMIT rows name the filter's own labels in the + // reason; admissionLabels are reporter trust's. + if (own.verb === 'ADMIT' && own.reason_code !== 'decided_not_admitted' && own.reason_code !== 'agent_finding_not_admitted') { const labels = (ctx.admissionLabels || []).filter(Boolean); after.push({ type: 'note', text: labels.length ? 'Add the label ' + labels.join(' or ') + ' to admit it.' : 'Add an admission label to admit it.' }); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f81d868e23..e6ce30332a 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -34876,7 +34876,9 @@

Approval and audit records

${approval}`; if (own.verb === 'TRIAGE') { after.push({ type: 'note', text: 'Adding the approved-direction label, assigning a person, or closing it acknowledges it.' }); } - if (own.verb === 'ADMIT') { + // The issue-filter ADMIT rows name the filter's own labels in the + // reason; admissionLabels are reporter trust's. + if (own.verb === 'ADMIT' && own.reason_code !== 'decided_not_admitted' && own.reason_code !== 'agent_finding_not_admitted') { const labels = (ctx.admissionLabels || []).filter(Boolean); after.push({ type: 'note', text: labels.length ? 'Add the label ' + labels.join(' or ') + ' to admit it.' : 'Add an admission label to admit it.' }); } diff --git a/src/pkg/dashboard/your_turn_ui_11566_test.go b/src/pkg/dashboard/your_turn_ui_11566_test.go index 6bf9cafd7c..4685206e03 100644 --- a/src/pkg/dashboard/your_turn_ui_11566_test.go +++ b/src/pkg/dashboard/your_turn_ui_11566_test.go @@ -830,6 +830,10 @@ assert.deepEqual(kinds(model(own('SPEC', 'parked_needs_spec'), { hasPlan: true } assert.match(kinds(model(own('TRIAGE', 'agent_filed_unacknowledged')))[1], /approved-direction label, assigning a person, or closing/); assert.deepEqual(kinds(model(own('TRIAGE', 'agent_filed_unacknowledged'))).length, 2); assert.deepEqual(kinds(model(own('ADMIT', 'untrusted_reporter'))), [open, 'note:Add the label triage-ok to admit it.']); +// The issue-filter ADMIT rows name the filter's labels in their reason; the +// reporter-trust labels would be the wrong ones. +assert.deepEqual(kinds(model(own('ADMIT', 'decided_not_admitted'))), [open]); +assert.deepEqual(kinds(model(own('ADMIT', 'agent_finding_not_admitted'))), [open]); assert.match(kinds(model(own('INSPECT', 'sentinel_flagged')))[1], /Removing the sentinel-alert label after review releases it/); assert.deepEqual(kinds(model(own('CLOSE', 'reporter_confirmation_stale'))), [open, 'copy:/fixed']); assert.deepEqual(kinds(model(own('CLOSE', 'verified_done'))), [open]); diff --git a/src/pkg/github/issue_admitter.go b/src/pkg/github/issue_admitter.go index a54bda223d..a1165dc66a 100644 --- a/src/pkg/github/issue_admitter.go +++ b/src/pkg/github/issue_admitter.go @@ -61,6 +61,10 @@ type ReporterTrustClankerConfig interface { // and a refused issue is outside the pipeline until a required label lands. const issueFilterReason = "Project issue filter" +// IssueFilterReason is issueFilterReason for readers of the work detail +// (the dashboard's your-turn decision). +const IssueFilterReason = issueFilterReason + // IssueFilterNoticeConfig is the optional user-facing side of Admits: the // labels that would admit an issue the filter refuses, named in a reply. // config.IssueFilterConfig implements it. diff --git a/src/pkg/hiveadvisor/human_gate.go b/src/pkg/hiveadvisor/human_gate.go index 504282d17e..ba4f05a847 100644 --- a/src/pkg/hiveadvisor/human_gate.go +++ b/src/pkg/hiveadvisor/human_gate.go @@ -59,6 +59,8 @@ var gateReasons = map[string]gateReason{ "adopted_push_refused": {"adopted by the hive on branches it cannot push", "push the fixes or close the adopted PRs the hive cannot push in %s"}, "stale_safety_net": {"untouched long enough that the safety net handed them to a person", "look at the long-untouched items in %s"}, "blocked_unexplained": {"labelled blocked with no blocker named", "name the blocker or lift the label"}, + "decided_not_admitted": {"decided by a maintainer but kept off the agent queues by the issue filter", "add the admission label to the decided issues in %s"}, + "agent_finding_not_admitted": {"agent findings the issue filter keeps off the agent queues", "admit or close the agent findings in %s"}, "pr_gate_label": {"held by a gate label", "act on the gate labels or remove them"}, "hand_merge_required": {"that only a person can merge", "merge the reviewed PRs by hand in %s"}, "review_decision_required": {"waiting for an approving review that branch protection requires", "approve PRs in %s"}, From d6061642b6057720aea8e835908be1a0efc20850 Mon Sep 17 00:00:00 2001 From: Danathar Date: Thu, 5 Nov 2026 17:51:17 -0500 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix(ownership):=20a=20person?= =?UTF-8?q?'s=20undecided=20issue=20the=20filter=20refuses=20is=20ADMIT=20?= =?UTF-8?q?too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Doug's call on #16831: an issue a person filed that only the missing project.issue_filter.require_labels keeps out gets ADMIT (person_issue_not_admitted) with "admit it so the hive works it, or close it". Holds, exempt, tracking, blocked, parks, reporter confirmation, reporter triage and standing dashboards are decided before the filter and keep their rows; a bot's issue stays outside. The ADMIT menu's reporter-trust note now shows only on untrusted_reporter. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- .../fixed-admit-filter-refused-issues.md | 2 +- src/docs/dashboard.md | 8 ++-- src/pkg/dashboard/ownership.go | 19 ++++++++- src/pkg/dashboard/ownership_11565_test.go | 4 +- .../ownership_issue_filter_admit_test.go | 40 ++++++++++++++++--- .../dashboard/static-src/js/label-filter.js | 2 +- src/pkg/dashboard/static/index.html | 2 +- src/pkg/dashboard/your_turn_ui_11566_test.go | 1 + src/pkg/hiveadvisor/human_gate.go | 1 + 9 files changed, 64 insertions(+), 15 deletions(-) diff --git a/changelog.d/fixed-admit-filter-refused-issues.md b/changelog.d/fixed-admit-filter-refused-issues.md index b800d566ca..dae8aad895 100644 --- a/changelog.d/fixed-admit-filter-refused-issues.md +++ b/changelog.d/fixed-admit-filter-refused-issues.md @@ -1 +1 @@ -- Issues that the issue filter (`project.issue_filter.require_labels`) keeps off every agent queue now reach the inbox as `ADMIT` when someone has to let them in. That covers an issue carrying `approved-direction`: `/hive decision` and `/hive approve` apply that label, not the filter's. It also covers an agent's finding where agents self-authorize and no `TRIAGE` row applies (by default at L6). The reason names the labels that admit the issue. Before, on projectbluefin, testsuite#1091, server#622, dakota-iso#294 and others got an un-park reply saying "still outside the agent queue", while sitting in band "outside" with no verb. Agent findings such as testsuite#1085 and documentation#1630 had no inbox row either. +- Issues that the issue filter (`project.issue_filter.require_labels`) keeps off every agent queue now reach the inbox as `ADMIT` when someone has to let them in. That covers an issue carrying `approved-direction`: `/hive decision` and `/hive approve` apply that label, not the filter's. It also covers an agent's finding where agents self-authorize and no `TRIAGE` row applies (by default at L6), and an undecided issue a person filed. The reason names the labels that admit the issue. Before, on projectbluefin, testsuite#1091, server#622, dakota-iso#294 and others got an un-park reply saying "still outside the agent queue", while sitting in band "outside" with no verb. Agent findings such as testsuite#1085 and documentation#1630 had no inbox row either. diff --git a/src/docs/dashboard.md b/src/docs/dashboard.md index 4cc75e94a4..6ba85842f0 100644 --- a/src/docs/dashboard.md +++ b/src/docs/dashboard.md @@ -729,7 +729,7 @@ so the reason text can change without breaking them. | `parked_needs_decision` | `DECIDE` | | `parked_needs_spec` | `SPEC` | | `untrusted_reporter` | `ADMIT` | -| `decided_not_admitted`, `agent_finding_not_admitted` | `ADMIT` | +| `decided_not_admitted`, `agent_finding_not_admitted`, `person_issue_not_admitted` | `ADMIT` | | `reporter_confirmation_stale` | `CLOSE` | | `verified_done` | `CLOSE` | | `agent_filed_unacknowledged` | `TRIAGE` | @@ -765,6 +765,7 @@ means the situation cannot occur at that level. | Issue from an untrusted reporter awaiting an admission label | Yours — `ADMIT` | same | same | same | | Issue the issue filter (`project.issue_filter.require_labels`) refuses that carries `approved-direction` (a `/hive decision` or `/hive approve` applies it, not the filter's label) | Yours — `ADMIT` (`decided_not_admitted`; the reason names the labels that admit it) | same | same | same | | Agent-filed issue the issue filter refuses, where the TRIAGE row above does not apply (agents self-authorize, by default at L6) | — (no agent files issues) | — (TRIAGE applies) | — (TRIAGE applies) | Yours — `ADMIT` (`agent_finding_not_admitted`: admit it, or close it if it no longer applies) | +| Person-filed issue the issue filter refuses, undecided (only the missing `require_labels` keeps it out: holds, exempt, tracking, `blocked`, parks, reporter confirmation, reporter triage and standing dashboards are decided before the filter and keep their own rows; a bot's issue stays Not yours) | Yours — `ADMIT` (`person_issue_not_admitted`: admit it so the hive works it, or close it) | same | same | same | | Parked: `needs-decision` / `needs-direction` / `needs-human` | Yours — `DECIDE` / `STEER` / `REVIEW` | same | same | same — no lane ever takes a parked issue | | Parked: `needs-spec` | Yours — `SPEC` | same | same | same | | Agent PR held by the level gate (decided from the hold's recorded source, not from the repository's level) | — (no agent opens PRs) | Yours — `REVIEW` | Yours — `REVIEW` | A level hold placed before the level was raised stays until released: Yours — `REVIEW`. Outreach-lane PRs keep their hold: Yours — `REVIEW` | @@ -806,8 +807,9 @@ has had no activity for the stale period, then `CLOSE` (`reporter_confirmation_stale`); (8) verified done but not closed → `CLOSE`; (9) agent-filed and unacknowledged where acknowledgment is required → `TRIAGE`; (9b) an issue the issue filter refuses that carries -`approved-direction` → `ADMIT` (`decided_not_admitted`), or that an agent filed -→ `ADMIT` (`agent_finding_not_admitted`); (10) for a pull request with a hold, the hold sources decide and no +`approved-direction` → `ADMIT` (`decided_not_admitted`), that an agent filed +→ `ADMIT` (`agent_finding_not_admitted`), or that a person filed → `ADMIT` +(`person_issue_not_admitted`); (10) for a pull request with a hold, the hold sources decide and no later row applies; for any other pull request, the PR rows of the table; (11) otherwise Not yours. The safety net then applies only to items that came out Not yours. Last, the gate rules apply to items diff --git a/src/pkg/dashboard/ownership.go b/src/pkg/dashboard/ownership.go index 2415380bf3..d2474d6566 100644 --- a/src/pkg/dashboard/ownership.go +++ b/src/pkg/dashboard/ownership.go @@ -80,6 +80,7 @@ const ( // self-authorize (no TRIAGE row covers it). OwnershipReasonDecidedNotAdmitted = "decided_not_admitted" OwnershipReasonAgentFindingNotAdmitted = "agent_finding_not_admitted" + OwnershipReasonPersonIssueNotAdmitted = "person_issue_not_admitted" ) // ownershipReasonVerbs is the fixed reason-code set with the one verb each @@ -111,6 +112,7 @@ var ownershipReasonVerbs = map[string]string{ OwnershipReasonStaleSafetyNet: OwnershipVerbReview, OwnershipReasonDecidedNotAdmitted: OwnershipVerbAdmit, OwnershipReasonAgentFindingNotAdmitted: OwnershipVerbAdmit, + OwnershipReasonPersonIssueNotAdmitted: OwnershipVerbAdmit, } // OwnershipActionReleaseHold is the dashboard's existing release-hold action. @@ -507,6 +509,9 @@ type issueOwnershipInput struct { number int labels []string acknowledged bool + // authorIsHuman is the enumeration's reporter classification + // (RepoWorkIssue.AuthorIsHuman) for a non-actionable row. + authorIsHuman bool // openLinkedPR is set when the issue has an open (unmerged) linked PR or // open PR claim context. openLinkedPR bool @@ -635,8 +640,11 @@ func decideIssueOwnership(in issueOwnershipInput, env ownershipEnv) Ownership { } // (9b) refused by the issue filter: no lane will ever see it, so a // decided issue (`/hive decision` and `/hive approve` apply - // approved-direction, not the filter's label) or an agent's finding - // waits on a maintainer admitting it. projectbluefin/testsuite#1091 was + // approved-direction, not the filter's label), an agent's finding or a + // person's issue waits on a maintainer admitting it. Only the filter's + // own refusal counts: holds, exempt, tracking, blocked, park and + // reporter-confirmation rows and standing dashboards carry other + // buckets or reasons (client.go fetchIssues decides those first). projectbluefin/testsuite#1091 was // approved at 20:31Z on 11-05; the un-park reply said "still outside the // agent queue", and no inbox listed it. if in.bucket == repoWorkBucketFiltered && in.bucketReason == github.IssueFilterReason { @@ -646,6 +654,12 @@ func decideIssueOwnership(in issueOwnershipInput, env ownershipEnv) Ownership { if role := issueAgentRole(in.labels); role != "" { return yourTurn(OwnershipReasonAgentFindingNotAdmitted, "Filed by agent "+role+"; the issue filter keeps it off the agent queue — "+env.admitPhrase()+", or close it if it no longer applies") } + // A person's issue nobody has decided: the filter only ever lets it + // in by a maintainer's label. A bot's (not a standing dashboard, + // which never reaches this bucket) stays outside. + if in.authorIsHuman { + return yourTurn(OwnershipReasonPersonIssueNotAdmitted, "A person filed this; the issue filter keeps it off the agent queue — "+env.admitPhrase()+" so the hive works it, or close it") + } } // (11) otherwise not your turn; the safety net may still apply. if issueSafetyNetCovers(in, labels, env) && env.stale(in.createdAt, in.updatedAt) { @@ -950,6 +964,7 @@ func decideRepoOwnership(repos []FrontendRepo, cfg config.DashboardIssueBandsCon createdAt: item.CreatedAt, updatedAt: item.UpdatedAt, reporterGate: item.ReporterConfirmationGate, + authorIsHuman: item.AuthorIsHuman, bucket: item.Bucket, bucketReason: item.Reason, decisionBlocker: decisionBlockerFor(nonEmpty(item.Repo, repoName)+"#"+strconv.Itoa(item.Number), item.OpenBlockers, decisionParks, repoName), diff --git a/src/pkg/dashboard/ownership_11565_test.go b/src/pkg/dashboard/ownership_11565_test.go index 9e891d1ce3..ff54edd64e 100644 --- a/src/pkg/dashboard/ownership_11565_test.go +++ b/src/pkg/dashboard/ownership_11565_test.go @@ -502,8 +502,8 @@ func TestOwnershipSafetyNet11565(t *testing.T) { } func TestOwnershipFixedSets11565(t *testing.T) { - if len(ownershipReasonVerbs) != 34+len(operatorWaitReasonVerbs) { - t.Fatalf("reason codes = %d, want the 20 of #11507, review_requires_human (#12329), blocked_unexplained (#12376), the three review-hold codes of #12377, the three PR gates of #12378, superseded_recommended_close (#13114), superseded_extra_files_review (#14176), adjudicator_handed_off (#13183), adopted_push_refused, the two issue-filter ADMIT codes and the run and approval waits (#12380)", len(ownershipReasonVerbs)) + if len(ownershipReasonVerbs) != 35+len(operatorWaitReasonVerbs) { + t.Fatalf("reason codes = %d, want the 20 of #11507, review_requires_human (#12329), blocked_unexplained (#12376), the three review-hold codes of #12377, the three PR gates of #12378, superseded_recommended_close (#13114), superseded_extra_files_review (#14176), adjudicator_handed_off (#13183), adopted_push_refused, the three issue-filter ADMIT codes and the run and approval waits (#12380)", len(ownershipReasonVerbs)) } verbs := map[string]bool{} for _, verb := range ownershipVerbOrder { diff --git a/src/pkg/dashboard/ownership_issue_filter_admit_test.go b/src/pkg/dashboard/ownership_issue_filter_admit_test.go index 51104dfde0..d155f542f6 100644 --- a/src/pkg/dashboard/ownership_issue_filter_admit_test.go +++ b/src/pkg/dashboard/ownership_issue_filter_admit_test.go @@ -20,6 +20,12 @@ func filterRefused(labels ...string) issueOwnershipInput { return nonActionable11565(repoWorkBucketFiltered, github.IssueFilterReason, labels...) } +func personRefused(labels ...string) issueOwnershipInput { + in := filterRefused(labels...) + in.authorIsHuman = true + return in +} + func TestIssueFilterRefusedDecidedAndAgentFindingsAreAdmit(t *testing.T) { l6 := ownershipEnv11565(6) l6.selfAuthorizationHold = func(string) bool { return false } @@ -30,6 +36,7 @@ func TestIssueFilterRefusedDecidedAndAgentFindingsAreAdmit(t *testing.T) { decided := want11565{OwnershipVerbAdmit, OwnershipReasonDecidedNotAdmitted} finding := want11565{OwnershipVerbAdmit, OwnershipReasonAgentFindingNotAdmitted} + person := want11565{OwnershipVerbAdmit, OwnershipReasonPersonIssueNotAdmitted} for _, tc := range []struct { name string env ownershipEnv @@ -44,7 +51,25 @@ func TestIssueFilterRefusedDecidedAndAgentFindingsAreAdmit(t *testing.T) { {"testsuite#1085: reviewer finding at L6", l6, filterRefused("agent/reviewer"), finding}, {"testsuite#1100: quality finding at L6", l6, filterRefused("testing", "agent/quality"), finding}, {"agent finding at L5 stays TRIAGE", l5, filterRefused("agent/reviewer"), want11565{OwnershipVerbTriage, OwnershipReasonAgentFiledUnacknowledged}}, - {"a person's undecided issue stays outside", l6, filterRefused("kind/bug"), notYours11565}, + {"a person's undecided issue", l6, personRefused("kind/bug"), person}, + {"a person's undecided issue at L5", l5, personRefused(), person}, + {"a person's decided issue is decided", l6, personRefused("approved-direction"), decided}, + {"a bot's issue (not a dashboard) stays outside", l6, filterRefused("dependencies"), notYours11565}, + {"a person's issue held by a park keeps the park", l6, func() issueOwnershipInput { + in := nonActionable11565(repoWorkBucketFiltered, config.DefaultNeedsSpecLabel, "needs-spec") + in.authorIsHuman = true + return in + }(), want11565{OwnershipVerbSpec, OwnershipReasonParkedNeedsSpec}}, + {"a person's exempt issue stays outside", l6, func() issueOwnershipInput { + in := nonActionable11565(repoWorkBucketFiltered, "Exempt label", "wontfix") + in.authorIsHuman = true + return in + }(), notYours11565}, + {"a person's issue under reporter triage stays untrusted_reporter", l6, func() issueOwnershipInput { + in := nonActionable11565(repoWorkBucketReporterTriage, "", "kind/bug") + in.authorIsHuman = true + return in + }(), want11565{OwnershipVerbAdmit, OwnershipReasonUntrustedReporter}}, {"a decision park keeps DECIDE", l6, nonActionable11565(repoWorkBucketFiltered, config.DefaultNeedsDecisionLabel, "approved-direction", "stage/045-needs-decision"), want11565{OwnershipVerbDecide, OwnershipReasonParkedNeedsDecision}}, {"filtered for another reason is not the filter's", l6, nonActionable11565(repoWorkBucketFiltered, "epic", "approved-direction", "epic"), notYours11565}, {"an admitted decided issue is not ADMIT", l6, freshIssue11565("approved-direction", "triage/accepted"), notYours11565}, @@ -62,6 +87,9 @@ func TestIssueFilterRefusedDecidedAndAgentFindingsAreAdmit(t *testing.T) { if got := decideIssueOwnership(filterRefused("agent/reviewer"), l6); !strings.Contains(got.Reason, "add `triage/accepted` or `hive-ok` to admit it, or close it") { t.Fatalf("reason %q must name every admitting label and offer closing", got.Reason) } + if got := decideIssueOwnership(personRefused(), l6); !strings.Contains(got.Reason, "A person filed this") || !strings.Contains(got.Reason, "so the hive works it, or close it") { + t.Fatalf("person reason %q", got.Reason) + } l6.admitLabels = nil if got := decideIssueOwnership(filterRefused("approved-direction"), l6); !strings.Contains(got.Reason, "add an admission label") { t.Fatalf("reason %q without configured labels", got.Reason) @@ -77,6 +105,7 @@ func TestRepoOwnershipAdmitsFilterRefusedRows(t *testing.T) { Bucket: repoWorkBucketFiltered, Reason: github.IssueFilterReason, CreatedAt: now.Add(-24 * time.Hour), UpdatedAt: now.Add(-time.Hour)} } + human := func(r github.RepoWorkIssue) github.RepoWorkIssue { r.AuthorIsHuman = true; return r } cfg := &config.Config{} cfg.Project.IssueFilter.RequireLabels = []string{"triage/accepted"} env := newOwnershipEnv(cfg, nil, "", now, nil) @@ -84,16 +113,17 @@ func TestRepoOwnershipAdmitsFilterRefusedRows(t *testing.T) { repos := []FrontendRepo{{Name: "testsuite", Full: "projectbluefin/testsuite", NonActionableIssues: []any{ row(1091, "security", "agent/sec-check", "approved-direction"), row(1085, "agent/reviewer"), - row(1087), + human(row(1087)), + row(1200, "dependencies"), }}} decideRepoOwnership(repos, config.DashboardIssueBandsConfig{}, env) - for n, code := range map[int]string{1091: OwnershipReasonDecidedNotAdmitted, 1085: OwnershipReasonAgentFindingNotAdmitted} { + for n, code := range map[int]string{1091: OwnershipReasonDecidedNotAdmitted, 1085: OwnershipReasonAgentFindingNotAdmitted, 1087: OwnershipReasonPersonIssueNotAdmitted} { d := ownershipFor(repos[0].Ownership, ownershipKindIssue, n) if d == nil || !d.YourTurn || d.Verb != OwnershipVerbAdmit || d.ReasonCode != code || !strings.Contains(d.Reason, "`triage/accepted`") { t.Errorf("#%d = %+v, want ADMIT %s naming triage/accepted", n, d, code) } } - if d := ownershipFor(repos[0].Ownership, ownershipKindIssue, 1087); d != nil && d.YourTurn { - t.Errorf("#1087 (a person's, undecided) = %+v, want not your turn", d) + if d := ownershipFor(repos[0].Ownership, ownershipKindIssue, 1200); d != nil && d.YourTurn { + t.Errorf("#1200 (a bot's, undecided) = %+v, want not your turn", d) } } diff --git a/src/pkg/dashboard/static-src/js/label-filter.js b/src/pkg/dashboard/static-src/js/label-filter.js index 2c67e84026..af073a79f1 100644 --- a/src/pkg/dashboard/static-src/js/label-filter.js +++ b/src/pkg/dashboard/static-src/js/label-filter.js @@ -102,7 +102,7 @@ } // The issue-filter ADMIT rows name the filter's own labels in the // reason; admissionLabels are reporter trust's. - if (own.verb === 'ADMIT' && own.reason_code !== 'decided_not_admitted' && own.reason_code !== 'agent_finding_not_admitted') { + if (own.verb === 'ADMIT' && own.reason_code === 'untrusted_reporter') { const labels = (ctx.admissionLabels || []).filter(Boolean); after.push({ type: 'note', text: labels.length ? 'Add the label ' + labels.join(' or ') + ' to admit it.' : 'Add an admission label to admit it.' }); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index e6ce30332a..d403a67a5a 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -34878,7 +34878,7 @@

Approval and audit records

${approval}`; } // The issue-filter ADMIT rows name the filter's own labels in the // reason; admissionLabels are reporter trust's. - if (own.verb === 'ADMIT' && own.reason_code !== 'decided_not_admitted' && own.reason_code !== 'agent_finding_not_admitted') { + if (own.verb === 'ADMIT' && own.reason_code === 'untrusted_reporter') { const labels = (ctx.admissionLabels || []).filter(Boolean); after.push({ type: 'note', text: labels.length ? 'Add the label ' + labels.join(' or ') + ' to admit it.' : 'Add an admission label to admit it.' }); } diff --git a/src/pkg/dashboard/your_turn_ui_11566_test.go b/src/pkg/dashboard/your_turn_ui_11566_test.go index 4685206e03..6ffc366b98 100644 --- a/src/pkg/dashboard/your_turn_ui_11566_test.go +++ b/src/pkg/dashboard/your_turn_ui_11566_test.go @@ -834,6 +834,7 @@ assert.deepEqual(kinds(model(own('ADMIT', 'untrusted_reporter'))), [open, 'note: // reporter-trust labels would be the wrong ones. assert.deepEqual(kinds(model(own('ADMIT', 'decided_not_admitted'))), [open]); assert.deepEqual(kinds(model(own('ADMIT', 'agent_finding_not_admitted'))), [open]); +assert.deepEqual(kinds(model(own('ADMIT', 'person_issue_not_admitted'))), [open]); assert.match(kinds(model(own('INSPECT', 'sentinel_flagged')))[1], /Removing the sentinel-alert label after review releases it/); assert.deepEqual(kinds(model(own('CLOSE', 'reporter_confirmation_stale'))), [open, 'copy:/fixed']); assert.deepEqual(kinds(model(own('CLOSE', 'verified_done'))), [open]); diff --git a/src/pkg/hiveadvisor/human_gate.go b/src/pkg/hiveadvisor/human_gate.go index ba4f05a847..5898b843ea 100644 --- a/src/pkg/hiveadvisor/human_gate.go +++ b/src/pkg/hiveadvisor/human_gate.go @@ -61,6 +61,7 @@ var gateReasons = map[string]gateReason{ "blocked_unexplained": {"labelled blocked with no blocker named", "name the blocker or lift the label"}, "decided_not_admitted": {"decided by a maintainer but kept off the agent queues by the issue filter", "add the admission label to the decided issues in %s"}, "agent_finding_not_admitted": {"agent findings the issue filter keeps off the agent queues", "admit or close the agent findings in %s"}, + "person_issue_not_admitted": {"filed by people and kept off the agent queues by the issue filter", "admit or close the people's issues in %s"}, "pr_gate_label": {"held by a gate label", "act on the gate labels or remove them"}, "hand_merge_required": {"that only a person can merge", "merge the reviewed PRs by hand in %s"}, "review_decision_required": {"waiting for an approving review that branch protection requires", "approve PRs in %s"},