Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .agents/scripts/issue-sync-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,19 @@
IFS="$_saved_ifs"
}

# Status labels to remove when marking an issue done (t3517: array for safe iteration).
_DONE_REMOVE_LABELS=("status:available" "status:queued" "status:claimed" "status:in-review" "status:blocked" "status:verify-failed")

_mark_issue_done() {
local repo="$1" num="$2"
local -a remove_args=()
local lbl
for lbl in "${_DONE_REMOVE_LABELS[@]}"; do
remove_args+=("--remove-label" "$lbl")
done
gh_create_label "$repo" "status:done" "6F42C1" "Task is complete"
_gh_edit_labels "add" "$repo" "$num" "status:done"
_gh_edit_labels "remove" "$repo" "$num" "status:available,status:queued,status:claimed,status:in-review,status:blocked,status:verify-failed"
[[ ${#remove_args[@]} -gt 0 ]] && gh issue edit "$num" --repo "$repo" "${remove_args[@]}" 2>/dev/null || true
}

# =============================================================================
Expand Down Expand Up @@ -621,7 +629,7 @@
local ref_fixed=0 ref_ok=0 stale=0 orphans=0
while IFS= read -r line; do
local tid
tid=$(echo "$line" | grep -oE 't[0-9]+(\.[0-9]+)*' | head -1 || echo "")

Check warning on line 632 in .agents/scripts/issue-sync-helper.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 't[0-9]+(\.[0-9]+)*' 4 times.

See more on https://sonarcloud.io/project/issues?id=marcusquinn_aidevops&issues=AZzrnHCmuzevaEjDRusi&open=AZzrnHCmuzevaEjDRusi&pullRequest=4741
local gh_ref
gh_ref=$(echo "$line" | grep -oE 'ref:GH#[0-9]+' | head -1 | sed 's/ref:GH#//' || echo "")
[[ -z "$tid" || -z "$gh_ref" ]] && continue
Expand Down
15 changes: 7 additions & 8 deletions .agents/scripts/supervisor-archived/issue-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ state_to_status_label() {
# All status labels that can be set on an issue (t1009)
# Used to remove stale labels before applying the new one.
# Restored from pre-modularisation supervisor-helper.sh (t1035).
# Defined as a bash array for safe iteration without IFS/word-splitting (t3517).
#######################################
ALL_STATUS_LABELS="status:available,status:queued,status:claimed,status:in-review,status:blocked,status:verify-failed,status:needs-testing,status:done"
ALL_STATUS_LABELS=("status:available" "status:queued" "status:claimed" "status:in-review" "status:blocked" "status:verify-failed" "status:needs-testing" "status:done")

#######################################
# Sync GitHub issue status label on state transition (t1009)
Expand Down Expand Up @@ -402,13 +403,11 @@ sync_issue_status_label() {
# Build remove args for all status labels except the new one
local -a remove_args=()
local label
while IFS=',' read -ra labels; do
for label in "${labels[@]}"; do
if [[ "$label" != "$new_label" ]]; then
remove_args+=("--remove-label" "$label")
fi
done
done <<<"$ALL_STATUS_LABELS"
for label in "${ALL_STATUS_LABELS[@]}"; do
if [[ "$label" != "$new_label" ]]; then
remove_args+=("--remove-label" "$label")
fi
done

# Handle terminal states that close the issue
case "$new_state" in
Expand Down
Loading