Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions .squad/skills/copilot-pr-review-workflow/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
name: "copilot-pr-review-workflow"
description: "Complete pipeline for handling Copilot PR reviewer bot comments ΓÇö from reading reviews to resolving threads"
domain: "pr-review"
Comment on lines +2 to +4

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

The file contains mojibake characters (e.g., "ΓÇö") in the YAML frontmatter description, which indicates an encoding/charset issue and will render incorrectly in docs. Replace these with the intended characters (e.g., an em dash "—") and ensure the file is saved as UTF-8.

Copilot uses AI. Check for mistakes.
confidence: "medium"
source: "earned"
tools:
- name: "pull_request_read"
description: "GitHub MCP tool to read PR review comments"
when: "Reading Copilot review threads with get_review_comments method"
- name: "gh api graphql"
Comment on lines +7 to +11

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

The MCP tool name and invocation format here don’t match the established convention used in the existing PR review skills (e.g., .squad/skills/pr-review-response/SKILL.md uses github-mcp-server-pull_request_read with a YAML-style argument block). If agents copy/paste pull_request_read(...) it may not work in this repo’s tool environment; consider aligning the tool name and example call format with the existing skill to avoid broken instructions.

Copilot uses AI. Check for mistakes.
description: "GitHub CLI GraphQL API for thread resolution"
when: "Querying and resolving review threads after fixes are pushed"
---

## Context

When Copilot reviewer bot leaves comments on a PR, agents need a structured workflow to triage, fix, and resolve those comments. This skill covers the full pipeline ΓÇö reading reviews, evaluating comments critically, routing fixes to the correct agent (lockout rules), resolving threads via GraphQL, and verifying CI. Confirmed across PRs #756, #760, #762 in a single session.

## Scope

✅ THIS SKILL PRODUCES:
- A decision on which comments to fix vs push back on
- Correctly routed fix assignments (respecting lockout)
- Resolved review threads after verified fixes
- Green CI confirmation

❌ THIS SKILL DOES NOT PRODUCE:
- New tests (unless a comment specifically requests one)
- Refactors beyond what the comment identifies
- Changes to `.squad/` files (keep PR hygiene separate)
Comment on lines +20 to +31

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

More mojibake characters appear in the section headers (e.g., "Γ£à", "Γ¥î") where this likely intended to be "✅" / "❌" markers. This will render as garbage text; replace with the intended symbols (or ASCII equivalents like "+"/"-") and ensure UTF-8 encoding.

Copilot uses AI. Check for mistakes.

## Patterns

### 1. Reading Copilot Reviews

Use GitHub MCP `pull_request_read` with `get_review_comments` method to fetch all review threads:

```
pull_request_read(method: "get_review_comments", owner: "{owner}", repo: "{repo}", pullNumber: {N})
```

Or use `gh api graphql` for richer data (includes resolution state):

```
gh api graphql -f query='query {
repository(owner: "{owner}", name: "{repo}") {
pullRequest(number: {N}) {
reviewThreads(first: 50) {
nodes {
id
isResolved
isOutdated
comments(first: 10) {
nodes { body path line }
}
}
}
}
}
}'
```

### 2. Evaluating Comments Critically

Do NOT rubber-stamp every suggestion. Assess each comment on its merit:

| Category | Action | Example |
|---|---|---|
| **Factual error** | Always fix | Wrong filename referenced, incorrect API endpoint |
| **Missing edge case** | Usually fix | Null/undefined guard, empty-string check |
| **Style / opinion** | Evaluate context | Naming preference, code organization suggestion |
| **Over-engineering** | Push back | Adding abstraction layers for single-use code |

**Session evidence:** All 3 comments on #756 were valid (subpath regex gap, wrong filename, misleading text). All 6 on #760/#762 were valid (path safety, breaking type change, misleading warning messages).

### 3. Lockout Enforcement on Fixes

**The original PR author CANNOT fix Copilot review comments on their own PR.** Per the reviewer rejection lockout rules in squad.agent.md, route to a DIFFERENT agent.

Session examples:
- PR #760: **Network** authored → **FIDO** fixed Copilot comments
- PR #762: **EECOM** authored → **CONTROL** fixed Copilot comments
Comment on lines +81 to +83

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

