* Add copilot-pr-autopilot skill Skill that drives any GitHub pull request through repeated rounds of Copilot Code Review until the agent has either resolved every thread or explicitly escalated it to the human. Triggered via GraphQL (no @copilot mention needed), triages every open thread with a fix / decline / escalate rubric, replies and resolves each thread citing the pushed SHA, then re-triggers until HEAD is reviewed with zero threads awaiting the agent's reply. Includes step scripts (01 request-review, 02 check-review-status, 03 list-open-threads, 08 reply-and-resolve, 10 cleanup-outdated), shared library (_lib.ps1) with gh-CLI wrappers (Invoke-Gh, Invoke-GhGraphQL, ConvertFrom-GhJson, Assert-GhReady), reply templates, and reference docs for each step. Repo-agnostic. Requires gh CLI on PATH and repo Triage/Write for full autopilot; external PR authors get single-iteration mode with manual re-trigger via the UI re-request button or a substantive push. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review: split per-step references + add recap-gate circuit breaker - Fix #1: give steps 1/7/10 their own reference files (01-request-review.md, 07-commit-push.md, 10-cleanup.md); trim the inline bodies out of orchestration.md so it stays cross-cutting only. - Fix #3: add a recurring round-cap & recap gate to 09-convergence.md — default STOP every 10th round, recap all prior rounds, detect drift (out-of-scope / over-engineering / wrong-direction / belongs-in-separate-PR) with CONTINUE / REVERT-AND-SHIP / HAND-OFF verdicts. Agent reasoning, no new script. - Surface the gate from SKILL.md and orchestration.md; regenerate docs/README.skills.md. Markdown-only change; scripts unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(copilot-pr-autopilot): surface recap gate in decision pseudo-code; clarify Copilot+human convergence and round definition - Inject the round-cap recap gate into the '## Decision: loop back or exit' pseudo-code else-branch so an agent following the code block (not just the prose) runs the STOP-every-10th-round check before looping. - Broaden the 'never terminal' paragraph: non-convergence is driven by a Copilot finding OR a human review comment (this skill handles both); the loop ends only when there are no new comments from either source AND every open thread (Copilot or human) has an agent reply/escalation. - Define a 'round' explicitly as one execution of step 1 (01-request-review), i.e. one Copilot-review trigger — the cap counts review rounds, not tool calls or fix edits. Markdown-only; no script changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * copilot-pr-autopilot: make recap-gate round count deterministic Add 09-review-round.ps1: counts Copilot Code Review submissions straight from the PR's API history (full GraphQL pagination), so the recap-gate trigger is a derived number, not a fallible agent mental tally. This removes the exact failure mode the skill exists to survive — a count drifting across a long run (the real 156-round case). The script reports Round + RecapDue (Round % RecapInterval == 0) only; it never stops the loop or picks the verdict. CONTINUE / REVERT-AND-SHIP / HAND-OFF stays agent reasoning. 09-convergence.md updated to reference the deterministic count while preserving 'no script stops the loop' and 'non-convergence = Copilot finding OR human comment'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Regenerate docs/README.skills.md for copilot-pr-autopilot (add 09-review-round.ps1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3.8 KiB
Step 8: Reply (always) + resolve (conditional)
Sub-agent type: general-purpose drafts the reply bodies; the
parent posts them (mutations stay parent-owned). Budget for the
drafting sub-agent: 5 min.
Runs AFTER step 7 (commit + push) so every reply can cite the pushed commit SHA.
Inputs
- The full triage table from step 4 —
{ thread_id, action, rationale }per open thread (includingescalate-to-user). - The pushed
HeadOidfrom step 7. - The per-thread fix
summaryandfiles_touchedfrom step 5 (forfixrows).
Return contract
One row per open thread:
{ thread_id, action, reply_body }
Where action ∈ fix | decline | escalate-to-user. The parent
consumes this to drive the resolve/no-resolve decision (see
Procedure).
Procedure
-
Drafting sub-agent produces a
reply_bodyper thread by selecting the appropriate template (see #templates) based on the triageaction. Cite the pushed SHA from step 7 infixreplies. Forescalate-to-user, explain the disposition and the open question for the human merge owner; do not promise a resolve. -
Parent posts each reply, choosing whether to resolve:
pwsh ./scripts/08-reply-and-resolve.ps1 -ThreadId <id> -Body <text>-
action ∈ { fix, decline }→ run as above (resolve happens). -
action == escalate-to-user→ add-NoResolveso the thread stays open for the human:pwsh ./scripts/08-reply-and-resolve.ps1 -ThreadId <id> -Body <text> -NoResolve
-
Gotchas
- Reply to every open thread; resolve only when the loop owns the
disposition (
fixordecline). Resolving without a reply leaves no record of why the issue was considered addressed. - Escalated threads stay open with our reply explaining the
disposition. They're explicit hand-offs to the human merge
owner, not loop failures — that's why convergence in step 9 can
succeed with
OpenThreadCount > 0. - Mutations are parent-owned. The sub-agent only drafts; it never posts. This keeps the audit trail of mutations on the parent and avoids double-post races between concurrent sub-agents.
- Cite the pushed SHA, not a local commit. Step 7's recorded
HeadOidis the only SHA reviewers can browse to. - Reply hygiene matters for the next round. Declines that don't cite reasoning get re-raised by the next Copilot review. See 04-triage.md.
Templates
Pick by triage action:
| Triage action | Template |
|---|---|
fix |
reply-fix.md |
decline |
reply-decline.md |
| PR-description / comment drift acknowledgement | reply-drift.md |
| Partial fix with deferred follow-up | reply-partial.md |
For escalate-to-user, there is no template — write a bespoke reply
explaining the disposition and the open question, then post with
-NoResolve so the thread stays open.
Reply guidance
The reply has to do real work — it documents the decision for future maintainers and shapes what the next Copilot review will surface.
Be concrete (cite file paths, commit SHAs, function names), direct (no hedging when you have a position), and brief (2–4 sentences is typical). Long replies usually mean the round should have been broken up.
Anti-patterns — DO NOT use
- ❌
"Thanks!"/"Good point."with no substance. - ❌
"Will fix later."Either fix it now or decline with rationale; deferred fixes that aren't tracked anywhere get lost. - ❌ Resolve-without-reply. The next reviewer cannot reconstruct why the thread was closed.
- ❌
"I disagree."with no reasoning. State the actual technical disagreement.