diff --git a/plugins/work-items/.claude-plugin/plugin.json b/plugins/work-items/.claude-plugin/plugin.json index dcd5eef4120..57e6989a7f4 100644 --- a/plugins/work-items/.claude-plugin/plugin.json +++ b/plugins/work-items/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json", "name": "work-items", - "version": "0.24.4", + "version": "0.24.5", "description": "Manages development work items through a provider-neutral tracker seam that ships with the plugin (bundled dispatcher plus github and local-markdown adapters; seam plugin-dir canonical, adapters consumer-local-first): dashboard, taxonomy-labeled creation, a race-safe assignee-plus-lease claim protocol, recurring-schedule checks, TODO scanning, stale-lease auditing, plan decomposition into vertical-slice items, raw-intake triage (issues and unsolicited PRs through raw, verified, briefed, autonomous-eligible states), plus the two work-items loop lanes of the loop-lane convention: a self-paced autonomous work-loop drain (work-class admission gate, adaptive item cap, PR-only) and an attended attend-queue escalation lane. The re-runnable setup skill binds the provider (.work-item-tracker.json), seeds the recurring-schedule seam (.github/recurring-schedule.json), and remaps canonical role labels.", "author": { "name": "Melodic Software", diff --git a/plugins/work-items/CHANGELOG.md b/plugins/work-items/CHANGELOG.md index ccfa4f578af..8cd1f88604d 100644 --- a/plugins/work-items/CHANGELOG.md +++ b/plugins/work-items/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to the `work-items` plugin are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning. +## [0.24.5] + +### Fixed + +- **`triage` no longer routes to `priority: pN-*` labels that exist in no governed repository + (`#1253`).** The live governed priority axis across the fleet is `priority: critical` / `high` / + `medium` / `low` / `needs-triage` — the `p0-critical`…`p3-low` scheme `triage`'s priority-label + step, `track add`'s filing default, and `dogfood-filing.md` named inline appeared in zero + repositories, so an autonomous triage pass that followed the skill literally failed applying a + nonexistent label. `triage`, `track add`, and `dogfood-filing.md` now resolve the live `priority:` + label set from the bound adapter at action entry (consistent with every other "members from the + live set" axis in `label-taxonomy.md`) instead of naming members inline; where prose still shows a + concrete value it is marked as an illustrative example, not a routing instruction. The + triage-assessed default (mid-urgency tier) vs. `track add` filing default (lowest-urgency tier, an + untriaged-signal floor) distinction is preserved. + ## [0.24.4] ### Documentation diff --git a/plugins/work-items/reference/dogfood-filing.md b/plugins/work-items/reference/dogfood-filing.md index 8ef6f501da3..ae1a6caa1cd 100644 --- a/plugins/work-items/reference/dogfood-filing.md +++ b/plugins/work-items/reference/dogfood-filing.md @@ -59,10 +59,11 @@ Four beats, in order. The two **mechanical** beats reuse existing machinery verb "Attention view"). Application differs by axis because `priority:` is a single-label group ([`../skills/track/actions/add.md`](../skills/track/actions/add.md) "Build labels list"): on the **Priority** axis the marker *is* the item's priority, so pass it as `--priority needs-triage` on - the step-3 `track add` call, replacing the default `priority:p3-low` rather than adding a second - `priority:` label alongside it (two `priority:` labels is a conflict the GitHub adapter flags and - later priority-tier selection cannot resolve); on the **Status** axis the marker is a separate flag - applied after creation, and the `priority:p3-low` filing floor stays. + the step-3 `track add` call, replacing the default filing floor (`track add` "Priority" — the live + `priority:` set's lowest-urgency member) rather than adding a second `priority:` label alongside it + (two `priority:` labels is a conflict the GitHub adapter flags and later priority-tier selection + cannot resolve); on the **Status** axis the marker is a separate flag applied after creation, and + the filing floor stays. **The filer does not self-triage** — filing surfaces the problem into raw intake; triage verifies, categorizes definitively, and routes it. Auto-application of `needs-triage` to a fresh item lacking a priority label is tracked separately (`#506`); until it lands, the filing lane applies the label. diff --git a/plugins/work-items/skills/track/actions/add.md b/plugins/work-items/skills/track/actions/add.md index ea3e4d0028a..ceddaa72595 100644 --- a/plugins/work-items/skills/track/actions/add.md +++ b/plugins/work-items/skills/track/actions/add.md @@ -4,7 +4,7 @@ Create a new work item with labels from the taxonomy. **Defaults applied by this action:** -- **Priority** — when the `--priority` flag is absent, apply `priority:p3-low`. +- **Priority** — when the `--priority` flag is absent, apply the live `priority:` set's lowest-urgency member, resolved from the bound adapter at action entry (e.g. `priority: low`, if present; [`${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md`](${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md) "Universal axes") — an untriaged-signal floor, not a priority assessment. Omit the label when the repo's live set has no such member. - **Body template** — when `--body` is not provided, fall back to the default skeleton: a `## Context` paragraph (what observation surfaced this item, what's the cost of leaving it), a `## Proposed work` bullet list (concrete next actions), `## Acceptance criteria` (one verifiable assertion per bullet), and `## References` (cross-references to rules, files, prior PRs, or external docs). The concrete body the workflow builds is detailed in step "Build body" below. - **Label taxonomy** — labels are validated against the 8-group structure documented in [`${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md`](${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md). - **Title shape** — the item title follows the convention in [`${CLAUDE_PLUGIN_ROOT}/reference/issue-conventions.md`](${CLAUDE_PLUGIN_ROOT}/reference/issue-conventions.md). @@ -21,7 +21,7 @@ Create a new work item with labels from the taxonomy. - `--type ` -- The issue's type (default: `task`). Accepts the commit-style inputs `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `build`, `perf` and maps them to the coarse issue type: `fix` → **Bug**, `feat` → **Feature**, everything else → **Task**. On **org repos** the type is a **native GitHub Issue Type** set through the seam (not a `type:` label); on **personal / non-org repos** (no native Issue Types) it becomes a coarse `type: bug`/`type: feature`/`type: task` label instead - `--area ` -- Area label — the consuming repo's `area:` labels (see [`${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md`](${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md)) - `--ecosystem ` -- Ecosystem label — the consuming repo's `ecosystem:` labels (see [`${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md`](${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md)) -- `--priority

