From ad1acc092eb8100297e679c796e5c3fb863a682a Mon Sep 17 00:00:00 2001 From: Agent Date: Tue, 7 Apr 2026 21:45:07 +0000 Subject: [PATCH] fix: fix: triage agent creates root cause issues without backlog label (#386) --- docker/reproduce/entrypoint-reproduce.sh | 30 +++++++++++++++++++++++- formulas/triage.toml | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docker/reproduce/entrypoint-reproduce.sh b/docker/reproduce/entrypoint-reproduce.sh index c36192a..2715602 100644 --- a/docker/reproduce/entrypoint-reproduce.sh +++ b/docker/reproduce/entrypoint-reproduce.sh @@ -323,7 +323,7 @@ For each root cause found: -d '{ "title": "fix: ", "body": "## Root cause\\n\\n\\n## Fix suggestion\\n\\n\\n## Context\\nDecomposed from #\${ISSUE_NUMBER} (cause N of M)\\n\\n## Dependencies\\n<#X if this depends on another cause being fixed first>", - "labels": ["backlog"] + "labels": [{"name": "backlog"}] }' 3. Note the newly created issue numbers. @@ -487,6 +487,34 @@ if [ $CLAUDE_EXIT -eq 124 ]; then log "WARNING: Claude session timed out after ${FORMULA_TIMEOUT_MINUTES}m" fi +# --------------------------------------------------------------------------- +# Triage post-processing: enforce backlog label on created issues +# --------------------------------------------------------------------------- +# The triage agent may create sub-issues for root causes. Ensure they have +# the backlog label so dev-agent picks them up. Parse Claude output for +# newly created issue numbers and add the backlog label. +if [ "$AGENT_TYPE" = "triage" ]; then + log "Triage post-processing: checking for created issues to label..." + + # Extract issue numbers from Claude output that were created during triage + # Look for patterns like "Created issue #123" or "harb#123" or "#123" after "create" + CREATED_ISSUES=$(grep -oE '(Created|created) issue #[0-9]+|harb#[0-9]+|#[0-9]+' \ + "/tmp/reproduce-claude-output-${ISSUE_NUMBER}.txt" 2>/dev/null | \ + grep -oE '[0-9]+' | sort -u | head -10) + + if [ -n "$CREATED_ISSUES" ]; then + # Get backlog label ID + BACKLOG_ID=$(_label_id "backlog" "#fef2c0") + + for issue_num in $CREATED_ISSUES; do + if [ -n "$BACKLOG_ID" ]; then + _add_label "$issue_num" "$BACKLOG_ID" + log "Added backlog label to created issue #${issue_num}" + fi + done + fi +fi + # --------------------------------------------------------------------------- # Read outcome # --------------------------------------------------------------------------- diff --git a/formulas/triage.toml b/formulas/triage.toml index eb3bc3a..63be3d9 100644 --- a/formulas/triage.toml +++ b/formulas/triage.toml @@ -183,7 +183,7 @@ For each root cause found: -d '{ "title": "fix: ", "body": "## Root cause\\n\\n\\n## Fix suggestion\\n\\n\\n## Context\\nDecomposed from #${ISSUE_NUMBER} (cause N of M)\\n\\n## Dependencies\\n<#X if this depends on another cause being fixed first>", - "labels": ["backlog"] + "labels": [{"name": "backlog"}] }' 3. Note the newly created issue numbers.