Reuse open [aw] <workflow> failed issues before creating new failure reports#34946
Conversation
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
[aw] <workflow> failed issues before creating new failure reports
| }); | ||
|
|
||
| for (const item of searchResult.data.items) { | ||
| if (!fallbackTitleMatch && item.title === issueTitle) { |
There was a problem hiding this comment.
@copilot xml tags to have precise matching. See helpers for finding matching issues .
There was a problem hiding this comment.
Addressed in 4fc86d5. The failure-issue reuse path now searches by the workflow XML marker in the issue body and only falls back to legacy issues with the matching marker, instead of reusing by raw title match.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR reduces duplicate [aw] <workflow> failed issues by improving the “find existing failure issue” logic to (1) prefer exact failure-metadata matches and (2) fall back to reusing older (“legacy”) issues identified via workflow marker metadata, including safer GitHub search query construction.
Changes:
- Added legacy failure-issue reuse detection based on workflow XML marker presence + non-expiration + absence of the precise failure marker.
- Hardened GitHub search query construction by escaping workflow IDs for safe inclusion in quoted search phrases.
- Updated/expanded tests to cover legacy reuse behavior and workflow-id escaping in search queries.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/handle_agent_failure.cjs | Adds legacy-issue reuse path, introduces GitHub search phrase escaping, and changes the search strategy to body-marker-based matching. |
| actions/setup/js/handle_agent_failure.test.cjs | Extends tests for legacy-marker reuse and verifies workflow-id escaping in the search query. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
| async function findExistingFailureIssue(options) { | ||
| const { owner, repo, issueTitle, workflowId, branch, pullRequestNumber, failureCategories } = options; | ||
| const searchQuery = `repo:${owner}/${repo} is:issue is:open label:agentic-workflows in:title "${issueTitle}"`; | ||
| const escapedWorkflowId = escapeGitHubSearchPhrase(workflowId); | ||
| const searchQuery = `repo:${owner}/${repo} is:issue is:open label:agentic-workflows ` + `"gh-aw-agentic-workflow:" "workflow_id: ${escapedWorkflowId}" in:body`; | ||
| const perPage = 100; | ||
| /** @type {{number: number, html_url: string} | null} */ | ||
| let legacyWorkflowMatch = null; | ||
|
|
| * @returns {boolean} True when the issue belongs to the workflow, is not expired, and | ||
| * does not already carry a precise failure marker | ||
| */ | ||
| function isLegacyReusableFailureIssue(body, workflowId) { |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Failure reporters were creating a new
[aw] <workflow> failedissue on every retry, which produced large volumes of duplicate open issues. This change adds an open-issue dedup check so repeated failures append context to the existing issue instead of filing another one.What changed
handle_agent_failure.cjsnow reuses an existing open failure issue when the title exactly matches[aw] <workflow> failed.Why this matters
Test coverage