fix: fix: triage agent creates root cause issues without backlog label (#386)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Agent 2026-04-07 21:45:07 +00:00
parent 01f97ed6e5
commit ad1acc092e
2 changed files with 30 additions and 2 deletions

View file

@ -323,7 +323,7 @@ For each root cause found:
-d '{
"title": "fix: <specific description of root cause N>",
"body": "## Root cause\\n<exact code path, file:line>\\n\\n## Fix suggestion\\n<recommended approach>\\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
# ---------------------------------------------------------------------------

View file

@ -183,7 +183,7 @@ For each root cause found:
-d '{
"title": "fix: <specific description of root cause N>",
"body": "## Root cause\\n<exact code path, file:line>\\n\\n## Fix suggestion\\n<recommended approach>\\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.