{"id":"94c30451-672c-43f6-994c-0f1e4f6efaf2","slug":"copilot-pr-autopilot","kind":"skill","name":"copilot-pr-autopilot","summary":"Copilot left 14 review comments on your PR — half are nits. Hours of fix → reply → resolve → re-request, and each round lands MORE comments. This skill runs loop engineering: auto-triggers Copilot Cod","owner":"github","repoUrl":"https://github.com/github/awesome-copilot/tree/HEAD/skills/copilot-pr-autopilot","license":"MIT","licenseTier":"permissive","trust":"official","stars":39994,"match":null,"fewStars":false,"format":"skill","createdAt":null,"addedAt":"2026-10-14T05:10:44.361Z","logoUrl":"https://avatars.githubusercontent.com/u/9919?v=4","linkOnly":false,"collection":{"name":"awesome-copilot","repo":"github/awesome-copilot"},"skillPath":"skills/copilot-pr-autopilot","categories":["developer-tools","design-media"],"tags":["ai","github-copilot","prompt-engineering","hacktoberfest","agents","awesome","custom-agents"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-14T05:10:44.359Z","sample":false,"url":"https://conduits.dev/tools/copilot-pr-autopilot","language":"JavaScript","transports":[],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"> Copilot left 14 review comments on your PR — half are nits. Hours of fix → reply → resolve → re-request, and each round lands MORE comments. This skill runs loop engineering: auto-triggers Copilot Code Review via GraphQL (no @copilot mention), 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 per iteration, replies+resolves citing the pushed SHA, then re-triggers until HEAD is reviewed with zero threads awaiting the agent''s reply (remaining open threads are explicit hand-offs to the human — escalated declines, design tradeoffs). You merge a clean PR; the bot runs it. Trigger phrases: \"address copilot comments\", \"run a copilot review loop\", \"fix this PR\", \"iterate on copilot feedback\". Repo-agnostic, gh CLI + PowerShell. Full autopilot needs repo Triage/Write; external PR authors get single-iteration mode plus manual re-trigger (UI 🔄 or substantive-commit push).\n\n# Copilot PR Autopilot\n\nDrive any GitHub pull request through repeated rounds of Copilot code\nreview until the agent has done its job — every Copilot finding has\na reply from the agent (fix-acknowledgement, decline-with-rationale,\nor explicit escalate-to-user hand-off). Remaining open threads, if\nany, are deliberate hand-offs to the human merge owner — they're\nnot loop failures. Repository-agnostic — works on any repo that has\nCopilot Code Review enabled, run from a machine with `gh` CLI\ninstalled and authenticated (see Prerequisites).\n\n## When to Use This Skill\n\n- The user asks to \"request Copilot review\" or \"run a Copilot review loop\"\n  on a PR.\n- A PR is functionally complete and the user wants a final correctness pass\n  via repeated automated review rounds.\n- A previous Copilot review on the PR has left open threads that need\n  triage, fixing, replying, and resolving.\n\n## When NOT to Use This Skill\n\n- The PR is still under active design — wait until the structure is stable;\n  otherwise findings churn round-over-round.\n- The user wants human reviewer feedback, not Copilot's.\n\n## Prerequisites\n\n- `gh` CLI installed and authenticated against the target repository.\n- PowerShell on PATH — Windows PowerShell 5.1+ (`powershell.exe`) or\n  PowerShell 7+ (`pwsh`). Both are tested.\n- Copilot Code Review is the primary use case (`01-request-review.ps1`\n  uses GraphQL `requestReviewsByLogin` to trigger Copilot). It is\n  **NOT a hard requirement** — if `01-request-review.ps1` fails\n  because Copilot isn't enabled on the repo / account, the agent can\n  still drive existing review threads (human, advanced-security, etc.)\n  to completion by running steps 3–8 once as a single iteration; just\n  skip the trigger + wait. There is no auto-detect for \"Copilot\n  unavailable\" — the agent makes that decision after the trigger\n  fails (the script can't reliably tell \"Copilot disabled\" from\n  \"Copilot enabled but not yet triggered\" from API state alone).\n\n### Permissions: who can run the full loop\n\nThe full multi-round autopilot (steps 1 → 9 → 1) needs **Triage or Write** permission on the target repo, because GitHub's only public API for adding the Copilot bot as a reviewer (`requestReviewsByLogin`) is gated on that permission. Verified against the public REST + GraphQL surface in this PR's commit history — there is no public-API path for bot reviewers without write permission.\n\n| You are… | What works |\n|---|---|\n| **Repo collaborator with Triage / Write** | Full loop: `01` triggers Copilot, `02` waits, `04`–`08` triage / fix / reply, loop back to `01`. Hands-off. |\n| **External PR author (no write permission)** | `01` will throw a clear actionable error. Use `-SingleIteration` mode: address all current findings in one pass, then either click the UI 🔄 next to Copilot, **or** push a substantive commit (the `synchronize` event auto-triggers Copilot on most repos). Then re-run `02` to verify. |\n\nIn single-iteration mode the loop's convergence boolean is `Converged: true` iff `OpenThreadsAwaitingReply == 0` (the agent's side is done). The maintainer-side re-trigger then drives any additional rounds.\n\nEvery script dot-sources [scripts/_lib.ps1](scripts/_lib.ps1) which\nruns `Assert-GhReady` on load: if `gh` is missing OR `gh auth status`\nfails, the script halts **before any work** with a single actionable\nerror message naming the install command and `gh auth login`. The\nagent should surface that message to the user verbatim and stop the\nloop — do not retry or work around it.\n\n## Step-by-Step Workflow\n\n> **The loop:** steps 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 → 9, then **back to step 1** if `Converged: false`. Repeat the 1→9 round until step 9 returns `Converged: true`; only then run step 10 once and call `task_complete`. **At every 10th round, the parent runs the [round-cap recap gate](references/09-convergence.md#round-cap--recap-gate-circuit-breaker) before looping back** — recap all prior rounds and stop if the loop has drifted out of the PR's original scope.\n\nEach round runs steps 1–9; step 10 is a one-time cleanup after convergence. The parent agent coordinates; every sub-agent step runs in a fresh context with a bounded budget. Cross-cutting protocol (time-boxing, extension, single-iteration fallback): [orchestration.md](references/orchestration.md).\n\n1. **Request review** _(parent)_ — see [01-request-review.md](references/01-request-review.md)\n2. **Wait for review** _(sub-agent, 20-min cap)_ — see [02-wait.md](references/02-wait.md)\n3. **List + categorize open threads** _(sub-agent, 5 min)_ — see [03-list-threads.md](references/03-list-threads.md)\n4. **Triage** _(sub-agent, 5 min per ≤5 threads)_ — see [04-triage.md](references/04-triage.md)\n5. **Fix** _(sub-agents, parallel max 5, 5 min each)_ — see [05-fix.md](references/05-fix.md)\n6. **Build + test per repo conventions** _(sub-agent, 10 min)_ — see [06-build-test.md](references/06-build-test.md)\n7. **Commit + push** _(parent)_ — see [07-commit-push.md](references/07-commit-push.md)\n8. **Reply (always) + resolve (conditional)** _(sub-agent drafts, parent posts)_ — see [08-reply-resolve.md](references/08-reply-resolve.md)\n9. **Convergence verify** _(sub-agent, 3 min)_ — see [09-convergence.md](references/09-convergence.md)\n   - **`Converged: false` → loop back to step 1** for another round (re-trigger, wait, list, triage, fix, push, reply, re-check). Each round addresses Copilot's findings on the previous round's HEAD; the loop terminates as soon as Copilot has nothing new to say AND every open thread has a reply from the agent.\n   - **`Converged: true` → exit the loop**, run step 10 once, call `task_complete` with the proof.\n   - **Every 10th round (10, 20, 30…) → run the [round-cap recap gate](references/09-convergence.md#round-cap--recap-gate-circuit-breaker) before looping back.** Recap ALL prior rounds against the PR's original scope and pick a verdict: **CONTINUE**, **REVERT-AND-SHIP** (drop drifted commits, ship the in-scope ones), or **HAND-OFF** (escalate to the user). This is the circuit breaker that stops a runaway bot-review loop.\n10. **Cleanup outdated** _(parent, post-convergence, once)_ — see [10-cleanup.md](references/10-cleanup.md)\n\nConvergence is computed by [scripts/02-check-review-status.ps1](scripts/02-check-review-status.ps1) as a single `Converged: true` boolean. Do **not** call `task_complete` until it returns true; print the proof (`HeadOid`, `LatestCopilotReview.commitOid`, `submittedAt`) in the completion message.\n\n## Gotchas\n\nThe bundled scripts enforce the hard correctness invariants (trigger landing via `copilot_work_started` event id, `Converged` requiring HEAD-match + zero-awaiting + at-HEAD review, single-iteration fallback semantics, PR-state guard). Trust them — don't re-derive. The notes below cover decisions the scripts can't make for you:\n\n- **Reply to every open thread; resolve only when the loop owns the disposition.** For `fix` and `decline` threads, reply + resolve. For `escalate-to-user` threads, reply with the analysis but leave the thread OPEN (`08-reply-and-resolve.ps1 -NoResolve`) so the human merge owner can act on it. See [08-reply-resolve.md](references/08-reply-resolve.md).\n- **Copilot threads are loop-owned; human / advanced-security / other-bot threads default to `escalate-to-user`.** Auto-resolving a human review thread can hide unaddressed concerns. See [04-triage.md](references/04-triage.md) for the rubric.\n- **One focused commit per round, not one per PR.** Bundling rounds destroys the audit trail of which finding drove which change and breaks `git bisect`. See [07-commit-push.md](references/07-commit-push.md).\n- **Build/test/lint with the repo's own commands** (per its `CONTRIBUTING` / `AGENTS` / `README` / `package.json` / `Makefile`) before pushing a fix. Discovery procedure: [06-build-test.md](references/06-build-test.md).\n- **Push back with written rationale** when a Copilot finding would over-engineer the design for a hypothetical edge case. Auto-accepting every suggestion erodes the design — see the `decline` path in [04-triage.md](references/04-triage.md).\n- **Scripting traps** (`gh api graphql -F` type-coercion, `git stash push -m` positional parsing, the three GraphQL traps for the reviewer mutation) are documented in [references/api-quirks.md](references/api-quirks.md). Read before modifying any script.\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| Script throws `prerequisite missing — gh CLI is not on PATH` | Install `gh` (`winget install GitHub.cli` on Windows; `brew install gh` on macOS; package manager on Linux; or download from https://cli.github.com). Then `gh auth login`. Surface the message to the user and STOP the loop — do not retry. |\n| Script throws `prerequisite missing — gh CLI is not authenticated` | Run `gh auth login`. STOP the loop until the user completes auth. |\n| Trigger fails or no `copilot_work_started` event lands | Push a substantive (non-whitespace) commit — auto-assign on `synchronize` is the most reliable trigger. Persistent failure indicates Copilot Code Review may not be enabled on the repo / account (check repo Settings → Code & automation → Copilot, or account-level Copilot Pro/Pro+). |\n| No new review after waiting ~10 min | Quiet-period after recent dismissal or trivial-diff suppression. Push a substantive commit and retry. Do not blindly re-run `01-request-review.ps1` — it reports `InFlight` while Copilot is still a requested reviewer. |\n| Outdated-but-unresolved threads in the open list | Expected: unresolved state is the source of truth. Reply + resolve them like any other open thread. `10-cleanup-outdated.ps1` is only a final safety net. |\n| Unsure whether to fix or decline a finding | See [references/04-triage.md](references/04-triage.md). |\n| Need a reply phrasing for \"fixed\", \"declined\", or \"drift\" | See the templates under [templates/](templates/) — [reply-fix.md](templates/reply-fix.md), [reply-decline.md](templates/reply-decline.md), [reply-drift.md](templates/reply-drift.md), [reply-partial.md](templates/reply-partial.md). |\n\n## References\n\n- [references/orchestration.md](references/orchestration.md) —\n  cross-cutting loop control: time-boxing & extension protocol,\n  sub-agent delegation map, single-iteration fallback, and loop-wide\n  notes.\n- Per-step contracts (one `NN-*.md` per step):\n  [references/01-request-review.md](references/01-request-review.md) _(parent)_,\n  [references/02-wait.md](references/02-wait.md),\n  [references/03-list-threads.md](references/03-list-threads.md),\n  [references/04-triage.md](references/04-triage.md) (includes the\n  fix-vs-decline rubric),\n  [references/05-fix.md](references/05-fix.md),\n  [references/06-build-test.md](references/06-build-test.md),\n  [references/07-commit-push.md](references/07-commit-push.md) _(parent)_,\n  [references/08-reply-resolve.md](references/08-reply-resolve.md),\n  [references/09-convergence.md](references/09-convergence.md) (includes\n  the round-cap recap gate),\n  [references/10-cleanup.md](references/10-cleanup.md) _(parent)_.\n- [references/api-quirks.md](references/api-quirks.md) — verified\n  GitHub API behavior, dead-ends, and the GraphQL traps for the\n  reviewer mutation.\n- Templates (one per reply type):\n  [templates/reply-fix.md](templates/reply-fix.md) — accepted-fix\n  pattern; [templates/reply-decline.md](templates/reply-decline.md) —\n  declined-with-rationale pattern;\n  [templates/reply-drift.md](templates/reply-drift.md) —\n  PR-description / comment / test-plan drift acknowledgement;\n  [templates/reply-partial.md](templates/reply-partial.md) —\n  partial fix with deferred follow-up. Cross-cutting reply guidance\n  and anti-patterns live in\n  [references/08-reply-resolve.md](references/08-reply-resolve.md#reply-guidance).\n- [scripts/_lib.ps1](scripts/_lib.ps1) — shared helpers (`Invoke-Gh`,\n  `Invoke-GhGraphQL`, `Resolve-RepoCoords`); dot-sourced by every\n  script.\n- [scripts/01-request-review.ps1](scripts/01-request-review.ps1) —\n  trigger Copilot review and verify pickup via the\n  `copilot_work_started` event.\n- [scripts/02-check-review-status.ps1](scripts/02-check-review-status.ps1) —\n  single-shot snapshot of the PR's Copilot review state; emits\n  `Converged: true` only when all three conditions hold.\n- [scripts/03-list-open-threads.ps1](scripts/03-list-open-threads.ps1) —\n  every unresolved PR review thread from **all reviewers** (Copilot,\n  humans, github-advanced-security, etc.).\n- [scripts/08-reply-and-resolve.ps1](scripts/08-reply-and-resolve.ps1) —\n  post a reply and resolve in one call.\n- [scripts/10-cleanup-outdated.ps1](scripts/10-cleanup-outdated.ps1) —\n  safety net for outdated Copilot threads."}