diff --git a/.agents/scripts/issue-sync-lib.sh b/.agents/scripts/issue-sync-lib.sh index 1a4ef2f2af..294ca08ff7 100755 --- a/.agents/scripts/issue-sync-lib.sh +++ b/.agents/scripts/issue-sync-lib.sh @@ -80,10 +80,23 @@ parse_task_line() { local task_id task_id=$(echo "$line" | grep -oE 't[0-9]+(\.[0-9]+)*' | head -1 || echo "") - # Extract description (between task ID and first metadata field) + # Extract FULL description (everything after task ID, including em-dash content) + # We'll clean out metadata fields separately, but preserve the full text + local full_text + full_text=$(echo "$line" | sed -E 's/^[[:space:]]*- \[.\] t[0-9]+(\.[0-9]+)* //' || echo "") + + # Extract description by removing all metadata fields but keeping em-dash content + # Strategy: remove tags, estimate, and key:value pairs, but preserve text after em dash local description - description=$(echo "$line" | sed -E 's/^[[:space:]]*- \[.\] t[0-9]+(\.[0-9]+)* //' | - sed -E 's/ (#[a-z]|~[0-9]|→ |logged:|started:|completed:|ref:|actual:|blocked-by:|blocks:|assignee:|verified:).*//' || + description=$(echo "$full_text" | + sed -E 's/ #[a-z][a-z0-9-]*//g' | # Remove tags + sed -E 's/ ~[0-9]+[hmd]( \(ai:[^)]+\))?//g' | # Remove estimate + sed -E 's/ (logged|started|completed|actual|verified):[^ ]+//g' | # Remove date fields + sed -E 's/ (assignee|blocked-by|blocks|model|category):[^ ]+//g' | # Remove other metadata + sed -E 's/ ref:GH#[0-9]+//g' | # Remove GH ref + sed -E 's/ pr:#[0-9]+//g' | # Remove PR ref + sed -E 's/ → \[todo\/PLANS\.md#[^]]+\]//g' | # Remove plan link + sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//' || # Trim whitespace echo "") # Extract tags diff --git a/.agents/scripts/supervisor/issue-sync.sh b/.agents/scripts/supervisor/issue-sync.sh index 2215582af4..c18cc0ec4c 100755 --- a/.agents/scripts/supervisor/issue-sync.sh +++ b/.agents/scripts/supervisor/issue-sync.sh @@ -457,13 +457,14 @@ sync_issue_status_label() { if [[ -n "$fail_error" && "$fail_error" != "null" ]]; then fail_comment="Task $task_id failed (was: $old_state). Error: $fail_error" fi - # Close with failure comment but don't add status:done - gh issue close "$issue_number" --repo "$repo_slug" \ - --comment "$fail_comment" 2>/dev/null || true + # DO NOT auto-close failed tasks - they need human review + # Add needs-review label and post failure comment, but keep issue OPEN + gh issue comment "$issue_number" --repo "$repo_slug" \ + --body "$fail_comment" 2>/dev/null || true gh issue edit "$issue_number" --repo "$repo_slug" \ - "${remove_args[@]}" 2>/dev/null || true - log_verbose "sync_issue_status_label: closed #$issue_number as failed ($task_id)" - return 0 + --add-label "needs-review" "${remove_args[@]}" 2>/dev/null || true + log_verbose "sync_issue_status_label: flagged #$issue_number for review ($task_id failed)" + # Don't return here - let the non-terminal state logic handle label updates ;; blocked) # Read the error/blocked reason from DB