` -- Priority label (e.g., `p0-critical`, `p1-high`, `p2-medium`, `p3-low`) +- `--priority

` -- Priority label; value must be one of the repo's live `priority:` members (see [`${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md`](${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md) "Universal axes" — resolved live, never snapshotted here), e.g. `critical`, `high`, `medium`, `low` where the repo follows that convention - `--recurring` -- Mark as recurring. Requires `--cadence` - `--cadence ` -- One of: `weekly`, `biweekly`, `monthly`, `quarterly`, `semi-annual`, `annual` - `--context "summary"` -- Add research context to the item body @@ -40,7 +40,7 @@ Create a new work item with labels from the taxonomy. 1. **Resolve the issue type** `{type}` from `--type` (default `task`), mapping the input to the coarse type: `fix` → `Bug`, `feat` → `Feature`, everything else → `Task`. **Org repos** (native Issue Types available): the type is applied through the seam as a native Issue Type, **not** a label — it is not part of `{labels}`. **Personal / non-org repos** (native-type mechanism unavailable): the type rides as a coarse long-form label instead — append `type: bug` / `type: feature` / `type: task` (colon-space, matching the reconciled naming) to `{labels}`. Determine which path applies from the bound adapter's capabilities (for the GitHub adapter, native Issue Types are an org-only feature). -1. **Build labels list** `{labels}` (comma-separated for the seam) from the remaining flags. Start from the group defaults `priority:p3-low,category:general` and replace each group's default with any supplied `--priority`/`--category` value (one label per group); append `--area`/`--ecosystem` labels when provided. When `--agent-ready` is set, also append the autonomous-eligible role label (default `agent-ready`) so the item is eligible for autonomous pickup. A default that the consuming repo doesn't define is omitted rather than passed. +1. **Build labels list** `{labels}` (comma-separated for the seam) from the remaining flags. Start from the group defaults — the live `priority:` set's lowest-urgency member (resolved per the "Priority" default above) and `category:general` — and replace each group's default with any supplied `--priority`/`--category` value (one label per group); append `--area`/`--ecosystem` labels when provided. When `--agent-ready` is set, also append the autonomous-eligible role label (default `agent-ready`) so the item is eligible for autonomous pickup. A default that the consuming repo doesn't define is omitted rather than passed. 1. **Build body.** If `--agent-ready`, use the agent-brief template from [`${CLAUDE_PLUGIN_ROOT}/reference/agent-brief.md`](${CLAUDE_PLUGIN_ROOT}/reference/agent-brief.md) (Category, Summary, Current behavior, Desired behavior, Key interfaces, Acceptance criteria, Out of scope). Otherwise use the default template: diff --git a/plugins/work-items/skills/track/actions/list.md b/plugins/work-items/skills/track/actions/list.md index cc8d94469d2..e6b7c7828e5 100644 --- a/plugins/work-items/skills/track/actions/list.md +++ b/plugins/work-items/skills/track/actions/list.md @@ -26,7 +26,7 @@ List work items with optional filtering. ```markdown | # | Item | Type | Labels | Assignee | Updated | |---|------|------|--------|----------|---------| -| 1 | #42 Fix | Bug | area: , priority:p1-high | @user | 2d ago | +| 1 | #42 Fix | Bug | area: , priority: high | @user | 2d ago | | 2 | #38 Review | Task | area: | -- | 5d ago | ``` diff --git a/plugins/work-items/skills/triage/SKILL.md b/plugins/work-items/skills/triage/SKILL.md index e2248d55548..44ab581f4bf 100644 --- a/plugins/work-items/skills/triage/SKILL.md +++ b/plugins/work-items/skills/triage/SKILL.md @@ -95,7 +95,7 @@ Read the item body, comments, and any linked PRs; for a PR, the diff too (adapte Classify **bug vs enhancement** first — it steers the rest of the flow (bugs get reproduced; rejected enhancements get ledgered). Then recommend: - **Type** — bug → `Bug`; enhancement → `Feature` (or `Task` for tracked non-feature work). Native GitHub Issue Type on org repos, set through the seam; `type:` label on personal / non-org repos. Item title and prefix conventions: [`${CLAUDE_PLUGIN_ROOT}/reference/issue-conventions.md`](${CLAUDE_PLUGIN_ROOT}/reference/issue-conventions.md) -- **Priority label** (`priority:p0-critical` through `priority:p3-low`) — default to `priority:p2-medium` when no directive, category rule, or severity signal sets one. `priority:p1-high` is **reserved** for items that block other work or carry an imminent external deadline; `priority:p0-critical` keeps its existing critical semantics. When a directive or category rule sets this label **above** the finding's self-labeled severity, record the original severity in the triage comment (e.g. `priority set to pX by ; reporter severity: `) so implementers can sub-sort within a priority band. No new labels. This triage-assessed default is deliberately distinct from the `/work-items:track add` filing default (`priority:p3-low`, an untriaged-signal floor rather than a priority assessment) +- **Priority label** — resolve the live `priority:` label set from the bound adapter at action entry (for the GitHub adapter, `gh label list --search 'priority:'`; members are never snapshotted here — [`${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md`](${CLAUDE_PLUGIN_ROOT}/reference/label-taxonomy.md) "Universal axes"). Default to the resolved set's **assessed-default** tier — the mid-urgency member when the set follows the conventional critical/high/medium/low ordering (e.g. `priority: medium`, if present) — when no directive, category rule, or severity signal sets one. Reserve the next tier up (e.g. `priority: high`) for items that block other work or carry an imminent external deadline; the top tier (e.g. `priority: critical`) keeps its existing critical semantics. A live set that doesn't follow that ordering has no default to infer by convention — ask, or omit the label the way a repo-undefined default is omitted elsewhere ([`${CLAUDE_PLUGIN_ROOT}/skills/track/actions/add.md`](${CLAUDE_PLUGIN_ROOT}/skills/track/actions/add.md) "Priority"). When a directive or category rule sets this label **above** the finding's self-labeled severity, record the original severity in the triage comment (e.g. `priority set to by ; reporter severity: `) so implementers can sub-sort within a priority band. No new labels. This triage-assessed default is deliberately distinct from the `/work-items:track add` filing default (the resolved set's lowest-urgency tier, an untriaged-signal floor rather than a priority assessment) - **Target state** — from the state machine above: needs-info, or one of the three briefed exits (delegable, decision-defaulted, human-gated). For a briefed item that carries a decision, apply the **routing test**: is the alternative reversible/maintainer-vetoable (→ **decision-defaulted**: autonomous-eligible role + `status:ready`, recorded with a `Decision defaulted: X — veto before merge` comment) or genuinely open — open design space, product intent, or cross-repo policy (→ **human-gated**)? **Direction gate.** Recommending is read-only; the gate governs *mutation* — labels, comments, closes, item creation — and which side of it you are on is fixed by how triage was invoked: diff --git a/plugins/work-items/tests/no-hardcoded-priority-scheme.test.sh b/plugins/work-items/tests/no-hardcoded-priority-scheme.test.sh new file mode 100755 index 00000000000..9ff2a6d2748 --- /dev/null +++ b/plugins/work-items/tests/no-hardcoded-priority-scheme.test.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +# Regression guard for #1253: skill/reference prose must never name a `pN-*` +# priority value in ANY form the removed prose used — qualified with no space +# (`priority:p2-medium`), qualified with a space (`priority: p2-medium`), or +# bare, as the `--priority` flag documentation listed it (`p2-medium`). That +# scheme exists in no governed repository — the live fleet-wide `priority:` set +# is critical/high/medium/low/needs-triage — so an autonomous pass that follows +# a `pN-*` routing instruction literally fails applying a nonexistent label +# (label-taxonomy.md "Universal axes": priority members are discovered live, +# never snapshotted in skill text). +# +# CHANGELOG.md is deliberately exempt: it is an immutable historical record of +# what a past release actually shipped, not a routing instruction consumed by a +# skill invocation, so it is never rewritten to match the current scheme. +# +# Two cases: (1) a synthetic fixture proves the detector itself catches the +# banned pattern (self-test, so a broken regex can't silently pass), and (2) a +# real scan of the plugin's shipped prose proves the corpus is clean today. +# shellcheck disable=SC2016 # fixture bodies are literal prose in single quotes; expansion is never wanted +set -uo pipefail + +SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PLUGIN_ROOT="$(cd "$SELF_DIR/.." && pwd)" + +PASS=0 +FAIL=0 +ok() { + printf 'PASS: %s\n' "$1" + PASS=$((PASS + 1)) +} +fail() { + printf 'FAIL: %s\n detail: %s\n' "$1" "$2" >&2 + FAIL=$((FAIL + 1)) +} + +# ERE for the banned value itself: p<0-3>-, e.g. p2-medium. Anchoring on +# the value rather than on a `priority:` qualifier is deliberate — the removed +# `--priority

` flag documentation listed the members bare, so a guard keyed +# to the qualifier would let that exact line back in. The leading alternation is +# a POSIX-ERE word boundary (no GNU `\b`), so `up2-medium` does not match while +# `priority:p2-medium`, `priority: p2-medium`, and a bare `p2-medium` all do. +PATTERN='(^|[^a-z0-9])p[0-3]-[a-z]+' + +# --- (1) self-test: the detector catches a synthetic hit ------------------- +fixture_dir="$(mktemp -d)" +trap 'rm -rf "$fixture_dir"' EXIT + +assert_detects() { + local label="$1" body="$2" file + file="$fixture_dir/$(printf '%s' "$label" | tr -c 'a-z0-9' '-').md" + printf '%s\n' "$body" >"$file" + if grep -qE "$PATTERN" "$file"; then + ok "detector matches $label" + else + fail "detector matches $label" "regex did not match: $body" + fi +} + +assert_detects 'the qualified colon-no-space form' \ + 'Default to `priority:p2-medium` when no directive sets one.' +assert_detects 'the qualified colon-space form' \ + 'Default to `priority: p2-medium` when no directive sets one.' +assert_detects 'a bare flag-value listing' \ + '`--priority

` -- Priority label (e.g., `p0-critical`, `p2-medium`, `p3-low`)' + +assert_clean() { + local label="$1" body="$2" file + file="$fixture_dir/clean-$(printf '%s' "$label" | tr -c 'a-z0-9' '-').md" + printf '%s\n' "$body" >"$file" + if grep -qE "$PATTERN" "$file"; then + fail "detector does not false-positive on $label" "regex matched: $body" + else + ok "detector does not false-positive on $label" + fi +} + +assert_clean 'live-resolution prose' \ + 'Resolve the live `priority:` label set from the bound adapter at action entry.' +assert_clean 'a longer word ending in the pN- shape' \ + 'The up2-medium and step2-milestone tokens are unrelated identifiers.' + +# --- (2) real scan: the shipped plugin corpus is clean ---------------------- +mapfile -t hits < <( + grep -rlE "$PATTERN" --include='*.md' "$PLUGIN_ROOT" 2>/dev/null | + grep -v '/CHANGELOG\.md$' | + grep -v '/evals/' | + sort +) + +if [[ ${#hits[@]} -eq 0 ]]; then + ok "no pN-* priority literal in plugin prose (CHANGELOG.md exempt)" +else + fail "no pN-* priority literal in plugin prose (CHANGELOG.md exempt)" "found in: ${hits[*]}" +fi + +echo "---" +echo "passed: $PASS, failed: $FAIL" +if [[ $FAIL -ne 0 ]]; then + exit 1 +fi +exit 0