The session example lines contain mojibake ("ΓåÆ") where an arrow ("→") is likely intended. Since this skill is meant to be copy/paste friendly, it’s worth fixing all such occurrences to avoid confusing or broken rendering.

Copilot uses AI. Check for mistakes.

The coordinator must track who authored the PR and assign the fix to someone else.

### 4. Resolving Threads After Fix

After the fix is pushed and CI is green, resolve each thread via GraphQL.

**Step 1 ΓÇö Query unresolved threads:**

```bash
gh api graphql -f query='query {
repository(owner: "{owner}", name: "{repo}") {
pullRequest(number: {N}) {
reviewThreads(first: 50) {
nodes { id isResolved }
}
}
}
}'
```

**Step 2 ΓÇö Resolve each unresolved thread:**

```bash
gh api graphql -f query='mutation {
resolveReviewThread(input: {threadId: "{id}"}) {
thread { isResolved }
}
}'
```

### 5. Verifying CI After Fixes

Always confirm CI stays green after pushing review fixes:

```bash
gh pr checks {N} --repo {owner}/{repo}
```

Do not resolve threads until CI passes. A fix that breaks the build is worse than the original comment.

### 6. Common Copilot Reviewer Patterns

What Copilot reviewer catches well ΓÇö expect these categories:

- **Missing edge cases** in input validation (null/undefined guards)
- **Breaking type changes** in public APIs (required → optional field)
- **Misleading error messages** that suggest wrong remediation steps
- **Regex patterns** too narrow for their stated intent
- **Encoding issues** (mojibake in generated content)
- **Pagination limits** in API calls (hardcoded page sizes)

### 7. PR Hygiene Checks (Before Copilot Reviews)

Run these checks BEFORE submitting for review to reduce noise:

- No `.squad/` files in the diff

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

This checklist item is written as an absolute ("No .squad/ files in the diff"), but this repo does have legitimate PRs that intentionally change .squad/ (like this one). Consider rewording to something like “No unrelated .squad/ changes” or “Avoid mixing .squad/ changes with product code” to keep the guidance accurate.

Suggested change
- No `.squad/` files in the diff
- No unrelated `.squad/` changes in the diff

Copilot uses AI. Check for mistakes.
- No branch stacking (PR only contains its own commits)
- Changeset present if CLI/SDK source changed
- File count matches intent (Γëñ10 for most fixes)

## Agent Workflow

1. **READ** ΓÇö Fetch review threads using `pull_request_read` or GraphQL
2. **TRIAGE** ΓÇö Categorize each comment (factual error / edge case / style / over-engineering)
Comment on lines +141 to +148

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

The file includes additional mojibake in numeric/comparison text (e.g., "Γëñ10") and several em-dash occurrences ("ΓÇö"). These should be replaced with the intended symbols (e.g., "≤10" and "—") and the file should be normalized to UTF-8 so future edits don’t reintroduce encoding corruption.

Copilot uses AI. Check for mistakes.
3. **DECIDE** ΓÇö Accept valid comments, push back on over-engineering with rationale
4. **ROUTE** ΓÇö Identify PR author; assign fix to a DIFFERENT agent (lockout rule)
5. **FIX** ΓÇö Fixing agent addresses accepted comments in a single commit
6. **VERIFY** ΓÇö Run `gh pr checks` to confirm CI is green
7. **RESOLVE** ΓÇö Use GraphQL mutations to resolve each addressed thread
8. **STOP** ΓÇö Do not add scope beyond what the comments requested

## Anti-Patterns

- ❌ **Don't auto-accept all suggestions** — evaluate each comment on merit. Copilot can over-engineer or suggest unnecessary abstractions.
- ❌ **Don't let the original author fix their own PR's review comments** — this violates reviewer rejection lockout rules. Always route to a different agent.
- ❌ **Don't resolve threads before the fix is pushed** — resolve only after the fix commit lands AND CI passes.
- ❌ **Don't batch .squad cleanup with other PR work** — this causes data loss. Learned the hard way this session. Keep `.squad/` changes in separate commits or PRs.
- ❌ **Don't resolve threads without verifying CI** — a fix that breaks the build is worse than the original review comment.
- ❌ **Don't skip the triage step** — blindly fixing everything wastes time and can introduce unnecessary complexity.
Loading