Skip to content

lib/labels.sh's new pw::-prefixed CRUD (labels_reconcile/labels_reconcile_role) is unwired: the catalogue's own label names are still unprefixed

Id: TD-PPagop-26082809 · Status: resolved · Filed: 2026-08-28 · Resolved: 2026-09-25 · Ref: #1860

Issue #840 asked for every label the pipeline itself owns to be namespaced under a pw:: prefix, with full CRUD (create, update, delete) on that namespace. Its own acceptance criterion 4 defers “the renaming/renamespacing of existing labels” to a follow-on item, so this is that follow-on’s own record — the capability landed without it.

lib/labels.sh now has labels_reconcile/labels_reconcile_role (full CRUD scoped to label_prefix, config.schema.json, default pw::), tested directly in test/labels.test.sh, but no call site uses them: the catalogue’s own names (pr_label’s default autonomous-agent, enabler_escalation_label’s enabler-escalation, needs_refinement_label’s needs-refinement, refined_label’s refined, unvoid_label’s unvoided, and the hardcoded blocked, blocked:needs-refinement, obsolete, open-question, complexity:low|medium|high in labels_catalogue) are still unprefixed, and agent-cycle.sh, review-cycle.sh, lib/enabler.sh and lib/candidate-gather.sh still call labels_ensure_role/labels_ensure_stamped, not the _reconcile forms.

Suggested fix, in one pull request:

  • Rename the five configurable defaults and the hardcoded catalogue entries in labels_catalogue (lib/labels.sh) to pw::-prefixed names, choosing names that do not collide with any pre-existing human label (bug, enhancement, dashboard, …).
  • Migrate live installations via GitHub’s label-rename endpoint (PATCH /repos/{owner}/{repo}/labels/{name}, changing only name) rather than delete-then-recreate, so every issue/PR already carrying the old name keeps it under the new one.
  • Swap the four call sites above from labels_ensure_role/ labels_ensure_stamped onto labels_reconcile_role’s own shape (or a stamped wrapper around it, mirroring labels_ensure_stamped), and extend the labels-ensured event’s created/failed JSON shape (agent-cycle.sh’s ensure_labels_for) to also carry updated/deleted, which labels_reconcile’s report now emits and that event currently drops silently.
  • Update docs/IMPLEMENTATION-PIPELINE-SPEC.md requirement 6a and the generated config-table rows (scripts/render-config-table.sh) once the defaults change.

Two hazards in labels_reconcile that are latent only for as long as nothing calls it, raised on this PR’s own review (#846) and to be settled by whoever does the wiring above:

  • A short or broad label_prefix silently pulls human labels into the delete scope. The delete pass matches by bare startswith, the schema constrains the key only to ^[^,]*$, and scripts/doctor.sh does not check it — so label_prefix: "b" would DELETE this repository’s own bug label (prefix-matched, uncatalogued), detaching it from every issue wearing it. Needs a minLength, a terminator constraint in the schema pattern, or a doctor.sh check that the configured prefix matches no uncatalogued label already present in a configured repository.
  • An empty catalogue plus MODE full deletes the whole namespace. labels_catalogue exits 0 with no output both when config_defaults fails and when its own jq does, and the pipe in labels_reconcile_role discards that status. The first case is safe by construction (an unreadable config also leaves prefix empty, disabling deletion); the second is not. test/labels.test.sh pins empty-catalogue deletion as intended, so the fix belongs in labels_reconcile_role — which knows target’s catalogue can never legitimately be empty — capturing the catalogue and skipping the delete pass when it came back empty, rather than in labels_reconcile.

Noticed while working #840 (PR implementing labels_reconcile).

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