Skip to content

github/awesome-copilot / skills/copilot-pr-autopilot

copilot-pr-autopilot

Verified

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).

scripts/08-reply-and-resolve.ps1

View on GitHub
<#
.SYNOPSIS
    Post a reply on a Copilot review thread and resolve it.

.DESCRIPTION
    Performs the two GraphQL mutations needed to address a Copilot finding:
    1. addPullRequestReviewThreadReply — appends a reply comment.
    2. resolveReviewThread             — marks the thread resolved.

    Use this for both accepted-and-fixed findings and for declined-with-
    rationale findings. See ../templates/reply-fix.md, reply-decline.md,
    reply-drift.md, and reply-partial.md for body patterns.

.PARAMETER ThreadId
    The GraphQL node ID of the review thread (e.g. PRRT_kw...).

.PARAMETER Body
    The reply body. Markdown is supported.

.PARAMETER NoResolve
    If set, posts the reply only and leaves the thread open. Useful when
    you want to start a back-and-forth discussion rather than close out the
    thread.

.EXAMPLE
    pwsh 08-reply-and-resolve.ps1 -ThreadId PRRT_kw... -Body "Fixed in abc1234."

.EXAMPLE
    # Decline with rationale, do not resolve yet
    pwsh 08-reply-and-resolve.ps1 -ThreadId PRRT_kw... -NoResolve `
        -Body "Declining: this would require cross-class plumbing for a hypothetical race."

.NOTES
    Reply + resolve are TWO separate GraphQL mutations and the script
    is NOT atomic: if the reply succeeds and the resolve then fails
    (transient 5xx, rate limit, thread disappeared mid-call), the reply
    is already posted. The script is also NOT idempotent on reply —
    re-running it with the same -ThreadId and -Body will post a
    duplicate reply because -Body is mandatory.

    Recommended retry policy when a call fails:
      - If "Replied to thread X" did NOT print, the reply step failed;
        safe to re-run the whole command.
      - If "Replied to thread X" DID print but "Resolved thread X" did
        not, ONLY the resolve step failed. Do NOT re-run this script
        (it would post a duplicate reply). Instead resolve directly:

          gh api graphql `
            -f query='mutation($t:ID!){resolveReviewThread(input:{threadId:$t}){thread{id}}}' `
            -f t=$ThreadId

        This raw call bypasses the Invoke-Gh helper but is safe here
        because the mutation contains no embedded double-quote
        characters, so the PowerShell-5.1 native-arg splitting bug
        documented in references/api-quirks.md does not apply.
#>
[CmdletBinding()]
param(
    [Parameter(Mandatory = $true)]
    [string]$ThreadId,

    [Parameter(Mandatory = $true)]
    [string]$Body,

    [switch]$NoResolve
)

$ErrorActionPreference = 'Stop'
. "$PSScriptRoot/_lib.ps1"

$replyMutation = @'
mutation($tid: ID!, $body: String!) {
  addPullRequestReviewThreadReply(input: {
    pullRequestReviewThreadId: $tid,
    body: $body
  }) {
    comment { id }
  }
}
'@

$replyArgs = @('-f', "query=$replyMutation", '-f', "tid=$ThreadId", '-f', "body=$Body")
Invoke-GhGraphQL -GhArgs $replyArgs -Context "reply to thread $ThreadId" | Out-Null
Write-Output "Replied to thread $ThreadId"

if (-not $NoResolve) {
    $resolveMutation = @'
mutation($tid: ID!) {
  resolveReviewThread(input: { threadId: $tid }) {
    thread { isResolved }
  }
}
'@
    $resolveArgs = @('-f', "query=$resolveMutation", '-f', "tid=$ThreadId")
    Invoke-GhGraphQL -GhArgs $resolveArgs -Context "resolve thread $ThreadId" | Out-Null
    Write-Output "Resolved thread $ThreadId"
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall