Automate the setting, not the security decision
On November 13, GitHub announced a public preview that lets organizations manage AI Scan for repositories through its REST API. Security teams can now integrate the setting into scripts and infrastructure as code rather than visiting each repository manually. For teams already delegating implementation to coding agents, this is a useful development: AI-assisted code production needs equally deliberate verification. But making a scanner easier to enable does not make its conclusions authoritative, and it does not transfer responsibility for shipping software to an agent.
The practical thesis is simple: humans should define coverage, approve exceptions, interpret findings, and authorize releases. Automation can apply approved settings, collect evidence, and prepare proposed fixes. Those activities belong in a controlled workflow, not in an unrestricted loop where the same agent writes code, changes its security checks, and declares its own work safe. GitHub's announcement describes configuration capabilities; the operating model below is our recommended way to use them, not an additional product guarantee.
What the announcement actually changes
The new repository_scan property accepts enabled or disabled on the existing AI Scan configuration endpoints. GitHub documents organization-level and repository-level routes: /orgs/{org}/code-scanning/ai-scan and /repos/{owner}/{repo}/code-scanning/ai-scan. Teams can read settings with GET and update them with PATCH. This creates a practical foundation for a version-controlled inventory of which repositories should have the capability available.
The inheritance rules matter. When an organization disables repository scanning, its repositories cannot enable it. When the organization enables it, repositories inherit the setting but can opt out individually. An enterprise policy that disallows AI Scan blocks enablement with a 422 response. A successful rollout therefore depends on organizational policy and repository exceptions, not merely on whether a script completed its loop without crashing.
GitHub also allows pr_scan and repository_scan to be updated in the same request. If either change is blocked, the request returns 422 and neither setting changes. Most importantly, enabling repository scanning does not start a scan. Users with write access still run scans on demand, and each scan consumes GitHub Code Security AI credits. Configuration, execution, and interpretation are separate events.
Availability is not evidence of verification
That separation is easy to lose in a dashboard. A repository marked enabled can look protected even when nobody has scanned its current backlog. A successful configuration request is evidence about a setting, not about the code. Likewise, an old scan says little about commits introduced after it ran. A team should be able to answer which revision was examined, when it was examined, and who reviewed the resulting findings.
For AI-assisted development, this distinction is especially important. An agent may produce a plausible implementation and then report that security scanning is enabled. Neither statement proves that the actual change has been assessed. The reviewer needs concrete artifacts: the relevant diff, test results, the scan's scope, and any unresolved findings. Missing evidence should remain visible as missing evidence rather than being rewritten into reassuring language.
Keep separate records for desired policy, observed configuration, scans actually executed, and decisions taken on findings. These records need not become a large compliance platform. A small reviewed policy file, an execution log, and a linked security issue can be sufficient for a pilot. What matters is that a setting cannot masquerade as a completed check or a human approval.
Give the rollout script a narrow contract
Start with an inventory approved by a security owner. Identify repositories, their maintainers, the intended organization policy, and any permitted repository exceptions. Do not let a coding agent infer the approved scope from repository names or recent activity. A prototype repository can hold sensitive material, while an apparently critical repository may be maintained elsewhere. Ownership and classification need a human decision grounded in the organization's actual context.
Before changing anything, generate a read-only plan comparing desired settings with observed settings. Present unexpected repositories, missing permissions, and enterprise-policy conflicts as explicit review items. The initial objective is not to maximize the number of enabled repositories. It is to make the proposed change understandable enough that an accountable person can approve it without reconstructing every API call.
- Use a credential authorized for the required configuration task, not a developer's broadly privileged session.
- Limit the first rollout to a reviewed repository list.
- Log the target, previous state, requested state, response status, and read-back result.
- Stop and report policy conflicts rather than searching for a way around them.
- Require a separate approval before expanding the scope.
These are workflow recommendations, not claims that the new endpoint enforces every boundary automatically. A coding agent can help build the plan and tests for the script. It should not receive authority to rewrite the approved inventory or change enterprise policy merely because an enablement request fails.
Read back the state and treat failures honestly
After an approved PATCH, fetch the exact target again and compare the observed state with the intended state. Archive that comparison. Do not treat a successful HTTP response as a substitute for checking the result, and do not assume every repository inherited the intended setting. Repository opt-outs and organization-level restrictions are part of the documented behavior, so the verification needs to reflect them.
Handle a 422 response as a policy or validation outcome to investigate, not as an invitation to grant the automation more power. In particular, a combined update of pull-request scanning and repository scanning may leave both unchanged if either change is blocked. The operator should see that outcome clearly. A partial-looking success message would be misleading even if the script itself ran successfully.
Network failures introduce another ambiguity: the client may not know whether the server applied a request. Read the current state before deciding whether another write is necessary. Use bounded retries for transient problems and retain the actual error. An agent's confident explanation is not operational evidence. A verified read-back is far more useful than a polished narrative about what probably happened.
Keep scanner administration away from code-writing authority
The most important boundary is organizational rather than syntactic. The agent preparing a code change should not also be able to disable the scan that might challenge that change. Separate code-writing credentials from security-configuration credentials. Put the policy inventory under review by maintainers and security owners. A proposal to change coverage should remain visible as a policy change, not disappear inside an unrelated implementation pull request.
Consider an illustrative case: an agent is asked to repair an authorization bug. It changes a shared access helper and encounters a finding it considers unrelated. If it can also alter scanning settings, it might propose removing friction instead of proving that the authorization boundary is correct. The safer workflow keeps the finding visible, asks for reproduction evidence, and routes any exception to a human owner.
Human control does not mean manually typing every request. It means deciding which actions automation may perform and retaining authority over changes to those boundaries. A reviewed configuration pipeline can be highly automated while still requiring explicit approval for disabling coverage, adding exceptions, or expanding access. The goal is a fast execution path inside a policy that the executor cannot quietly redefine.
Run scans deliberately, then review the findings
Because enablement does not trigger a scan, assign a named owner for the next step. Decide which repository revisions deserve an initial assessment and how on-demand scanning fits existing security work. GitHub states that these scans consume AI credits; teams should therefore agree on a budget and prioritization process before treating broad enablement as permission for unlimited execution. The announcement does not establish an automatic scanning schedule.
Prioritization should reflect exposure and change, not just repository size. A small internet-facing service with a newly modified authorization path may deserve attention before a large internal utility with no recent relevant changes. A coding agent can summarize recent diffs and assemble candidate areas for review. A maintainer should confirm that the proposed priority matches real deployment architecture and business consequences.
Once findings arrive, treat them as leads requiring engineering judgment. Check reachability, affected versions, trust boundaries, and realistic misuse conditions. Preserve enough detail for another engineer to reproduce the concern. Do not dismiss a finding merely because an agent calls it a false positive, and do not accept a patch merely because it makes the finding disappear. The security question is whether the underlying behavior is correct.
Use agents to prepare fixes, not approve them
A productive delegation contract asks the agent to explain the suspected failure, construct a focused regression test, propose a minimal patch, and identify uncertainty. Keep those outputs in a reviewable change. If the issue concerns authorization, test both permitted and forbidden requests. If it concerns parsing, include malformed inputs and boundary conditions. The test should express the intended security property, not simply reproduce the shape of the implementation.
The reviewer should inspect any change to tests, scanner configuration, dependencies, or shared policy files alongside the application diff. An agent can accidentally weaken a check while trying to obtain a green result. Passing checks are useful evidence only when the checks still represent the intended behavior. Require an explanation for removed assertions and altered fixtures rather than allowing them to pass as routine cleanup.
Keep release authorization separate from finding resolution. A proposed fix may be technically sound yet require staged deployment, monitoring, or coordination with another service. Human maintainers understand these obligations in a way a repository-local agent may not. Preserve a clear decision trail: who reviewed the evidence, which risks remain, and who accepted the deployment plan. A scanner result cannot supply that organizational judgment.
Measure decisions, not the size of the enabled estate
Useful pilot measures include the difference between desired and observed configuration, the number of approved exceptions with owners, the age of unreviewed findings, and the proportion of proposed fixes backed by meaningful regression tests. Track scan execution separately from enablement. These measures expose operational gaps without pretending that a large count of enabled repositories demonstrates lower risk.
Review a small sample of closed findings as well. Ask whether the closure rationale was reproducible, whether the patch addressed the underlying condition, and whether any exception has an expiry or review date. This is not a demand for bureaucracy around every low-risk change. It is a way to detect a workflow that rewards quick closure while leaving the actual security question unanswered.
A practical next step for software teams
For a first rollout, choose a limited set of repositories with engaged maintainers. Confirm enterprise policy and product eligibility before writing the automation. GitHub says organization owners and security managers manage organization settings, while repository administrators can opt individual repositories out. The feature supports organization-owned public repositories and eligible private or internal repositories with GitHub Code Security or GitHub Advanced Security; GitHub Enterprise Server is not supported.
Then review the desired settings, apply the approved plan, read back every target, assign responsibility for on-demand scans, and route findings through normal engineering review. Document the distinction between an enabled capability and a verified change in the team's definition of done. This small clarification can prevent an apparently successful automation project from creating a false sense of security.
The lesson is not to slow down AI-assisted development, but to stop confusing execution with authority. Agents can help scale configuration, gather evidence, and prepare repairs. Humans must remain in command of coverage, exceptions, security interpretation, and release decisions. The new API makes a controlled workflow easier to operate; it does not remove the need to decide what that workflow is allowed to do.
Source and illustration
Primary source: GitHub Changelog, November 13, 2026: manage AI Scan through the REST API. The proposed governance practices and illustrative scenario above are editorial recommendations, not reported customer results.
Selected illustration: Wikimedia Hackathon 2013, a historical software collaboration photograph, not a screenshot of AI Scan. Photo: Sebastiaan ter Burg / Wikimedia Commons, CC BY-SA 2.0. Original photograph and attribution.