Skip to content

Fix copilot PR search logic to find PRs created by Copilot bot - #1972

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-search-logic-for-prs
Oct 19, 2025
Merged

pelikhan merged 3 commits into
mainfrom
copilot/fix-search-logic-for-prs

Conversation

Copilot AI commented Oct 19, 2025 •

Copy link
Copy Markdown
Contributor

Problem

The copilot-agent-analysis workflow was unable to find PRs created by the Copilot coding agent because it was using an incorrect search strategy. The workflow searched for author:copilot-swe-agent, which returned 0 results.

Investigation revealed that:

  1. PRs are actually created by the user Copilot (ID: 198982749, type: Bot)
  2. GitHub's Issues Search API doesn't support the author: filter for bot accounts
  3. The username "copilot-swe-agent" doesn't exist in GitHub's user search index

This caused the daily analysis workflow to report only 1 PR when it should have found hundreds, as referenced in discussion #1966.

Solution

Updated the workflow instructions to use keyword-based search instead of author-based search:

repo:githubnext/gh-aw is:pr "START COPILOT CODING AGENT" created:>=YYYY-MM-DD

This searches for the signature text that Copilot automatically adds to all PR bodies, which is both reliable and efficient.

Alternative Strategies Provided

The workflow now documents three approaches for finding Copilot PRs:

  1. Keyword search (Recommended): Search for "START COPILOT CODING AGENT" signature text
  2. List and filter: Use list_pull_requests tool and filter by user.login == "Copilot" and user.id == 198982749
  3. Alternative keyword: Search for "Original prompt" which appears in Copilot PR descriptions

Testing

Verified the fix works correctly:

  • Old method: author:copilot-swe-agent → 0 PRs found ❌
  • New method: "START COPILOT CODING AGENT" → 881 PRs found ✅
  • With date filter: created:>=2025-10-15 → 142 PRs found ✅

All unit tests pass (338 tests) and the workflow compiles successfully.

Changes

  • Updated .github/workflows/copilot-agent-analysis.md with correct search strategies
  • Replaced all references from copilot-swe-agent to Copilot
  • Recompiled workflow to generate updated .lock.yml file

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://github.com/proxy/api.github.com/repos/githubnext/gh-aw/discussions
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

The logic used to search copilot PRs is wrong in the copilot audit agentic workflows.

It is missing most PRs

See this report #1966 where only 1 Pr Is found. It should be many more.

Review search logic to match Pr created by copilot-see-agent


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Updated copilot-agent-analysis.md to use correct search strategy:
- GitHub API doesn't support author:bot_name for bot accounts
- Use keyword search: "START COPILOT CODING AGENT" which appears in all Copilot PRs
- Alternative: list_pull_requests + filter by user.login=="Copilot" and user.id==198982749
- Updated all references from copilot-swe-agent to Copilot
- Tested: keyword search returns 881 PRs vs 0 with old author: search

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix search logic in copilot audit workflows Fix copilot PR search logic to find PRs created by Copilot bot Oct 19, 2025
Copilot AI requested a review from pelikhan October 19, 2025 09:56
@pelikhan
pelikhan marked this pull request as ready for review October 19, 2025 16:01
@github-actions

Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan
pelikhan merged commit ac09bf6 into main Oct 19, 2025
4 checks passed
@pelikhan
pelikhan deleted the copilot/fix-search-logic-for-prs branch October 19, 2025 16:07
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.

2 participants