Commit 541a7a3
Replace PR agent with pr-review skill and decouple comment posting (dotnet#34460)
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
## 🏗️ Overview
This PR replaces the **monolithic PR agent** with a modular, skill-based
**PR review orchestrator**. The legacy 2-file agent is decomposed into 4
dedicated phase skills, each with clear boundaries, inputs, and outputs.
> **TL;DR** — One big agent file → four focused skills. Cleaner,
composable, easier to maintain.
---
## 🔀 Before → After
```
┌─────────────────────────────────┐ ┌─────────────────────────────────────────────┐
│ BEFORE (Agent) │ │ AFTER (Skills) │
├─────────────────────────────────┤ ├─────────────────────────────────────────────┤
│ │ │ │
│ agents/pr.md (310 lines) │ │ skills/pr-review/SKILL.md (orchestrator) │
│ + │ ──► │ ├─ skills/pr-preflight/SKILL.md │
│ agents/pr/post-gate.md (331) │ │ ├─ skills/pr-gate/SKILL.md │
│ agents/pr/SHARED-RULES.md │ │ ├─ try-fix (existing skill) │
│ agents/pr/PLAN-TEMPLATE.md │ │ └─ skills/pr-report/SKILL.md │
│ │ │ │
│ 5 comment scripts │ │ 2-section unified comment │
│ │ │ │
└─────────────────────────────────┘ └─────────────────────────────────────────────┘
```
---
## ✨ Key Changes
### 1️⃣ Agent → Skill Architecture
| Phase | Skill | Responsibility |
|:-----:|:------|:---------------|
| **0** | `pr-review` | 🎯 Master orchestrator — sets up branch, invokes
phases |
| **1** | `pr-preflight` | 📋 Context gathering — reads issue, PR,
comments, classifies files |
| **2** | `pr-gate` | 🚦 Test verification — tests must FAIL without fix,
PASS with fix |
| **3** | `try-fix` _(existing)_ | 🔧 Multi-model fix exploration (Sonnet
→ Opus) |
| **4** | `pr-report` | 📊 Final recommendation — APPROVE or REQUEST
CHANGES |
### 2️⃣ Decoupled Comment Posting
`pr-review` produces **output files only**
(`CustomAgentLogsTmp/PRState/`). Comments are posted separately via
`ai-summary-comment` — no tight coupling.
### 3️⃣ Unified Comment Model
Consolidated from **5 separate comment scripts** → **2 sections** in a
single unified comment:
| ❌ Removed Script | ✅ Now Part Of |
|:-----------------|:--------------|
| `post-try-fix-comment.ps1` | PR-REVIEW section |
| `post-verify-tests-comment.ps1` | PR-REVIEW section |
| `post-write-tests-comment.ps1` | PR-REVIEW section |
`post-pr-finalize-comment.ps1` now injects into the unified comment by
default (use `-Standalone` for legacy behavior).
### 4️⃣ Simplified CI & Orchestration
**`Review-PR.ps1`** went from complex 3-phase script → clean 4-step
orchestrator:
```
Step 1 → pr-review skill (all 4 phases)
Step 2 → pr-finalize skill (verify title/description)
Step 3 → ai-summary-comment (post unified comment)
Step 4 → Update-AgentLabels (apply labels)
```
**`ci-copilot.yml`** — removed explicit `-RunFinalize
-PostSummaryComment` flags (all phases run automatically).
---
## 📁 Files Changed
<details>
<summary><b>✅ Added (4 files)</b></summary>
| File | Purpose |
|:-----|:--------|
| `.github/skills/pr-review/SKILL.md` | Master orchestrator (Phase 0–4)
|
| `.github/skills/pr-preflight/SKILL.md` | Phase 1: Context gathering |
| `.github/skills/pr-gate/SKILL.md` | Phase 2: Test verification gate |
| `.github/skills/pr-report/SKILL.md` | Phase 4: Final recommendation |
</details>
<details>
<summary><b>❌ Deleted (7 files)</b></summary>
| File | Reason |
|:-----|:-------|
| `.github/agents/pr.md` | Replaced by `pr-review` skill |
| `.github/agents/pr/PLAN-TEMPLATE.md` | Skills use direct output files
|
| `.github/agents/pr/SHARED-RULES.md` | Rules distributed to phase
skills |
| `.github/agents/pr/post-gate.md` | Replaced by `pr-gate` + `pr-report`
|
| `post-try-fix-comment.ps1` | Merged into unified PR-REVIEW comment |
| `post-verify-tests-comment.ps1` | Merged into unified PR-REVIEW
comment |
| `post-write-tests-comment.ps1` | Not part of main review workflow |
</details>
<details>
<summary><b>🔧 Modified (14 files)</b></summary>
| File | Change |
|:-----|:-------|
| `.github/scripts/Review-PR.ps1` | Major refactor → 4-step skill
orchestration |
| `.github/skills/ai-summary-comment/SKILL.md` | Simplified to 2-section
model |
| `.github/skills/ai-summary-comment/.../post-ai-summary-comment.ps1` |
Updated for unified comment |
| `.github/skills/ai-summary-comment/.../post-pr-finalize-comment.ps1` |
Injects into unified comment |
| `.github/copilot-instructions.md` | Replaced agent entry with skill
entries |
| `.github/README-AI.md` | Updated architecture docs |
| `.github/docs/agent-labels.md` | Terminology: "Gate" → "Validate" |
| `.github/scripts/shared/Update-AgentLabels.ps1` | Updated for phase
structure |
| `.github/scripts/shared/Start-Emulator.ps1` | Minor utility updates |
| `.github/skills/pr-finalize/SKILL.md` | Minor context update |
| `.github/skills/verify-tests-fail-without-fix/SKILL.md` | Minor
context update |
| `.github/skills/ai-summary-comment/NO-EXTERNAL-REFERENCES-RULE.md` |
Updated for 2-section model |
| `.github/instructions/sandbox.instructions.md` | Updated references |
| `eng/pipelines/ci-copilot.yml` | Simplified invocation |
</details>
---
## 📊 Impact
```
25 files changed
843 insertions(+)
3,271 deletions(-)
```
Net reduction of **~2,400 lines** — less code, better structure. 🎉
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>1 parent e2f570f commit 541a7a3
File tree
30 files changed
+1293
-5150
lines changed- .github
- agents
- pr
- docs
- instructions
- pr-review
- scripts
- skills
- ai-summary-comment
- scripts
- pr-finalize
- pr-review
- try-fix
- verify-tests-fail-without-fix
- eng/pipelines
- common
30 files changed
+1293
-5150
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
212 | | - | |
213 | | - | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
| 257 | + | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
368 | | - | |
| 367 | + | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
0 commit comments