|
| 1 | +--- |
| 2 | +agent: feature-orchestrator |
| 3 | +description: "Review a PR and post feedback for Copilot coding agent to iterate on" |
| 4 | +--- |
| 5 | + |
| 6 | +# PR Iteration |
| 7 | + |
| 8 | +## Your Task |
| 9 | + |
| 10 | +Help the developer review and iterate on an agent-created pull request. |
| 11 | +The user will provide the feature name, repo, and PR number below. |
| 12 | + |
| 13 | +**Step 0**: Load feature context for deeper understanding: |
| 14 | +```powershell |
| 15 | +node .github/hooks/state-utils.js get-feature "<feature name>" |
| 16 | +``` |
| 17 | +This returns the feature state including: |
| 18 | +- **Design spec path** (`artifacts.design.docPath`) — read this file to understand the intended design |
| 19 | +- **PBI details** (`artifacts.pbis`) — understand what this PR is supposed to implement |
| 20 | +- **Other PRs** (`artifacts.agentPrs`) — related work in the feature |
| 21 | + |
| 22 | +**Read the design spec** from the `docPath` to understand the architectural decisions, |
| 23 | +requirements, and intended approach. This context is essential for evaluating whether |
| 24 | +the PR correctly implements the design and for proposing informed resolutions to comments. |
| 25 | + |
| 26 | +**Step 1**: Fetch the PR details, diff, and **all review comments**: |
| 27 | +```powershell |
| 28 | +gh pr view <prNumber> --repo "<full-repo-slug>" --json title,body,state,additions,deletions,changedFiles,url |
| 29 | +gh pr diff <prNumber> --repo "<full-repo-slug>" | head -200 |
| 30 | +``` |
| 31 | + |
| 32 | +Then fetch **all review comments and conversation threads**: |
| 33 | +```powershell |
| 34 | +gh api "/repos/<owner>/<repo>/pulls/<prNumber>/comments" --jq '.[] | {path: .path, line: .line, body: .body, user: .user.login, created_at: .created_at}' 2>&1 |
| 35 | +gh api "/repos/<owner>/<repo>/issues/<prNumber>/comments" --jq '.[] | {body: .body, user: .user.login, created_at: .created_at}' 2>&1 |
| 36 | +gh pr view <prNumber> --repo "<full-repo-slug>" --json reviews --jq '.reviews[] | {state: .state, body: .body, author: .author.login}' |
| 37 | +``` |
| 38 | + |
| 39 | +This gives you: |
| 40 | +- **Inline review comments** (file-specific feedback from reviewers) |
| 41 | +- **General PR comments** (conversation thread) |
| 42 | +- **Review decisions** (approved, changes requested, commented) |
| 43 | + |
| 44 | +Repo slug mapping: |
| 45 | +- `common` → `AzureAD/microsoft-authentication-library-common-for-android` |
| 46 | +- `msal` → `AzureAD/microsoft-authentication-library-for-android` |
| 47 | +- `broker` → `identity-authnz-teams/ad-accounts-for-android` |
| 48 | +- `adal` → `AzureAD/azure-activedirectory-library-for-android` |
| 49 | + |
| 50 | +Discover the GitHub username from `.github/developer-local.json`, or `gh auth status`. |
| 51 | +Switch account before any gh commands: `gh auth switch --user <username>` |
| 52 | + |
| 53 | +**Step 2**: Ask the developer how they want to handle the review feedback: |
| 54 | + |
| 55 | +``` |
| 56 | +askQuestion({ |
| 57 | + question: "How would you like to handle the review feedback on this PR?", |
| 58 | + options: [ |
| 59 | + { label: "🤖 Delegate to Copilot", description: "Tag @copilot to address all review comments automatically" }, |
| 60 | + { label: "📋 Show me the analysis first", description: "Present review feedback with proposed resolutions, then decide", recommended: true }, |
| 61 | + { label: "✅ Looks good — approve", description: "Approve the PR as-is" } |
| 62 | + ] |
| 63 | +}) |
| 64 | +``` |
| 65 | + |
| 66 | +### If "Delegate to Copilot": |
| 67 | + |
| 68 | +Compose a single comprehensive `@copilot` comment that summarizes ALL reviewer feedback |
| 69 | +and post it on the PR: |
| 70 | +```powershell |
| 71 | +gh pr comment <prNumber> --repo "<slug>" --body "@copilot Please address the following review feedback: |
| 72 | +
|
| 73 | +1. [summary of comment 1 with file/line reference] |
| 74 | +2. [summary of comment 2 with file/line reference] |
| 75 | +... |
| 76 | +
|
| 77 | +Please fix all of the above and push updated commits." |
| 78 | +``` |
| 79 | + |
| 80 | +Confirm the comment was posted and that the coding agent will pick it up. |
| 81 | + |
| 82 | +### If "Show me the analysis first": |
| 83 | + |
| 84 | +Analyze the PR and present a comprehensive review summary: |
| 85 | + |
| 86 | +**For each reviewer comment:** |
| 87 | +1. Show the comment (who said what, on which file/line) |
| 88 | +2. **Propose a resolution** — analyze the code and suggest what should change |
| 89 | +3. If a code change is needed, show a concrete code snippet or approach |
| 90 | +4. If the comment is a question, provide a clear answer based on codebase context |
| 91 | + |
| 92 | +Present as: |
| 93 | +``` |
| 94 | +### Reviewer Feedback & Proposed Resolutions |
| 95 | +
|
| 96 | +**Comment 1** — @reviewer on `src/MyFile.java:42` |
| 97 | +> "This should handle null case" |
| 98 | +**Resolution**: Add a null check before accessing the field. Proposed change: |
| 99 | +`if (value != null) { ... }` |
| 100 | +
|
| 101 | +**Comment 2** — @reviewer (general) |
| 102 | +> "Missing unit tests for the retry logic" |
| 103 | +**Resolution**: Add tests for success, failure, and max-retry scenarios in `IpcRetryTest.java`. |
| 104 | +``` |
| 105 | + |
| 106 | +Also include: |
| 107 | +- Overall PR summary (title, +/- lines, changed files) |
| 108 | +- Any patterns or systemic issues across the comments |
| 109 | +- Your recommendation |
| 110 | + |
| 111 | +Then ask what to do next: |
| 112 | +``` |
| 113 | +askQuestion({ |
| 114 | + question: "How would you like to proceed?", |
| 115 | + options: [ |
| 116 | + { label: "🤖 Delegate to Copilot agent", description: "Post @copilot comment with all the feedback to fix remotely" }, |
| 117 | + { label: "💻 Implement locally", description: "Checkout the branch and make changes in VS Code" }, |
| 118 | + { label: "✏️ I'll write custom feedback", description: "Let me type exactly what to tell the agent" } |
| 119 | + ] |
| 120 | +}) |
| 121 | +``` |
| 122 | + |
| 123 | +**If "Delegate to Copilot agent"**: Post the structured feedback as an `@copilot` comment (same as above). |
| 124 | + |
| 125 | +**If "Implement locally"**: Checkout the PR branch in the correct repo directory: |
| 126 | +```powershell |
| 127 | +gh pr checkout <prNumber> --repo "<full-repo-slug>" |
| 128 | +``` |
| 129 | +Run this in the correct sub-repo directory (common/, msal/, broker/, adal/). |
| 130 | +Then tell the developer: "Branch checked out. Make your changes, commit, and push." |
| 131 | + |
| 132 | +**If "I'll write custom feedback"**: Ask the developer to type their feedback, then post it |
| 133 | +as an `@copilot` comment on the PR. |
| 134 | + |
| 135 | +### If "Approve": |
| 136 | + |
| 137 | +```powershell |
| 138 | +gh pr review <prNumber> --repo "<slug>" --approve |
| 139 | +``` |
| 140 | + |
| 141 | +Confirm the approval. |
| 142 | + |
| 143 | +## Final Step |
| 144 | + |
| 145 | +After any action, confirm what was done and suggest: |
| 146 | +"Use the feature detail panel's ↻ Refresh button to update PR status." |
0 commit comments