Skip to content

GitHub Agentic Autofix: from security alert to validated patch

GitHub's new Agentic Autofix flow does more than suggest code: it explores the repository, prepares a fix, reruns CodeQL, and opens a draft pull request for review.

Sourceverified
  1. [01]GitHub — Agentic autofix for code scanning alerts2026-07-20
  2. [02]GitHub Docs — About code scanning2026-07-20

GitHub opened Agentic Autofix in public preview for all code scanning alerts on July 10. Unlike the earlier suggestion-based flow, it does not stop after generating a patch. Copilot explores files around the finding, prepares a change, reruns the original analysis, and opens a draft pull request after confirming that the alert closes.

A validation loop, not just a suggestion

Security patches are context-sensitive. A one-line change may silence an alert while breaking behavior, creating a risk elsewhere, or missing the real data flow. Repository-wide exploration followed by another CodeQL run creates a stronger control loop than 'an AI suggested this snippet.'

GitHub says the flow typically takes two to four minutes. The resulting pull request summarizes the change, why it closes the alert, and the validation steps that ran. Further changes can be requested through pull request comments or the repository's Agents tab.

Where is it useful for a solo builder?

Security alerts often fall behind urgent product work in small projects. Turning repetitive, well-defined findings into draft patches can shorten time to first response. Grouping multiple alerts into one pull request can also turn scattered security debt into planned work.

But 'CodeQL passed' does not mean 'secure'

Rerunning analysis confirms that a specific alert closed. It does not prove that business logic stayed correct, access boundaries were preserved, or no new design risk appeared. Authentication, authorization, payments, secrets, and deletion paths still need human review and relevant tests.

Access and cost are constraints too. The preview requires GitHub Code Security or Advanced Security, a Copilot license, and Copilot cloud agent enabled. Runs consume AI Credits and GitHub Actions minutes, so this is not a free security layer for every small personal or open-source repository.

This does not solve the silent AI coding error problem I wrote about earlier, but it does keep the security finding, patch, and rerun evidence in one review record.

My operating rule would be simple: let the agent prepare the patch, rerun analysis, and attach evidence to the pull request; keep the merge decision human. Good security automation does not remove approval. It produces better evidence for approval.