From a0da97113b580bdf6db632c99e7cca343698be57 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Apr 2026 18:10:58 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20bug:=20dev-poll=20stale=20detection=20ig?= =?UTF-8?q?nores=20label=20scope=20=E2=80=94=20relabels=20in-progress=20bu?= =?UTF-8?q?g-reports=20as=20blocked=20(#608)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add issue_is_dev_claimable() helper to lib/issue-lifecycle.sh that checks whether an issue's labels are compatible with dev-agent ownership. Labels like bug-report, vision, in-triage, prediction/*, action, and formula indicate another agent owns the issue. In dev-poll.sh, replace the vision-only skip with the new helper so that ALL non-dev labels are excluded from stale detection. This prevents dev-poll from relabeling bug-reports (or other agent-owned issues) as blocked while they are being triaged. Also removes the now-redundant formula/prediction guard block in the orphan section, since issue_is_dev_claimable covers those labels. Co-Authored-By: Claude Opus 4.6 (1M context) --- dev/dev-poll.sh | 24 ++++++------------------ lib/issue-lifecycle.sh | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/dev/dev-poll.sh b/dev/dev-poll.sh index d056b64..e18bd25 100755 --- a/dev/dev-poll.sh +++ b/dev/dev-poll.sh @@ -439,12 +439,14 @@ if [ "$ORPHAN_COUNT" -gt 0 ]; then OPEN_PR=true fi - # Skip vision-labeled issues — they are managed by architect agent, not dev-poll + # Skip issues owned by non-dev agents (bug-report, vision, prediction, etc.) + # See issue #608: dev-poll must only touch issues it could actually claim. issue_labels=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \ "${API}/issues/${ISSUE_NUM}" | jq -r '[.labels[].name] | join(",")') - if echo "$issue_labels" | grep -q "vision"; then - log "issue #${ISSUE_NUM} has 'vision' label — skipping stale detection (managed by architect)" - BLOCKED_BY_INPROGRESS=true + if ! issue_is_dev_claimable "$issue_labels"; then + log "issue #${ISSUE_NUM} has non-dev label(s) [${issue_labels}] — skipping (owned by another agent)" + BLOCKED_BY_INPROGRESS=false + OTHER_AGENT_INPROGRESS=true fi # Check if issue has an assignee — only block on issues assigned to this agent @@ -505,20 +507,6 @@ if [ "$ORPHAN_COUNT" -gt 0 ]; then fi fi - # Formula guard: formula-labeled issues should not be worked on by dev-agent. - # Remove in-progress label and skip to prevent infinite respawn cycle (#115). - if [ "$BLOCKED_BY_INPROGRESS" = false ]; then - ORPHAN_LABELS=$(echo "$ORPHANS_JSON" | jq -r '.[0].labels[].name' 2>/dev/null) || true - SKIP_LABEL=$(echo "$ORPHAN_LABELS" | grep -oE '^(formula|prediction/dismissed|prediction/unreviewed)$' | head -1) || true - if [ -n "$SKIP_LABEL" ]; then - log "issue #${ISSUE_NUM} has '${SKIP_LABEL}' label — removing in-progress, skipping" - IP_ID=$(_ilc_in_progress_id) - curl -sf -X DELETE -H "Authorization: token ${FORGE_TOKEN}" \ - "${API}/issues/${ISSUE_NUM}/labels/${IP_ID}" >/dev/null 2>&1 || true - BLOCKED_BY_INPROGRESS=true - fi - fi - # Check if there's already an open PR for this issue if [ "$BLOCKED_BY_INPROGRESS" = false ]; then HAS_PR=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \ diff --git a/lib/issue-lifecycle.sh b/lib/issue-lifecycle.sh index ed56c02..743f871 100644 --- a/lib/issue-lifecycle.sh +++ b/lib/issue-lifecycle.sh @@ -79,6 +79,27 @@ _ilc_backlog_id() { _ilc_ensure_label_id "backlog" "#0075ca"; } _ilc_in_progress_id() { _ilc_ensure_label_id "in-progress" "#1d76db"; } _ilc_blocked_id() { _ilc_ensure_label_id "blocked" "#e11d48"; } +# --------------------------------------------------------------------------- +# Labels that indicate an issue belongs to a non-dev agent workflow. +# Any issue carrying one of these should NOT be touched by dev-poll's +# stale-detection or orphan-recovery logic. See issue #608. +# --------------------------------------------------------------------------- +_ILC_NON_DEV_LABELS="bug-report vision in-triage prediction/unreviewed prediction/dismissed action formula" + +# issue_is_dev_claimable COMMA_SEPARATED_LABELS +# Returns 0 if the issue's labels are compatible with dev-agent ownership, +# 1 if any non-dev label is present (meaning another agent owns this issue). +issue_is_dev_claimable() { + local labels="$1" + local lbl + for lbl in $_ILC_NON_DEV_LABELS; do + if echo ",$labels," | grep -qF ",$lbl,"; then + return 1 + fi + done + return 0 +} + # --------------------------------------------------------------------------- # issue_claim — assign issue to bot, add "in-progress" label, remove "backlog". # Args: issue_number