Skip to content

πŸ› fix(blocked): turn a hive-applied marker-less blocked into a needs-human ask on old and unlabelled issues too - #17991

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/blocked-repair-writeback-gate
Nov 12, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/blocked-repair-writeback-gate

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

When a contributor's agent reports an issue "blocked" without naming what it waits on, the hive's own bot ends up as the one that applied the blocked label, and nothing can ever lift it. The blocked sweep is meant to turn that into a needs-human ask so the issue lands in a maintainer's inbox. The write-back gate was refusing that repair on every sweep for two kinds of issue: ones created before the hive could write to the repository, and ones without the review opt-in label. Those issues stayed blocked, hidden from every agent and from every inbox, for days.

This PR gives the repair its own write-back kind, blocked_repair. The hive already wrote to these issues (it applied the label being repaired), so the two checks that exist to keep the hive off items nobody asked it to touch no longer apply to it. Everything else still does.

What went wrong

Seen in a running hive's log, repeated about every 5 minutes:

  • blocked sweep: needs-human ask held by writeback gate reason=backfill-off on 8 issues across 4 repositories ("#N was created …, before hive could write to …; writeback.unsolicited.backfill is off").
  • The same line with reason=needs-opt-in-label on 1 issue ("#N carries none of hive-review; gate_comment needs the label at L5").

The sweep asked the gate as gate_comment (L5 plus the opt-in label, and subject to the backfill guard). Both refusals are right for a first, unsolicited comment on someone's issue. They are wrong here: the hive's label is already on the issue, put there with no opt-in and regardless of the issue's age, and the hive is only replacing its own label with a question for a maintainer.

Refs #16832, which introduced the needs-human ask.

What changes

  • New kind blocked_repair, used by the blocked sweep in place of gate_comment for this one repair (add needs-human, remove blocked, post one note).
  • The sweep states what it already checked. Before it asks the gate, the sweep reads the issue's timeline and confirms the hive's own bot applied blocked. It now passes that as a fact on the item (Item.HiveAppliedBlock). For blocked_repair with that fact set, the gate skips the backfill guard and the opt-in label requirement and allows the write with the new reason hive-applied-block.
  • Without the fact, nothing widens. blocked_repair without it is gated like any other kind (refused by backfill and by the missing label, exactly as gate_comment is for the same issue), and the fact does nothing for any other kind. A person's blocked never reaches the gate at all, as before.
  • One log line per hold, not one per sweep. A held repair is logged once per issue and reason, again when the reason changes, and again if the issue is held anew after it was repaired, left the listing, named a blocker, or a person took the label over. Repeats go to the debug log.

Default policy for the new kind

{min_level: 1, require_label: true}.

  • Minimum level 1. The label this kind repairs is applied by the contributor relay with its hub-minted task token (gh issue edit --add-label blocked). That write is not gated by ACMM level or by any write-back kind, so a marker-less hive blocked can exist at any level. The repair's floor should not sit above the level at which the label can land, so it is the lowest one. An unset level still refuses (level-unknown). An operator can raise it with writeback.kinds.blocked_repair.min_level, and writeback.unsolicited.min_level raises it like every other kind.
  • require_label: true only governs a call that does not state the fact. No caller does that today; it is there so a caller that forgets the fact is held, not let through.

What still stops the repair

In the same order as before: a paused repository, writeback.per_repo mode off, issues-only, and labels-only, a repository outside project.repos, own_only if an operator sets it, an unset level, and the kind's minimum level. After that, the content layer applies as it did under gate_comment: a duplicate on the same issue, the burst hold (so a repository with several such issues gets them over a few sweeps, not all at once) and the hourly cap.

labels-only refuses it on purpose. The repair posts a note, and the note is what tells the maintainer why needs-human appeared and what the two ways out are. A label swap with no explanation would be a worse ask, and labels-only is an operator saying "no comments here". Making it a label kind would also have taken it out of the burst hold.

