diff --git a/.agents/scripts/circuit-breaker-helper.sh b/.agents/scripts/circuit-breaker-helper.sh index 17751e6005..fcacd36746 100755 --- a/.agents/scripts/circuit-breaker-helper.sh +++ b/.agents/scripts/circuit-breaker-helper.sh @@ -573,13 +573,18 @@ Supervisor dispatch is **paused**. No new tasks will be dispatched until the cir --description "Supervisor circuit breaker tripped — dispatch paused" \ --color "D93F0B" \ --force || true + gh label create "source:circuit-breaker" \ + --repo "$repo_slug" \ + --description "Auto-created by circuit-breaker-helper.sh" \ + --color "C2E0C6" \ + --force || true local issue_url issue_url=$(gh issue create \ --repo "$repo_slug" \ --title "Supervisor circuit breaker tripped — ${failure_count} consecutive failures" \ --body "$body" \ - --label "circuit-breaker") || { + --label "circuit-breaker" --label "source:circuit-breaker") || { _cb_log_warn "failed to create GitHub issue" return 1 } diff --git a/.agents/scripts/findings-to-tasks-helper.sh b/.agents/scripts/findings-to-tasks-helper.sh index d5ed45d201..bb904498ea 100755 --- a/.agents/scripts/findings-to-tasks-helper.sh +++ b/.agents/scripts/findings-to-tasks-helper.sh @@ -79,7 +79,7 @@ normalize_label_list() { local source="${2:-$DEFAULT_SOURCE}" local severity="${3:-$DEFAULT_SEVERITY}" - local out="actionable-finding,${source},severity:${severity}" + local out="actionable-finding,${source},severity:${severity},source:findings-to-tasks" local token="" local token_trimmed="" diff --git a/.agents/scripts/gh-failure-miner-helper.sh b/.agents/scripts/gh-failure-miner-helper.sh index a70290723e..d532a4c87d 100755 --- a/.agents/scripts/gh-failure-miner-helper.sh +++ b/.agents/scripts/gh-failure-miner-helper.sh @@ -543,6 +543,16 @@ create_systemic_issues() { candidate_file=$(mktemp) printf '%s\n' "$clusters_json" | jq --argjson min_count "$systemic_threshold" '[.[] | select(.count >= $min_count)]' >"$candidate_file" + # Ensure source label exists on repos that will receive issues + if [[ "$dry_run" != "true" ]]; then + local seen_repos="" + local repo_entry + for repo_entry in $(printf '%s\n' "$clusters_json" | jq -r '.[].repo' | sort -u); do + gh label create "source:ci-failure-miner" --repo "$repo_entry" \ + --description "Auto-created by gh-failure-miner-helper.sh" --color "C2E0C6" --force 2>/dev/null || true + done + fi + local candidate_count candidate_count=$(jq 'length' "$candidate_file") if [[ "$candidate_count" -eq 0 ]]; then @@ -585,7 +595,7 @@ create_systemic_issues() { if [[ "$dry_run" == "true" ]]; then echo "DRY RUN: would create issue: ${title}" else - local create_cmd=(gh issue create --repo "$repo_slug" --title "$title" --body "$body" --label bug) + local create_cmd=(gh issue create --repo "$repo_slug" --title "$title" --body "$body" --label bug --label "source:ci-failure-miner") local label for label in "${extra_labels[@]}"; do if [[ -n "$label" ]]; then diff --git a/.agents/scripts/milestone-validation-worker.sh b/.agents/scripts/milestone-validation-worker.sh index 2d4faea25a..ac151d0b58 100755 --- a/.agents/scripts/milestone-validation-worker.sh +++ b/.agents/scripts/milestone-validation-worker.sh @@ -1026,10 +1026,13 @@ create_fix_tasks() { **Validation criteria:** Re-run milestone validation after fix to confirm resolution." local issue_url + gh label create "source:mission-validation" --repo "$repo_slug" \ + --description "Auto-created by milestone-validation-worker.sh" \ + --color "C2E0C6" --force 2>/dev/null || true issue_url=$(gh issue create --repo "$repo_slug" \ --title "$fix_title" \ --body "$issue_body" \ - --label "bug,mission:$mission_id" 2>/dev/null || echo "") + --label "bug,mission:$mission_id,source:mission-validation" 2>/dev/null || echo "") if [[ -n "$issue_url" ]]; then log_success "Created fix issue: $issue_url" diff --git a/.agents/scripts/post-merge-review-scanner.sh b/.agents/scripts/post-merge-review-scanner.sh index 0ae7761d7b..49c70ebc25 100755 --- a/.agents/scripts/post-merge-review-scanner.sh +++ b/.agents/scripts/post-merge-review-scanner.sh @@ -64,6 +64,8 @@ create_issue() { fi gh label create "$SCANNER_LABEL" --repo "$repo" \ --description "Unaddressed review bot feedback" --color "D4C5F9" || true + gh label create "source:review-scanner" --repo "$repo" \ + --description "Auto-created by post-merge-review-scanner.sh" --color "C2E0C6" --force || true local body body="## Unaddressed review bot suggestions @@ -75,7 +77,7 @@ PR #${pr} was merged with unaddressed review bot feedback. ${summary} --- *Auto-created by post-merge-review-scanner.sh (t1386)*" - gh issue create --repo "$repo" --title "$title" --label "$SCANNER_LABEL" --body "$body" + gh issue create --repo "$repo" --title "$title" --label "$SCANNER_LABEL,source:review-scanner" --body "$body" } do_scan() { diff --git a/.agents/scripts/quality-feedback-helper.sh b/.agents/scripts/quality-feedback-helper.sh index 49ce10919f..91b5af4786 100755 --- a/.agents/scripts/quality-feedback-helper.sh +++ b/.agents/scripts/quality-feedback-helper.sh @@ -1395,9 +1395,11 @@ _create_quality_debt_issues() { return 0 fi - # Ensure labels exist (quality-debt + priority labels for dispatch ordering, t1413) + # Ensure labels exist (quality-debt + source + priority labels for dispatch ordering, t1413) gh label create "quality-debt" --repo "$repo_slug" --color "D93F0B" \ --description "Unactioned review feedback from merged PRs" --force || true + gh label create "source:review-feedback" --repo "$repo_slug" --color "C2E0C6" \ + --description "Auto-created by quality-feedback-helper.sh" --force || true gh label create "priority:critical" --repo "$repo_slug" --color "B60205" \ --description "Critical severity — security or data loss risk" --force || true gh label create "priority:high" --repo "$repo_slug" --color "D93F0B" \ @@ -1545,8 +1547,8 @@ _Auto-generated by \`quality-feedback-helper.sh scan-merged\`. Review each findi *) priority_label="" ;; esac - # Create the issue with severity-based priority label - local label_args="quality-debt" + # Create the issue with severity-based priority label and source provenance + local label_args="quality-debt,source:review-feedback" [[ -n "$priority_label" ]] && label_args="${label_args},${priority_label}" local new_issue diff --git a/.agents/scripts/self-evolution-helper.sh b/.agents/scripts/self-evolution-helper.sh index 43faa4e259..6c3b6ee929 100755 --- a/.agents/scripts/self-evolution-helper.sh +++ b/.agents/scripts/self-evolution-helper.sh @@ -726,7 +726,7 @@ Gap lifecycle: detected → todo_created → resolved" --repo-path "$repo_path" \ --title "Self-evolution: ${description}" \ --description "$issue_body" \ - --labels "self-evolution,auto-dispatch" 2>&1) || { + --labels "self-evolution,auto-dispatch,source:self-evolution" 2>&1) || { log_warn "claim-task-id.sh failed — recording gap without TODO" log_warn "Output: $claim_output" # Still update the gap status to avoid re-processing diff --git a/.agents/scripts/stats-functions.sh b/.agents/scripts/stats-functions.sh index f11b3f06a0..4e9a395b8f 100755 --- a/.agents/scripts/stats-functions.sh +++ b/.agents/scripts/stats-functions.sh @@ -280,11 +280,13 @@ _update_health_issue_for_repo() { --description "$role_label_desc" --force 2>/dev/null || true gh label create "$runner_user" --repo "$repo_slug" --color "0E8A16" \ --description "${role_display} runner: ${runner_user}" --force 2>/dev/null || true + gh label create "source:health-dashboard" --repo "$repo_slug" --color "C2E0C6" \ + --description "Auto-created by stats-functions.sh health dashboard" --force 2>/dev/null || true health_issue_number=$(gh issue create --repo "$repo_slug" \ --title "${runner_prefix} starting..." \ --body "Live ${runner_role} status for **${runner_user}**. Updated each pulse. Pin this issue for at-a-glance monitoring." \ - --label "$role_label" --label "$runner_user" 2>/dev/null | grep -oE '[0-9]+$' || echo "") + --label "$role_label" --label "$runner_user" --label "source:health-dashboard" 2>/dev/null | grep -oE '[0-9]+$' || echo "") if [[ -z "$health_issue_number" ]]; then echo "[stats] Health issue: could not create for ${repo_slug}" >>"$LOGFILE" @@ -983,11 +985,13 @@ _ensure_quality_issue() { --description "Daily code quality review" --force 2>/dev/null || true gh label create "persistent" --repo "$repo_slug" --color "FBCA04" \ --description "Persistent issue — do not close" --force 2>/dev/null || true + gh label create "source:quality-sweep" --repo "$repo_slug" --color "C2E0C6" \ + --description "Auto-created by stats-functions.sh quality sweep" --force 2>/dev/null || true issue_number=$(gh issue create --repo "$repo_slug" \ --title "Daily Code Quality Review" \ --body "Persistent issue for daily code quality sweeps across multiple tools (CodeRabbit, Qlty, ShellCheck, Codacy, SonarCloud). The supervisor posts findings here and creates actionable issues from them. **Do not close this issue.**" \ - --label "quality-review" --label "persistent" 2>/dev/null | grep -oE '[0-9]+$' || echo "") + --label "quality-review" --label "persistent" --label "source:quality-sweep" 2>/dev/null | grep -oE '[0-9]+$' || echo "") if [[ -z "$issue_number" ]]; then echo "[stats] Quality sweep: could not create issue for ${repo_slug}" >>"$LOGFILE" @@ -1107,6 +1111,9 @@ _create_simplification_issues() { gh label create "needs-maintainer-review" --repo "$repo_slug" \ --description "Requires maintainer approval before automated dispatch" \ --color "FBCA04" 2>/dev/null || true + gh label create "source:quality-sweep" --repo "$repo_slug" \ + --description "Auto-created by stats-functions.sh quality sweep" \ + --color "C2E0C6" --force 2>/dev/null || true # Extract files with smell count > threshold, sorted by count descending local high_smell_files @@ -1185,7 +1192,7 @@ This file was flagged by the daily quality sweep for high smell density. The sme if gh issue create --repo "$repo_slug" \ --title "$issue_title" \ - --label "simplification-debt" --label "needs-maintainer-review" \ + --label "simplification-debt" --label "needs-maintainer-review" --label "source:quality-sweep" \ --assignee "$maintainer" \ --body "$issue_body" >/dev/null 2>&1; then issues_created=$((issues_created + 1))