mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-20 11:57:19 +02:00
fix: clear stale tier-1 control labels on manual re-triage
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 <noreply@anthropic.com>
This commit is contained in:
25
.github/workflows/on_issues_ai_triage.yaml
vendored
25
.github/workflows/on_issues_ai_triage.yaml
vendored
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user