Dashboard and admin MCP

No hard-coded kind list had to change. Both sides build from the gate's own kind list, so the new kind appears in each without further code:

  • Dashboard: Settings β†’ Features β†’ Write-back containment β†’ Per-kind matrix gets a blocked_repair row with the same four controls as every other row (minimum level, opt-in label, level without the label, hive-authored only). The row is rendered from writebackKindMatrix, which the API fills from the gate's resolved matrix, and the save path accepts any known kind.
  • Admin MCP: writeback.kind_policy lists blocked_repair in its input schema, accepts it, and previews its override and effective policy before and after, the same as for any other kind.

One thing to know: the matrix shows blocked_repair as "opt-in label" scope, because that is its stored policy. In practice the label is not needed for a hive-applied block, which is the only case the sweep uses the kind for. This is the same shape as contributor_adopt and its superseded-agent-PR exception. The docs say so; the dashboard row does not.

Files

  • src/pkg/writeback/kinds.go, gate.go, dedupe.go: the kind, its default, the item fact, the allow reason, and the content-dedupe entry.
  • src/pkg/writeback/held.go (new): the gate remembers the last reason it refused an item for, so a writer that asks every sweep can report a hold once. It lives on the gate because the gate is the one object shared across GitHub clients, and tests build their own.
  • src/pkg/github/issue_blocked.go, issue_blocked_repair_held.go (new): the sweep asks as blocked_repair with the fact, logs a hold once, and forgets it when the issue stops being a repair candidate.
  • Docs: the blocked section of the labels reference, the kind matrix in acmm-policy-matrix.md, and the write-back table and dedupe kind list in operator-reference/sweeps-and-operations.md.
  • changelog.d/fixed-blocked-repair-writeback-gate.md.

Tests

None were run locally (repository rule); CI is the verdict.

New, src/pkg/github/issue_blocked_repair_test.go, through a real gate:

  • TestBlockedRepairConvertsHiveBlockTheGateUsedToHold: a hive-applied marker-less blocked is converted on an issue older than the hive's write access with backfill off, and on an issue without the opt-in label. Each case first shows gate_comment is refused for that same issue, which is why these fail on the old code.
  • TestBlockedRepairLeavesAPersonsBlockAlone: a person's marker-less blocked on the same old issue gets no write and the gate is not asked.
  • TestBlockedRepairStillRefusedByPauseModeAndLevel: paused repository, repo mode off, below the kind's minimum level, unset level.
  • TestBlockedRepairHoldLoggedOncePerIssueAndReason and TestBlockedRepairHoldKeptAcrossSweepOfOtherRepos: the log line appears once for repeated sweeps, again on a changed reason, and again after each way an issue can stop being a candidate. On the old code the line repeats every sweep.

New, src/pkg/writeback/blocked_repair_test.go: the kind's defaults and listing; with and without the fact against gate_comment for the same item; every check that still applies; that an allowed repair is not counted as a backfill skip; duplicate and burst holds; the held memory.

No existing test was changed. TestSweepBlockedAskHeldByGateLogs (which asserts the held line with issue=80) is untouched.

Not in this PR

  • How the relay's blocked verdict is applied, the blocked-on marker logic, the review-backlog marker-less lift, and a person-applied blocked.
  • The gate's suppressed drill-down still records one row per refused attempt per sweep. That is shared by every kind and is what the 24-hour counter counts, so it is left alone. With this change the two refusals that produced those rows for this path no longer happen.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…s-human ask on old and unlabelled issues too

A contributor relay's blocked verdict that names nothing leaves a `blocked`
label applied by the hive's own bot, with no marker, so nothing can lift it.
The blocked sweep turns that into a needs-human ask, but it asked the
write-back gate as gate_comment, and the gate refused on every sweep for an
issue created before the hive could write to the repository (backfill off)
and for one without the review opt-in label. Those issues stayed blocked,
out of every agent's reach and in no inbox.

The hive has already written to such an issue: it applied the label being
repaired. So the repair gets its own write-back kind, blocked_repair, and
the sweep passes the fact it already established from the timeline
(Item.HiveAppliedBlock). With the kind and the fact, the gate skips the
backfill guard and the opt-in label and allows with reason
hive-applied-block. A pause, the repo mode (off, issues-only, labels-only),
project membership, own_only and the kind's minimum level still refuse it,
and the content dedupe and burst hold apply as they did under gate_comment.
Without the fact the kind is gated like any other, and the fact does
nothing for other kinds.

Default policy is min_level 1 with require_label: the relay's label write
is gated by no level, so the floor is the lowest one, and require_label
only matters for a call that does not state the fact.

A held repair is now logged once per issue and reason, again when the
reason changes or the issue is held anew, instead of on every sweep. The
gate keeps that memory (held.go), since it is shared across clients.

The dashboard kind matrix and the admin MCP writeback.kind_policy both
build from the gate's kind list, so the new kind shows in each.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 12, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

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

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

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

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

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Review follow-ups (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line are listed here instead of as issues, one comment per PR, updated in place. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

  • P3 low style β€” Gate-comments row in sweeps-and-operations.md still names files that do not use gate_comment (src/docs/operator-reference/sweeps-and-operations.md:553): The PR rewrites this row's file list (swapping issue_blocked.go for verdict_blocker.go and pr_blocked_depends_on.go, both of which do reference writeback.KindGateComment at head), but keeps `issue_re…

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should decide whether the hive may post a needs-human note (via the new blocked_repair kind, default L1) on an issue that predates the hive's write access or carries no opt-in label, on the sole ground that a contributor relay earlier applied blocked to it under the hive bot identity.

The code does what the body says, and I found no defect in it. I am routing this to a maintainer because it is a deliberate widening of the write-back containment policy, which is a trust call rather than a code call.

What I verified (v6 tree + diff):

  • src/pkg/writeback/gate.go decideLocked: the new hiveBlock bypass sits after the pause, per_repo mode (off/issues-only/labels-only), HiveAuthored, RepoListed and own_only checks, and after the level <= 0 refusal, so everything the body lists as "still stops the repair" does. Only the backfill guard and the opt-in-label branch are skipped, and only when kind == KindBlockedRepair && item.HiveAppliedBlock.
  • src/pkg/github/issue_blocked.go askHumanBlockedMarkerless: HiveAppliedBlock is set only after blockedLabelActor returns an own-bot or hive-author login, and after the reviewBacklog / openBlockedBy > 0 early returns β€” unchanged guards, so a person's blocked never reaches the gate with the fact set.
  • KindBlockedRepair is neither a label kind nor an issue-file kind (kinds.go:193–203), so labels-only still refuses it; dedupe.go keeps it content-deduped so the burst hold still paces a repo. The dashboard matrix reads cfg.Writeback.EffectiveKinds() (pkg/dashboard/api_governor_features_platform.go:432), so the Settings claim in the changelog holds without a separate registration.
  • held.go: NoteHeld/ForgetHeld/RetainHeld are nil-safe and all mutate under g.mu; RetainHeld deletes during range, which is safe in Go. retainBlockedRepairHeld scopes forgetting to the repos actually listed this sweep, so a partial sweep does not drop other repos' memory.

The question for a human. The backfill guard exists so the hive never writes unsolicited to issues created before it was installed, and the opt-in label exists so a repo chooses to receive hive comments. This PR's argument is that the hive "already wrote" to these issues β€” but per the body, the blocked label was placed by a contributor's agent through the relay's hub-minted token, not by anything the repo's maintainers configured. So the effect is: any contributor agent that labels an old, un-opted-in issue blocked without a marker causes the hive bot to post a <!-- hive:unblocked --> comment there a few sweeps later, at L1. That may well be the right trade (the alternative is the issue sitting invisible for days, which the log evidence shows), but it is a policy choice about when the hive speaks on repos that never asked it to, and the default of L1 means it is on everywhere the hive can see. I cannot settle that; a Maintainer Committee member should.

If the answer is yes, I have nothing further on the code. If the preferred shape is narrower (e.g. default min_level above 1, or honouring the backfill guard but not the label), that is a one-line change in DefaultKinds() / decideLocked.

Refs #16832 is non-closing per the body, which is right: #16832 introduced the ask; this fixes its gating.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

hivecommons-hive Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

  • the reviewer swarm returned requires_human @30efc35
  • the review found: the security review withheld approval: Delta re-review at 30efc35: the only change since 9d1f974 is a merge of v6 (commits c3b9b43, 1e68146, c555d97, all already landed upstream); the diff of the head against its v6 parent is byte-identical to the previous PR diff, so no PR content changed. Previous findings: [security] gate.go:485 backfill guard and opt-in label bypassed for blocked_repair at default L1 β€” still present, code unchanged; [docs-currency] acmm-policy-matrix.md:287 dashboard row scope not explained β€” not this perspective, file unchanged so presumably still present. No new security findings in the delta. Verdict stays requires_human for the whole PR on the still-present in-scope trust-boundary question; no new comment posted since nothing new would be said.
  • reviewer summary: security requires human: Delta re-review at 30efc35: the only change since 9d1f974 is a merge of v6 (commits c3b9b43, 1e68146, c555d97, all already landed upstream); the diff of the head against its v6 parent is byte-identical to the previous PR diff, so no PR content changed. Previous findings: [security] gate.go:485 backfill guard and opt-in label bypassed for blocked_repair at default L1 β€” still present, code unchanged; [docs-currency] acmm-policy-matrix.md:287 dashboard row scope not explained β€” not this perspective, file unchanged so presumably still present. No new security findings in the delta. Verdict stays requires_human for the whole PR on the still-present in-scope trust-boundary question; no new comment posted since nothing new would be said.
  • the automerge lane will not merge this unattended

Head: verdict requires_human @30efc35, 58/60 checks green, 2 pending, DCO yes, soak 0s of 10m0s.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

Updated 2026-11-12 21:18 UTC.

@hivecommons-hive
hivecommons-hive Bot merged commit c1228e8 into hivecommons:v6 Nov 12, 2026
68 of 69 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Evidence bundle `#1799130efc35` sha256:0117ee59b2f357b4c2598dfbdc9d255b4e0072e6a4791e7d49b56b0372cbfe4c β€” download from the dashboard or `hivectl review evidence #17991`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

hivecommons-hive Bot pushed a commit that referenced this pull request Nov 17, 2026
… than the backfill cutoff (#18848)

* πŸ› writeback: let the hive move a stage label it applied on a PR older than the backfill cutoff

The backfill guard refused every stage-label write on a PR created before
the repo's cutoff, so a stage label the hive itself had put there froze at
a stage the hive no longer believed (projectbluefin/utah-packages#1148 at
stage/100-merge-queue while not queued, projectbluefin/utah#1274 at 074
while tracked at 085).

The stage labeler now states Item.HiveAppliedStage when every stage/*
label on such a PR was last applied by one of the hive's own accounts
(one timeline read, only for a PR the guard would hold, memoised per label
set). For KindStageLabel the gate then skips the backfill guard and
nothing else (reason hive-applied-stage), following the hive-applied-block
(#17991) and hive-applied-park (#18051) exceptions. The 085 escalation
note asks with the same fact so it describes the move as it happens.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

* docs: re-cite RankActionableIssues after the client.go insert

The five lines this branch adds to client.go moved RankActionableIssues
from 5588 to 5593; scale-envelope.md now cites 5593-5603 so the docs
citation check finds the AgeMinutes anchor again.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant