From c44206decf8ce91cc3b2aea46477559a3e3361d6 Mon Sep 17 00:00:00 2001 From: alexbelgium Date: Thu, 23 Jul 2026 15:44:33 +0200 Subject: [PATCH] fix: clear stale tier-1 control labels on manual re-triage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verified: gh issue edit --add-label=... is purely additive, and the "owned" branch exited without touching labels at all — so a manual workflow_dispatch re-triage that changes the verdict (e.g. a prior addon-bug run now comes back needs-info, upstream-bug, or owned) left the old ai-triage label in place, and daily_ai_fix.yaml would still pick the issue up for the unattended fix pass despite the fresh verdict. Both label-applying paths now also remove whichever of ai-triage/ai:classified/ai:needs-human this run did NOT re-apply, as a separate best-effort call that can't block the add. Simulated every verdict/confidence transition, including the reported case (addon-bug -> needs-info): ai-triage is now correctly removed instead of left stale. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/on_issues_ai_triage.yaml | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_issues_ai_triage.yaml b/.github/workflows/on_issues_ai_triage.yaml index f307161a5f..597a8aaf40 100644 --- a/.github/workflows/on_issues_ai_triage.yaml +++ b/.github/workflows/on_issues_ai_triage.yaml @@ -117,9 +117,15 @@ jobs: # of ai-triage). mapfile -t LABELS < <(jq -r '.labels[]? // empty' "$F" | grep -vE '^ai[:-]' || true) - # Someone already owns this one: ping_submitter did its job. + # Someone already owns this one: ping_submitter did its job. Best- + # effort clear of a manual re-triage's stale control labels (e.g. a + # prior addon-bug run) — nothing to do if they were never set. if [ "$VERDICT" = "owned" ]; then - echo "issue already has an owner, nothing to do"; exit 0 + echo "issue already has an owner, nothing to do" + gh issue edit "$ISSUE" --repo "$REPO" \ + --remove-label=ai-triage --remove-label=ai:classified --remove-label=ai:needs-human \ + >/dev/null 2>&1 || true + exit 0 fi # Low confidence never speaks. It just flags for a human. @@ -149,6 +155,21 @@ jobs: gh issue edit "$ISSUE" --repo "$REPO" \ "${LABELS[@]/#/--add-label=}" + # Manual re-triage can flip the verdict (e.g. a prior addon-bug + # re-run now comes back needs-info/upstream-bug): clear whichever + # of tier 1's own control labels this run did NOT re-apply, so a + # stale ai-triage doesn't keep the issue in tomorrow's fix sweep. + # Separate, best-effort call — must not block the add above. + declare -A FRESH=() + for l in "${LABELS[@]}"; do FRESH["$l"]=1; done + STALE=() + for l in ai-triage ai:classified ai:needs-human; do + [ -z "${FRESH[$l]:-}" ] && STALE+=("$l") + done + if [ "${#STALE[@]}" -gt 0 ]; then + gh issue edit "$ISSUE" --repo "$REPO" "${STALE[@]/#/--remove-label=}" >/dev/null 2>&1 || true + fi + if [ -n "$COMMENT" ]; then { printf '%s\n\n' "$COMMENT"