Skip to content

Update duplicate code workflow to target copilot SWE agent#1338

Merged
pelikhan merged 2 commits intomainfrom
copilot/update-duplicate-code-workflow
Oct 7, 2025
Merged

Update duplicate code workflow to target copilot SWE agent#1338
pelikhan merged 2 commits intomainfrom
copilot/update-duplicate-code-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 7, 2025

Overview

Updated the duplicate code detection workflow prompt to be specifically targeted at GitHub Copilot as an SWE agent. The changes transform the workflow from a conversational "you are an agent" style to a professional, task-oriented format that provides clear, actionable instructions suitable for automated remediation.

Key Changes

1. Professional Tone and Structure

Transformed the workflow from conversational to direct, imperative language:

Before:

# Duplicate Code Detection Agent

You are a code quality agent that analyzes commits to detect duplicated code patterns...

## Mission

When commits are pushed to the main branch, you must:
1. **Analyze Recent Commits**: Review the changes...

After:

# Duplicate Code Detection

Analyze code to identify duplicated patterns using Serena's semantic code analysis capabilities. Report significant findings that require refactoring.

## Task

Detect and report code duplication by:
1. **Analyzing Recent Commits**: Review changes in the latest commits
2. **Detecting Duplicated Code**: Identify similar or duplicated code patterns using semantic analysis
3. **Reporting Findings**: Create a detailed issue if significant duplication is detected (threshold: >10 lines or 3+ similar patterns)

2. Copilot Assignment

Added automatic assignment to @copilot in the issue template and guidelines:

**Assignee**: @copilot

## Summary
[Brief overview of duplication findings]

And in the operational guidelines:

### Issue Creation
- Assign issue to @copilot for automated remediation

This ensures created issues are automatically assigned to the copilot agent for potential automated fixes.

3. Enhanced Implementation Checklist

Improved the issue template checklist from generic "Next Steps" to a comprehensive "Implementation Checklist" with SWE-specific tasks:

## Implementation Checklist

- [ ] Review duplication findings
- [ ] Prioritize refactoring tasks
- [ ] Create refactoring plan
- [ ] Implement changes
- [ ] Update tests
- [ ] Verify no functionality broken

4. Refined Section Headers

Reorganized headers to be more action-oriented and professional:

  • MissionTask
  • Current ContextContext
  • Analysis ProcessAnalysis Workflow
  • Detection GuidelinesDetection Scope
  • Important NotesOperational Guidelines
  • Tool Usage StrategyTool Usage Sequence

5. SWE-Specific Language

Updated terminology throughout to target SWE agents:

  • Changed "developers" to "SWE agents" where appropriate
  • Updated final objective from "Remember: Your goal is to improve..." to professional "Objective: Improve code quality by identifying and reporting meaningful code duplication..."
  • Added emphasis on enabling "automated or manual refactoring"

Testing

  • ✅ Workflow compiles successfully
  • ✅ All unit tests pass (59 workflows compile)
  • ✅ Code review found no issues
  • ✅ Generated .lock.yml contains updated prompt with @copilot assignment

Impact

This change makes the duplicate code detection workflow more suitable for GitHub Copilot as an automated SWE agent, with clear instructions for creating issues that can be automatically remediated by assigning them to @copilot. The professional tone and structured format align with how SWE agents process and act on instructions.

Original prompt

Update the duplicate code detection workflow prompt such that it generates an issue that will be assigned to github copilot agent. The tone and information should be reasonably and targeted at an SWE agent specifically, like copilot.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update duplicate code detection workflow for Copilot agent Update duplicate code workflow to target copilot SWE agent Oct 7, 2025
Copilot AI requested a review from pelikhan October 7, 2025 23:27
@pelikhan pelikhan marked this pull request as ready for review October 7, 2025 23:28
@pelikhan pelikhan merged commit dd31b71 into main Oct 7, 2025
1 check passed
@pelikhan pelikhan deleted the copilot/update-duplicate-code-workflow branch October 7, 2025 23:28
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