Skip to content

A legacy-swept issue whose reason label is released normally keeps a bare `blocked` forever, and `scripts/gather-issues.sh` goes on excluding it

Id: TD-PPagop-26082608 · Status: resolved · Filed: 2026-08-26 · Resolved: 2026-09-24 · Ref: #1831

Noticed while reviewing PR #823 (agent-ops#816), which adds requirement 38b’s live reconciliation, refinement_blocked_label_orphaned.

For a legacy refinement block — one carrying needs_refinement_assignee with neither blocked_label nor blocked_reason_label set, which is every block scripts/sweep-legacy-refinement-assignees.sh projected labels onto — refinement_blocked_label_targets (lib/refinement.sh) returns the reason label alone. So when the block clears, release_refinement_label (lib/candidate-select.sh) removes blocked:needs-refinement and deliberately leaves blocked behind: the documented over-hold, taken because the sweep has no event of its own recording whether it added blocked or found a human’s already there, and removing a human’s own control on a guess is the defect refinement_label_project exists to prevent.

PR #823’s live reconciliation does not bound that residue, because the reason label is the whole of what puts an issue in front of it: lib/candidate-gather.sh lists open issues by --label blocked:<reason>, so an issue whose reason label came off successfully is never read again. The pair only comes off together when the reason label’s own removal also failed — which is the cohort agent-ops#816 found, and is what that PR fixes.

scripts/gather-issues.sh excludes on the bare blocked label, case- insensitively and independently of the shared log. So a legacy-swept issue that reaches this state is unselectable for good, with no block behind it and nothing in the pipeline that will ever notice — the same permanently-stuck-hold class agent-ops#639 ended for the assignment mechanism and agent-ops#816 ended for the label pair, surviving on the one remaining path.

The set is bounded and only ever shrinks (it is the pre-agent-ops#639 legacy backlog, and no new legacy blocks are created), which is why this is debt and not a defect to fix in PR #823 — the refinement scoping that PR worked to explicitly put a bare blocked out of scope, on the sound ground that a bare blocked alone carries no proof of pipeline provenance.

  • lib/refinement.sh — refinement_blocked_label_targets, the needs_refinement_assignee branch that returns [$reason] only.
  • lib/refinement.sh — refinement_blocked_label_orphaned, which is reached only via the reason label.
  • lib/candidate-gather.sh — the per-repo gh issue list --label <reason> read that feeds it.
  • scripts/gather-issues.sh — the blocked-label exclusion that makes the residue consequential.
  • docs/IMPLEMENTATION-PIPELINE-SPEC.md requirement 38b and scripts/sweep-legacy-refinement-assignees.sh’s header both name this record; a resolution has to update both.

The missing evidence is provenance for a blocked the sweep applied. Two routes, either of which would do:

  1. Give the sweep somewhere to record what it did — it already knows whether refinement_label_project returned added or present, and it is handed a log file argument it could append an own-label-action to. A recorded add makes the label ours on every existing path, refinement_blocked_label_stale included, with no new inference at all. This is TD-PPagop-26082602’s own item 2 seen from the other side, and is the cleaner of the two.
  2. Failing that, reconcile the bare blocked against live state as well, with a provenance test that does not depend on the compound name — the labelled_at-versus-block-timestamp comparison requirement 39f already uses for needs_refinement_label would serve. More machinery, and it must leave #402, #677 and #678 untouched.

Whichever route, pin it with a test that a legacy block whose reason label was released successfully does not leave the issue excluded.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/999.