Skip to content

Match agent failure issues by stored metadata instead of title alone#33089

Merged
pelikhan merged 10 commits into
mainfrom
copilot/fix-agent-failure-issue-handler
May 18, 2026
Merged

Match agent failure issues by stored metadata instead of title alone#33089
pelikhan merged 10 commits into
mainfrom
copilot/fix-agent-failure-issue-handler

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

The failure-issue handler was reusing open issues by workflow title alone, causing unrelated failures across branches, PRs, categories, and expired reports to accumulate into the same thread. This change scopes reuse to the issue’s stored workflow metadata and expiration state so only the same failure stream is appended.

  • Problem

    • Failure issues were treated as reusable if the title matched, ignoring:
      • workflow_id already stored in the body marker
      • triggering branch / PR
      • failure category
      • expiration marker
    • In practice, one stale issue could become a long-lived sink for unrelated failures.
  • What changed

    • Added precise issue matching based on HTML/XML comment metadata embedded in the issue body.
    • Reuse now requires an exact match on:
      • workflow_id
      • branch
      • optional PR number
      • normalized failure category set
    • Expired issues are no longer eligible for reuse.
    • New failure issues now include a dedicated failure-match marker alongside the existing workflow marker.
  • Search behavior

    • Kept title search as the coarse candidate filter.
    • Added body inspection to select the correct issue from same-title candidates.
    • Paginated candidate search so matching does not silently stop after the first 100 results.
  • Metadata format

    • New issues now carry a dedicated marker like:
<!-- gh-aw-failure-issue: true, workflow_id: pr-docs-check, branch: docs/fix-links, pull_request: 123, failure_categories: missing_safe_outputs|report_incomplete -->
  • Test coverage
    • Added focused handler tests for:
      • exact-match reuse
      • same-title but different branch/category creating a new issue
      • expired issues not being reused

pr-sous-chef: refreshed branch from https://github.com/github/gh-aw/actions/runs/26052176977

Generated by 👨‍🍳 PR Sous Chef ·

Copilot AI and others added 4 commits May 18, 2026 16:51
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>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue handler to match by workflow id and other criteria Match agent failure issues by stored metadata instead of title alone May 18, 2026
Copilot AI requested a review from pelikhan May 18, 2026 17:05
@pelikhan pelikhan marked this pull request as ready for review May 18, 2026 18:19
Copilot AI review requested due to automatic review settings May 18, 2026 18:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens failure issue reuse so new failures are matched against stored workflow/failure metadata instead of title alone.

Changes:

  • Adds parsing and generation of failure-match metadata markers.
  • Uses branch, PR number, workflow ID, categories, and expiration state when reusing issues.
  • Adds focused tests and regenerates one workflow lockfile.
Show a summary per file
File Description
actions/setup/js/handle_agent_failure.cjs Implements precise metadata-based failure issue matching.
actions/setup/js/handle_agent_failure.test.cjs Adds tests for matching, mismatching, and expired failure issues.
.github/workflows/pr-description-caveman.lock.yml Regenerates the PR Description Updater workflow lockfile with updated runtime/action configuration.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

actions/setup/js/handle_agent_failure.cjs:260

  • The new pagination behavior is not covered by the added tests. A regression here would silently reintroduce the first-100-results limit for same-title failure issues, so add a test where the matching issue appears on a later page.
  for (let page = 1; ; page += 1) {
    const searchResult = await github.rest.search.issuesAndPullRequests({
      q: searchQuery,
      per_page: perPage,
      page,
    });
  • Files reviewed: 3/3 changed files
  • Comments generated: 2


/** @type {Record<string, string>} */
const metadata = {};
const pairPattern = /([a-zA-Z0-9_-]+):\s*([^,]+?)(?=,\s*[a-zA-Z0-9_-]+:\s*|$)/g;
- name: Setup Scripts
id: setup
uses: github/gh-aw-actions/setup@v0.72.1
uses: ./actions/setup
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

@github-actions
Copy link
Copy Markdown
Contributor

@copilot review all comments

Please address the unresolved review feedback and rerun checks after the branch refresh.

Generated by 👨‍🍳 PR Sous Chef ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 18, 2026

@copilot review all comments

Addressed the reviewer comments in c663f28: fixed failure-issue metadata parsing so comma-containing marker values still match correctly, added coverage for comma-containing workflow/branch values, and removed the unrelated pr-description-caveman.lock.yml change from this PR.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

Copilot AI and others added 2 commits May 18, 2026 18:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions github-actions Bot mentioned this pull request May 18, 2026
…lure-issue-handler

# Conflicts:
#	actions/setup/js/handle_agent_failure.test.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 18, 2026

@copilot review all comments

Addressed in ab38fd8: kept the comma-safe metadata parsing fix, refreshed the branch from origin/main so the unrelated pr-description-caveman.lock.yml change is no longer in the PR, and re-ran actions/setup/js/handle_agent_failure.test.cjs successfully.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot add tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 18, 2026

@copilot add tests

Added targeted regression coverage in 82deb9e for paginated same-title issue search and exact pull-request metadata matching, and re-ran npm test -- --run handle_agent_failure.test.cjs successfully.

@github-actions
Copy link
Copy Markdown
Contributor

``
@copilot review all comments

Please summarize remaining blockers and post a short completion plan. If applicable, refresh the branch and rerun checks.

``

Generated by 👨‍🍳 PR Sous Chef ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure-issue handler matches by title alone, turning one issue into an unbounded multi-PR / multi-cause / post-expiry comment magnet

3 participants