Skip to content

feat: Enhance pr-comment-responder to handle Copilot's follow-up PR pattern #2

@rjmurillo

Description

@rjmurillo

Summary

The pr-comment-responder agent does not properly handle Copilot's unique response pattern. When replying to @Copilot review comments, Copilot responds differently than human reviewers:

  1. Creates a separate follow-up PR branched from the current PR
  2. Posts an issue comment on the original PR (not a review comment reply)
  3. Links to the follow-up PR in that issue comment

This causes orphaned conversations and unnecessary follow-up PRs cluttering the repository.

Problem Observed

From PR #57:

Current Behavior

The pr-comment-responder agent:

  • Γ£à Retrieves review comments via gh api repos/{owner}/{repo}/pulls/{pr}/comments
  • Γ£à Replies to comments via the replies endpoint
  • Γ¥î Does NOT check issue comments for Copilot's follow-up responses
  • Γ¥î Does NOT identify or close Copilot's generated follow-up PRs

Desired Behavior

  1. Detect Copilot Response: After replying to @Copilot, poll issue comments for Copilot's response
  2. Parse Response Intent: Determine if action is needed or if our explanation was accepted
  3. Manage Follow-up PRs: If a follow-up PR is created and no action is required, close it with explanation
  4. Report Results: Include "Copilot Interactions" table in the agent's output summary

User Stories

ID Story Acceptance Summary
US-1 Detect Copilot response in issue comments Poll issue comments, filter by author/timestamp
US-2 Identify follow-up PRs Parse comment for PR links, validate PR exists
US-3 Close unnecessary follow-up PRs Evaluate reply intent, close with explanation
US-4 Report interaction results Add "Copilot Interactions" table to output

Functional Requirements

  • FR-1: Retrieve issue comments via gh api repos/{owner}/{repo}/issues/{pr}/comments
  • FR-2: Detect Copilot responses by author and timestamp
  • FR-3: Extract follow-up PR numbers from Copilot's comment body
  • FR-4: Close follow-up PRs with explanatory comment referencing original thread
  • FR-5: Categorize replies (no action / acknowledged / needs discussion)
  • FR-6: Implement polling strategy (60s timeout, 5s interval)
  • FR-7: Ensure idempotency (do not close same PR twice)

Proposed Workflow Addition

Add Phase 4: Copilot Follow-up Handling after the current response phase:

[Is comment from @Copilot?] --No--> End
    |
   Yes
    v
Poll for Copilot's issue comment response
    |
    v
[Response found?] --No (timeout)--> Log warning, End
    |
   Yes
    v
Parse for follow-up PR reference
    |
    v
[Follow-up PR exists?] --No--> End (conversation complete)
    |
   Yes
    v
[Our reply = "no action"?] --No--> Log: manual review needed
    |
   Yes
    v
Close follow-up PR with explanation --> End

Open Questions

  1. Should we auto-merge valid follow-up PRs? (Recommend: No - too risky)
  2. What if Copilot creates multiple follow-up PRs?
  3. Can we programmatically resolve the original review thread?
  4. Should we skip closing PRs that already have reviews?
  5. What is Copilot's exact author identifier? (copilot, github-copilot[bot], or github-actions[bot]?)

Related


🤖 Generated with Claude Code


Migrated from rjmurillo/vs-code-agents#65

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions