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