Objective
Ensure that fallback issues created when create_pull_request fails (push failure or PR API failure) always include the agentic-workflows label so they are visible to the triage/grouping system.
Context
Reported in issue #18980. When create_pull_request.cjs falls back to creating a GitHub issue (on push failure or PR creation failure), it uses only the workflow-configured labels. However, handle_agent_failure.cjs always adds "agentic-workflows" to failure issues, and ensureParentIssue() searches label:agentic-workflows to group failures under [aw] Failed runs. Without this label, push-failure fallback issues are invisible to the triage system.
Location
actions/setup/js/create_pull_request.cjs:
- ~line 726 — push failure fallback
issues.create() call (labels: labels) - ~line 1003 — PR creation failure fallback
issues.create() call (labels: labels)
Approach
- Add a constant and a helper function near the top of the file (or in the fallback section):
constMANAGED_FALLBACK_ISSUE_LABEL="agentic-workflows";functionmergeFallbackIssueLabels(labels=[]){constnormalizedLabels=labels.filter(label=>!!label).map(label=>String(label).trim()).filter(label=>label);return[...newSet([MANAGED_FALLBACK_ISSUE_LABEL, ...normalizedLabels])];}- Replace
labels: labels with labels: mergeFallbackIssueLabels(labels) at bothissues.create() fallback call sites.
Files to Modify
actions/setup/js/create_pull_request.cjs
Acceptance Criteria
Generated by Plan Command for issue #18980
Objective
Ensure that fallback issues created when
create_pull_requestfails (push failure or PR API failure) always include theagentic-workflowslabel so they are visible to the triage/grouping system.Context
Reported in issue #18980. When
create_pull_request.cjsfalls back to creating a GitHub issue (on push failure or PR creation failure), it uses only the workflow-configuredlabels. However,handle_agent_failure.cjsalways adds"agentic-workflows"to failure issues, andensureParentIssue()searcheslabel:agentic-workflowsto group failures under[aw] Failed runs. Without this label, push-failure fallback issues are invisible to the triage system.Location
actions/setup/js/create_pull_request.cjs:issues.create()call (labels: labels)issues.create()call (labels: labels)Approach
labels: labelswithlabels: mergeFallbackIssueLabels(labels)at bothissues.create()fallback call sites.Files to Modify
actions/setup/js/create_pull_request.cjsAcceptance Criteria
agentic-workflowslabelagentic-workflowslabelagentic-workflowslabel is deduplicated if it was already inlabelsmake fmt-cjsandmake lint-cjsafter the changeRelated to create_pull_request / push_to_pull_request_branch: push failure misattributed as patch failure + fallback issues missing agentic-workflows label #18980