Skip to content

Commit 77d6004

Browse files
Address Copilot review round 6: lib syntax + 01 refactor + accurate convergence claim
- _lib.ps1: drop stray extra ) in the gh-auth error message so the 'reported:' block closes cleanly. - 01-request-review.ps1: refactor the two paginated GraphQL calls (state query + reviewRequests page) to use the existing Invoke-GhGraphQL helper from _lib.ps1, matching the 02 refactor in round 4. Removes ~12 lines of duplicated exit-code + errors[] handling. - SKILL.md description: replace 'zero open Copilot threads' with 'zero threads awaiting the agent's reply (remaining open threads are explicit hand-offs to the human merge owner — escalated declines, design tradeoffs)' to match the documented convergence semantics in 09-convergence.md. Also adds the permission qualifier ('full multi-round autopilot needs Triage/Write; external PR authors get single-iteration mode + manual re-trigger') so the description matches the new Prerequisites > Permissions section. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6879024 commit 77d6004

3 files changed

Lines changed: 4 additions & 14 deletions

File tree

skills/copilot-pr-autopilot/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: copilot-pr-autopilot
3-
description: 'Copilot just left 14 review comments on your PR — half are nits. You face hours of fix → reply → resolve → re-request review → repeat, and each re-request lands MORE comments. Up to 10 more rounds before Copilot finally shuts up. You are exhausted. Stop. This skill runs the whole loop for you: auto-triggers Copilot Code Review via GraphQL (no @copilot mention needed), triages every open thread (Copilot, humans, advanced-security) with a fix / decline / escalate rubric, dispatches parallel fix sub-agents that obey the repo build/test/lint conventions, commits one round per iteration, replies+resolves citing the pushed SHA, then re-triggers Copilot until HEAD is reviewed with zero open Copilot threads. You merge a clean PR; the bot ran the marathon. Use when Copilot left comments on your PR and you want them gone without babysitting. Trigger phrases: "address copilot comments", "run a copilot review loop", "fix this PR", "iterate on copilot feedback", "get this PR to green". Repo-agnostic, gh CLI + PowerShell.'
3+
description: 'Copilot just left 14 review comments on your PR — half are nits. You face hours of fix → reply → resolve → re-request review → repeat, and each re-request lands MORE comments. Up to 10 more rounds before Copilot finally shuts up. You are exhausted. Stop. This skill runs the whole loop for you: auto-triggers Copilot Code Review via GraphQL (no @copilot mention needed), triages every open thread (Copilot, humans, advanced-security) with a fix / decline / escalate rubric, dispatches parallel fix sub-agents that obey the repo build/test/lint conventions, commits one round per iteration, replies+resolves citing the pushed SHA, then re-triggers Copilot until HEAD is reviewed with zero threads awaiting the agent''s reply (any remaining open threads are explicit hand-offs to the human merge owner — escalated declines, design tradeoffs). You merge a clean PR; the bot ran the marathon. Use when Copilot left comments on your PR and you want them gone without babysitting. Trigger phrases: "address copilot comments", "run a copilot review loop", "fix this PR", "iterate on copilot feedback", "get this PR to green". Repo-agnostic, gh CLI + PowerShell. Full multi-round autopilot needs repo Triage/Write permission; external PR authors get single-iteration mode plus manual re-trigger (UI 🔄 or substantive-commit push).'
44
---
55

66
# Copilot PR Autopilot

skills/copilot-pr-autopilot/scripts/01-request-review.ps1

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,7 @@ query($o:String!,$r:String!,$n:Int!){
102102
}
103103
}
104104
'@
105-
$r = Invoke-Gh -GhArgs @('api','graphql','-f',"query=$stateQuery",'-f',"o=$Owner",'-f',"r=$Repo",'-F',"n=$PrNumber")
106-
if ($r.ExitCode -ne 0) { throw "state query failed: $($r.Stderr)" }
107-
$stateData = $r.Stdout | ConvertFrom-Json
108-
if ($stateData.errors) {
109-
throw "state query GraphQL errors: $(($stateData.errors | ForEach-Object {$_.message}) -join '; ')"
110-
}
105+
$stateData = Invoke-GhGraphQL -GhArgs @('-f',"query=$stateQuery",'-f',"o=$Owner",'-f',"r=$Repo",'-F',"n=$PrNumber") -Context "state query for $Owner/$Repo PR #$PrNumber"
111106
$pr = $stateData.data.repository.pullRequest
112107
if (-not $pr) { throw "PR #$PrNumber not found in $Owner/$Repo." }
113108
if ($pr.state -ne 'OPEN') {
@@ -143,12 +138,7 @@ query($o:String!,$r:String!,$n:Int!,$after:String!){
143138
}
144139
}
145140
'@
146-
$r = Invoke-Gh -GhArgs @('api','graphql','-f',"query=$pageQuery",'-f',"o=$Owner",'-f',"r=$Repo",'-F',"n=$PrNumber",'-f',"after=$after")
147-
if ($r.ExitCode -ne 0) { throw "reviewRequests page query failed: $($r.Stderr)" }
148-
$pageData = $r.Stdout | ConvertFrom-Json
149-
if ($pageData.errors) {
150-
throw "reviewRequests page query GraphQL errors: $(($pageData.errors | ForEach-Object {$_.message}) -join '; ')"
151-
}
141+
$pageData = Invoke-GhGraphQL -GhArgs @('-f',"query=$pageQuery",'-f',"o=$Owner",'-f',"r=$Repo",'-F',"n=$PrNumber",'-f',"after=$after") -Context "reviewRequests page query for $Owner/$Repo PR #$PrNumber"
152142
$page = $pageData.data.repository.pullRequest.reviewRequests
153143
$reviewRequests += @($page.nodes)
154144
$pr.reviewRequests.pageInfo = $page.pageInfo

skills/copilot-pr-autopilot/scripts/_lib.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Run:
5151
gh auth login
5252
5353
Then re-run this command. (``gh auth status`` reported:
54-
$($err.Trim()))
54+
$($err.Trim())
5555
"@
5656
}
5757
} finally {

0 commit comments

Comments
 (0)