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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-advisory-issue-noise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Dedupe advisories with nothing to act on are no longer filed as issues, and advisory issues no longer look like stalled work ([#15381](https://github.com/hivecommons/hive/issues/15381)): the dedupe lane's prompt files a new checklist only for an action-required row, and the issue-request relay refuses an `issue-create` whose dedupe-checklist body has zero near-duplicate pairs, zero resolved candidates, zero missing PR↔issue links and no task lines (audited as `agent_issue_empty_advisory_refused`, summarised in a knowledge bead). In the Activity Monitor an issue wearing `triage/advisory`, carrying the dedupe-checklist marker or a `Decision required: no` line is an advisory: the Open chevron reads **Advisory · read & close** (or **Advisory · nothing found · safe to close** when its own counts are all zero) with no "· since Nh" or stale tint, the caption is *Advisory for maintainers · read, then close*, it is excluded from Needs human / Needs attention, and the row menu leads with **Close (read)**, which closes the issue as completed through the existing decision path (`close-read`).
6 changes: 6 additions & 0 deletions src/docs/dashboard-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,12 @@ The *since* time is the item's `created_at`; "next pass" is the governor's next

A row that already wears a hold, `blocked`, a draft marker or any stage record is never *New*; neither is an issue at `015` once the stage-label pass has written it.

#### Advisory row (`triage/advisory`, dedupe checklists)

An issue that is a note for maintainers rather than work — one wearing `triage/advisory`, a dedupe-agent checklist (body opens with `<!-- hive:dedupe-checklist repo=… -->`) or any body whose verdict line reads `Decision required: no` — is an **advisory** ([#15381](https://github.com/hivecommons/hive/issues/15381) sat for hours as a plain *Open · since 3h*, indistinguishable from stalled work). Its row keeps `kind: issue` and carries `advisory{kind: "advisory", source (label|dedupe-checklist|decision-no), empty, chip, caption}`; the Open chevron reads the chip — **Advisory · read & close**, or **Advisory · nothing found · safe to close** when the checklist's own counts are all zero — muted (`ham-open-advisory`, ⓘ), with no *· since Nh* suffix and never the stale tint. The caption is *Advisory for maintainers · read, then close* (or *… · nothing found · safe to close*), the actor is a human with nothing waiting on them, the row is never *New*, never *stalled* or *sent back*, and it is excluded from **Needs human** and **Needs attention**. The row menu leads with **Close (read)**, which posts the existing `POST /api/repos/{owner}/{repo}/items/{number}/decision` with `decision: close-read`: a "Closed as read (advisory acknowledged) by @you from the Hive dashboard" comment, then the issue closes as *completed* (operator action `close-read` in the row's history).

The enumeration computes the body-derived part (`RepoWorkIssue.advisory`) because sidelined `hive_advisory` rows do not carry the body. Upstream, the issue-request relay refuses an agent's `issue-create` whose body is a dedupe checklist with no actionable finding (verdict `no`, zero near-duplicate pairs, zero resolved candidates, zero missing PR↔issue links, no `- [ ]` task lines): the agent's result file says why, the write audit records `agent_issue_empty_advisory_refused`, and a knowledge bead keeps the summary in the hive's own log — merge-order reminders and cross-links are notes, not issues.

#### Hive's own unblock is live

When the blocked sweep or the review-backlog block reconciler lifts `blocked` itself (the tracked PR merged or closed; the `<!-- hive:unblocked -->` note), it takes the same path as an inbound label webhook: the tracker cache is dropped and the issue is queued for the targeted re-read (`ItemPatches` delivery `self:edit`), which patches the status row and the governor's cached snapshot at once. A reconcile enumeration that was already listing when the unblock happened used to overwrite that patch with its pre-unblock copy, and the rows reverted to `blocked` until the next pass (~an hour on the hive's hive); the governor now replays re-reads newer than the listing's start onto the pass's result before publishing it, so a row never moves backwards behind a read it has already made.
Expand Down
2 changes: 1 addition & 1 deletion src/docs/scale-envelope.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ones to:
2. **Truncation must preserve the prioritization signal, not cut an arbitrary slice.**
This holds today and is easy to assume backwards:
- Issues are sorted by actionable rank tier, then **oldest first** within each tier before any cap is applied
(`RankActionableIssues`, `src/pkg/github/client.go:4794-4804`, descending `AgeMinutes` within each tier).
(`RankActionableIssues`, `src/pkg/github/client.go:4804-4814`, descending `AgeMinutes` within each tier).
- PRs are sorted by **review class then oldest-first within class**
(`SortPullRequestsForReview`, `src/pkg/github/review_priority.go:334`;
fixes → refactors/docs → tests).
Expand Down
25 changes: 21 additions & 4 deletions src/pkg/dashboard/api_repo_item_decision.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ const (
repoItemDecisionDirection = "direction"
repoItemDecisionCloseSuperseded = "close-superseded"
repoItemDecisionCloseWontFix = "close-wontfix"
repoItemDecisionAdopt = "adopt"
// close-read closes an advisory issue (triage/advisory, a dedupe
// checklist) as completed once a maintainer has read it
// (hivecommons/hive#15381): the row's "Close (read)" action.
repoItemDecisionCloseRead = "close-read"
repoItemDecisionAdopt = "adopt"
// Merge-gate answers on a PR parked at stage/090-ready-for-human-merge
// (hivecommons/hive#15078). merge-now merges through the hive's App at
// once, attributed to the operator; queue-merge records the operator's
Expand Down Expand Up @@ -97,6 +101,7 @@ const (
adoptRequestLabelDesc = "Owner-delegate request: adopt now in supersede mode"

issueStateReasonNotPlanned = "not_planned"
issueStateReasonCompleted = "completed"
)

// repoItemDecisionChangeRequests is the store a PR direction is recorded in:
Expand Down Expand Up @@ -274,6 +279,10 @@ func repoItemDecisionResultWith(repoFull string, number int, itemType, decision,
out.Action = rowActionClosed
out.Outcome = "Closed as won't fix (not planned)."
out.Next = "Nothing further to do; the row leaves the tracker on its next refresh."
case repoItemDecisionCloseRead:
out.Action = rowActionClosed
out.Outcome = "Closed as read (advisory acknowledged)."
out.Next = "Nothing further to do; the row leaves the tracker on its next refresh."
case repoItemDecisionAdopt:
out.Action = rowActionAdopted
out.Outcome = "Adoption queued: `" + label + "` applied."
Expand Down Expand Up @@ -385,9 +394,17 @@ func (s *Server) handleRepoItemDecision(w http.ResponseWriter, r *http.Request)
s.audit.LogRecord(user, action, auditDetail("repo", repoFull, "number", numStr, "decision", event.Decision), "", repoFull, number)
jsonResponse(w, repoItemDecisionResponse{OK: true, Repo: repoFull, Number: number, Decision: decision, Status: "unparked", Label: ghpkg.HumanAckLabel,
Result: repoItemDecisionResult(repoFull, number, itemType, decision, comment, "", ghpkg.HumanAckLabel, nil)})
case repoItemDecisionCloseSuperseded, repoItemDecisionCloseWontFix:
case repoItemDecisionCloseSuperseded, repoItemDecisionCloseWontFix, repoItemDecisionCloseRead:
verb := "won't fix"
stateReason := issueStateReasonNotPlanned
supersededBy := ""
if decision == repoItemDecisionCloseRead {
if itemType != "issue" {
jsonError(w, "close-read applies to issues", http.StatusBadRequest)
return
}
verb, stateReason = "read (advisory acknowledged)", issueStateReasonCompleted
}
if decision == repoItemDecisionCloseSuperseded {
verb = "superseded"
ref, err := parseRepoItemSupersededBy(body.SupersededBy, repoFull)
Expand Down Expand Up @@ -416,7 +433,7 @@ func (s *Server) handleRepoItemDecision(w http.ResponseWriter, r *http.Request)
err := gh.CloseIssue(ctx, repoFull, number, ghpkg.IssueCloseOptions{
OverrideReason: "closed as " + verb + " by @" + user + " from the Hive dashboard",
SuppressOverrideComment: true,
StateReason: issueStateReasonNotPlanned,
StateReason: stateReason,
// A recorded human decision may close a tracking issue;
// only the automated paths are refused.
AllowTrackingIssue: true,
Expand Down Expand Up @@ -478,7 +495,7 @@ func (s *Server) handleRepoItemDecision(w http.ResponseWriter, r *http.Request)
}
s.handlePullRequestMergeDecision(ctx, w, repoFull, number, user, decision, comment)
default:
jsonError(w, "unknown decision; want approve, direction, close-superseded, close-wontfix, adopt, reroute, re-author, merge-now or queue-merge", http.StatusBadRequest)
jsonError(w, "unknown decision; want approve, direction, close-superseded, close-wontfix, close-read, adopt, reroute, re-author, merge-now or queue-merge", http.StatusBadRequest)
}
}

Expand Down
26 changes: 26 additions & 0 deletions src/pkg/dashboard/api_repo_item_decision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,32 @@ func TestRepoItemDecisionCloseWontFixCommentsAndCloses(t *testing.T) {
}
}

// close-read (hivecommons/hive#15381): an advisory issue is closed as
// completed through the same comment + close path; a PR is refused.
func TestRepoItemDecisionCloseReadClosesAsCompleted(t *testing.T) {
mock := &repoItemDecisionMock{issueLabels: []string{"triage/advisory"}}
srv := newRepoItemDecisionServer(t, mock)

w := postRepoItemDecision(t, srv, 7, "writer", `{"decision":"close-read"}`)
if w.Code != http.StatusOK {
t.Fatalf("close-read: code=%d body=%s", w.Code, w.Body.String())
}
if len(mock.comments) != 1 || !strings.Contains(mock.comments[0], "Closed as read (advisory acknowledged) by @writer") {
t.Fatalf("comments = %v", mock.comments)
}
if len(mock.edits) != 1 || mock.edits[0]["state"] != "closed" || mock.edits[0]["state_reason"] != issueStateReasonCompleted {
t.Fatalf("edits = %v", mock.edits)
}
var resp repoItemDecisionResponse
_ = json.Unmarshal(w.Body.Bytes(), &resp)
if resp.Status != "closed" || resp.Result == nil || resp.Result.Outcome != "Closed as read (advisory acknowledged)." {
t.Fatalf("resp = %+v", resp)
}
if w := postRepoItemDecision(t, srv, 8, "writer", `{"decision":"close-read","type":"pr"}`); w.Code != http.StatusBadRequest {
t.Fatalf("close-read on a PR: code=%d want 400 body=%s", w.Code, w.Body.String())
}
}

func TestRepoItemDecisionCloseSupersededPRUsesSweepPath(t *testing.T) {
mock := &repoItemDecisionMock{}
srv := newRepoItemDecisionServer(t, mock)
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/dashboard/operator_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
operatorActionGiveDirection = "give-direction"
operatorActionCloseSuperseded = "close-superseded"
operatorActionWontFix = "wontfix"
operatorActionCloseRead = "close-read"
operatorActionLetHiveDecide = "let-hive-decide"
operatorActionHold = "hold"
operatorActionRelease = "release"
Expand Down Expand Up @@ -326,6 +327,8 @@ func operatorActionFromBody(endpoint string, body []byte) (operatorActionRequest
out.Target = strings.TrimSpace(raw.SupersededBy)
case repoItemDecisionCloseWontFix:
out.Action = operatorActionWontFix
case repoItemDecisionCloseRead:
out.Action = operatorActionCloseRead
case repoItemDecisionMergeNow:
out.Action = operatorActionMergeNow
case repoItemDecisionQueueMerge:
Expand Down
23 changes: 17 additions & 6 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ type StageTrackerItem struct {
// does not count them until the PR reaches stage/080 or later. The
// labels themselves are untouched; this is presentation only.
DeferredModifiers []string `json:"deferred_modifiers,omitempty"`
// Advisory is set on an issue that is a note for maintainers, not work
// (triage/advisory label, dedupe checklist, "Decision required: no"):
// read it, then close it (hivecommons/hive#15381). Its Chip is the
// Open chevron's word; the row never counts as stalled or attention.
Advisory *StageTrackerAdvisory `json:"advisory,omitempty"`
// NeedsHuman is true when a person's decision or action is the ONLY
// thing that advances the item (stageTrackerNeedsHuman): stages 015
// triage-needed, 045/085 needs-decision, 071/072 needs-author /
Expand Down Expand Up @@ -2112,7 +2117,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
prOpen := func(repo string, number int) bool { return prState(repo, number) == blockedOnPRStateOpen }
supersedes := stageTrackerSupersedesIndex(store, status.GitHubBaseURL)
issueFilter := s.issueFilterConfig()
addIssue := func(repoName string, issue github.Issue, bucket, bucketReason string, progress *github.IssueChildren) {
addIssue := func(repoName string, issue github.Issue, bucket, bucketReason string, progress *github.IssueChildren, advisoryHint *github.IssueAdvisory) {
// A closed issue has no stage; a stage label it closed wearing is
// the closed-issue sweep's to remove, not a row to render
// (hivecommons/homebrew-hive#127).
Expand Down Expand Up @@ -2162,7 +2167,10 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
finish(&it, issue.Labels, stage, rec, ok, false)
stageTrackerBlockedBy(&it, issue.OpenBlockers())
stageTrackerBlockedOnPR(&it, issue.Body, bucketReason, status.GitHubBaseURL, prState)
applyStageTrackerNew(&it, stageTrackerNewState(it, ok, issueFilter, status.Governor, now))
advisory := stageTrackerAdvisoryFor(issue.Labels, issue.Body, advisoryHint)
if advisory == nil {
applyStageTrackerNew(&it, stageTrackerNewState(it, ok, issueFilter, status.Governor, now))
}
if it.Stage == trackerNumberClaimed {
it.ClaimantKind = s.stageTrackerClaimantKind(repoName, issue.Number)
}
Expand All @@ -2180,6 +2188,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
}
it.DecisionNeeded = stageTrackerDecisionNeededWith(it, nil, sentinelLabel, now, bctx)
it.StageActor = stageTrackerStageActor(it, workers, now)
applyStageTrackerAdvisory(&it, advisory)
add(it)
}
addPR := func(repoName string, pr github.PullRequest, verdict *github.MergeVerdict, bucket, bucketReason string) {
Expand Down Expand Up @@ -2269,15 +2278,15 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
for _, it := range repoOpenItems(repo) {
switch {
case it.Kind == "issue" && !it.Sidelined:
addIssue(repoName, it.Issue, "", "", nil)
addIssue(repoName, it.Issue, "", "", nil, nil)
case it.Kind == "pr" && !it.Sidelined:
addPR(repoName, it.PR.pr, it.PR.verdict, "", "")
case it.Kind == "issue":
// The enumeration's sidelined issues: parked in a work-detail
// bucket, the open items the first tracker never showed.
w := it.WorkIssue
addIssue(repoName, github.Issue{Repo: w.Repo, Number: w.Number, Title: w.Title, Author: w.Author, Labels: w.Labels, Assignees: w.Assignees,
CreatedAt: w.CreatedAt, UpdatedAt: w.UpdatedAt, URL: w.URL, ClaimKind: w.ClaimKind, ClaimedBy: w.ClaimedBy, LinkedPRs: w.LinkedPRs, ClaimContext: w.ClaimContext, IsTracker: w.IsTracker, Children: w.Children}, w.Bucket, w.Reason, w.TrackerProgress)
CreatedAt: w.CreatedAt, UpdatedAt: w.UpdatedAt, URL: w.URL, ClaimKind: w.ClaimKind, ClaimedBy: w.ClaimedBy, LinkedPRs: w.LinkedPRs, ClaimContext: w.ClaimContext, IsTracker: w.IsTracker, Children: w.Children}, w.Bucket, w.Reason, w.TrackerProgress, w.Advisory)
default:
w := it.WorkPR
addPR(repoName, github.PullRequest{Repo: w.Repo, Number: w.Number, Title: w.Title, Author: w.Author, Labels: w.Labels, Draft: w.Draft,
Expand Down Expand Up @@ -2340,7 +2349,9 @@ var stageTrackerNeedsHumanMods = []string{modNeedsHuman, modNeedsDecision, modUn
// action is the only thing that advances the item. A hold wins: a held
// item is paused, not waiting on a person (hivecommons/hive#15008).
func stageTrackerNeedsHuman(it StageTrackerItem) bool {
if stageTrackerOnHold(it) {
// An advisory waits on nobody: reading and closing it is a courtesy,
// not a decision the pipeline is parked on (hivecommons/hive#15381).
if stageTrackerOnHold(it) || it.Advisory != nil {
return false
}
if slices.ContainsFunc(it.Modifiers, func(m string) bool { return slices.Contains(stageTrackerNeedsHumanMods, m) }) {
Expand Down Expand Up @@ -2397,7 +2408,7 @@ func stageTrackerRegressionHandled(it StageTrackerItem) bool {
// parked on a person. Only the shown Modifiers count, so a merge-gate pill
// held back until the gate never promotes a row.
func stageTrackerNeedsAttention(it StageTrackerItem) bool {
if stageTrackerRegressionHandled(it) {
if it.Advisory != nil || stageTrackerRegressionHandled(it) {
return false
}
return len(it.Modifiers) > 0 || slices.Contains(stageTrackerAttentionStages, it.Stage)
Expand Down
Loading
Loading