Skip to content

Commit 5b597e9

Browse files
authored
PR Reviewer Agent (#32340)
* PR Reviewer Agent * - additional custom agent updates * update instrumentation documentation * fix * Address Copilot PR review comments - Remove broken link to RTL-Testing-Guide.md (file doesn't exist) - Update instrumentation guide example to use Task.Delay instead of Dispatcher.DispatchDelayed for better clarity Addresses: #32340 (comment) Addresses: #32340 (comment) * Add security checklist and expand PR splitting guidance - Add dedicated Security section to code review checklist covering: - Hardcoded secrets detection - External endpoint usage in tests - Input validation - Secure data handling - Dependency security - Platform permissions - Expand PR splitting guidance with specific scenarios: - Separate refactoring from bug fixes - Split unrelated documentation updates - Separate new features from fixes - Split multi-platform changes - Break up large API additions Addresses: #32340 (comment) Addresses: #32340 (comment) * Improve pr-reviewer agent: make thorough testing the default - Change default mode from Quick (code-only) to Thorough (with testing) - Expand trigger words to include 'thorough', 'validation', 'review', 'check' - Add 'Core Philosophy' section emphasizing hands-on testing over code review - Add 'Edge Case Discovery' section with comprehensive test scenarios - Add explicit 'Default Mode Selection Logic' decision tree - Update mode examples to show reasoning for mode selection - Mark Quick Mode as 'NOT RECOMMENDED' and requiring explicit user request - Add warnings in output format section about default behavior Fixes issue where 'thorough review and validation' incorrectly triggered Quick Mode instead of Thorough Mode with actual device testing. * Add build error handling guidelines to PR reviewer agent - Add new 'Handling Build Errors' section after 'Build and Deploy' - Update Thorough Mode to reference build error handling (step 5) - Add explicit instructions to STOP and ask for help after 1-2 failed fix attempts - Provide template message for reporting build errors to user - Add 'What NOT to do' list to prevent silent mode switching - Clarify that incomplete testing means incomplete review * Fix inconsistencies in PR reviewer prompt guide - Update Quick Mode examples to require explicit 'quick' keyword - Add 'Please review PR #XXXXX' to Thorough Mode (it's the default) - Add 'Important: Default Behavior' section explaining mode selection - Add 'What Happens If Build Fails?' section documenting error handling - Mark Quick Mode as NOT RECOMMENDED to align with agent instructions - Clarify that simple 'review this PR' defaults to Thorough Mode (with testing) This ensures the prompt guide is consistent with the agent instructions where Thorough Mode (with testing) is the default for all PR reviews. * - updates with safe area guidance * Update PR reviewer agent instructions * Clarify Sandbox vs HostApp usage for PR validation - Add clear section explaining when to use each app - Sandbox app: For PR validation and testing (99% of reviews) - TestCases.HostApp: Only for writing/validating UI tests (1%, explicit request only) - Emphasize Sandbox builds in ~2min vs HostApp ~20min - Add decision tree and examples to prevent confusion - Update Core Philosophy and Thorough Mode sections to reinforce this * - add instructions for git * - simplify instructions * - update instructions * - make updates about time constraints
1 parent a494f6a commit 5b597e9

File tree

7 files changed

+2517
-0
lines changed

7 files changed

+2517
-0
lines changed

.github/README.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# .github Folder - AI Coding Assistant Instructions
2+
3+
This folder contains instructions and configurations for AI coding assistants working on the .NET MAUI repository.
4+
5+
## Quick Start: Using the PR Reviewer Agent
6+
7+
The PR reviewer agent conducts thorough, constructive code reviews of .NET MAUI pull requests with hands-on testing and validation.
8+
9+
### How to Use
10+
11+
```bash
12+
# Start GitHub Copilot CLI with agent support
13+
copilot --allow-all-tools --allow-all-paths
14+
15+
# Invoke the pr-reviewer agent
16+
/agent pr-reviewer
17+
18+
# Request a review
19+
please review <link to PR>
20+
```
21+
22+
### Example
23+
24+
```bash
25+
copilot --allow-all-tools --allow-all-paths
26+
/agent pr-reviewer
27+
please review https://github.com/dotnet/maui/pull/32372
28+
```
29+
30+
## What the Agent Does
31+
32+
Every PR review includes:
33+
34+
1. **Code Analysis** - Reviews code for correctness, style, and best practices
35+
2. **Build & Deploy** - Builds the Sandbox app and deploys to simulator/emulator
36+
3. **Real Testing** - Tests PR changes on actual devices with measurements
37+
4. **Before/After Comparison** - Compares behavior with and without PR changes
38+
5. **Edge Case Testing** - Tests scenarios not mentioned by the PR author
39+
6. **Documented Results** - Provides review with actual test data and evidence
40+
41+
The agent will pause and ask for help if it encounters:
42+
- Merge conflicts when applying PR changes
43+
- Build errors that prevent testing
44+
- Test results that are unexpected or confusing
45+
- Any step that prevents thorough validation
46+
47+
## Important Notes
48+
49+
⚠️ **We're still refining the agent instructions** to ensure it consistently follows the testing workflow.
50+
51+
**The agent will pause and ask for help if:**
52+
- Merge conflicts occur when applying PR changes
53+
- Build errors prevent testing
54+
- Test results are unexpected or confusing
55+
- Any step fails that prevents thorough validation
56+
57+
This is by design - it's better to pause and get guidance than provide incomplete or misleading reviews.
58+
59+
## File Structure
60+
61+
### Agent Definitions
62+
- **`agents/pr-reviewer.md`** - Main PR reviewer agent instructions and workflows
63+
64+
### Instruction Files
65+
These files provide specialized guidance for specific scenarios:
66+
67+
- **`instructions/uitests.instructions.md`** - UI testing guidelines (when to use HostApp vs Sandbox)
68+
- **`instructions/safearea-testing.instructions.md`** - SafeArea testing patterns (measure children, not parents)
69+
- **`instructions/instrumentation.instructions.md`** - Code instrumentation patterns for debugging and testing
70+
- **`instructions/templates.instructions.md`** - Template modification rules and conventions
71+
72+
### General Guidelines
73+
- **`copilot-instructions.md`** - General coding standards, build requirements, file conventions for the entire repository
74+
75+
### Prompts
76+
- **`prompts/pr-reviewer.prompt.md`** - Ready-to-use prompt templates for PR reviews
77+
78+
## For GitHub Copilot (General Development)
79+
80+
When working on code in this repository, GitHub Copilot automatically uses:
81+
- `.github/copilot-instructions.md` - General coding standards
82+
- `.github/instructions/*.instructions.md` - Specialized instructions based on file patterns
83+
84+
See `.github/copilot-instructions.md` for comprehensive development guidelines including:
85+
- Repository structure and setup
86+
- Build and test workflows
87+
- Platform-specific development
88+
- Contribution guidelines
89+
90+
## Instruction Precedence
91+
92+
When multiple instruction files exist, follow this priority order:
93+
94+
1. **Highest Priority**: Agent-specific instructions (`.github/agents/*.md`)
95+
2. **Secondary**: Specialized instructions (`.github/instructions/*.instructions.md`)
96+
3. **General Guidance**: `.github/copilot-instructions.md`
97+
98+
If instructions conflict, higher priority files win.
99+
100+
## Contributing to Instructions
101+
102+
When updating agent instructions or guidelines:
103+
104+
1. **Keep them synchronized**: Changes to agent instructions may need corresponding updates to general instructions
105+
2. **Test the changes**: Verify the agent/assistant behaves as expected
106+
3. **Document your changes**: Update this README if you add new instruction files
107+
4. **Be specific**: Clear, actionable instructions work better than vague guidance
108+
109+
## Related Documentation
110+
111+
- **Repository root**: `AGENTS.md` - Universal guidance for all AI coding assistants
112+
- **Development**: `DEVELOPMENT.md` - Development environment setup
113+
- **Contributing**: `CONTRIBUTING.md` - Contribution guidelines
114+
- **Wiki**: [.NET MAUI GitHub Wiki](https://github.com/dotnet/maui/wiki) - Additional resources
115+
116+
## Troubleshooting
117+
118+
### GitHub Copilot CLI Issues
119+
120+
**If you have errors with the CLI working or authentication issues:**
121+
122+
Follow these steps to reset your authentication:
123+
124+
```bash
125+
# Start Copilot CLI
126+
copilot
127+
128+
# Logout from current session
129+
/logout
130+
131+
# Exit Copilot CLI
132+
exit
133+
134+
# Re-authenticate with GitHub
135+
gh auth login
136+
137+
# Start Copilot CLI again
138+
copilot
139+
```
140+
141+
This will refresh your GitHub authentication and resolve most CLI-related issues.
142+
143+
### Agent Issues
144+
145+
**Agent doesn't complete testing:**
146+
- Check the agent's output for error messages
147+
- The agent should pause and ask for help if it encounters issues
148+
- If it silently stops, let us know so we can improve the instructions
149+
150+
**Build or test failures:**
151+
- The agent is designed to pause and ask for help rather than proceeding
152+
- Work with the agent to resolve the issue before continuing the review
153+
- This ensures reviews are based on actual working code
154+
155+
## Support
156+
157+
For issues or questions about the AI agent instructions:
158+
1. Check this README and referenced instruction files
159+
2. Review recent PR reviews to see examples
160+
3. Ask in the repository discussions or issues
161+
4. Propose changes via PR to improve the instructions
162+
163+
---
164+
165+
**Last Updated**: 2025-11-06
166+
167+
**Note**: These instructions are actively being refined. Feedback and improvements are welcome!

0 commit comments

Comments
 (0)