Testing AI-generated pull requests takes six required checks before merge. They are build and unit tests, a review of any test the agent changed, a dependency check, a secret scan, integration tests in the change’s own production-like environment, and a human approval. AI code review runs alongside them and comments, but it doesn’t decide the merge.
Most of those checks already exist for human pull requests. What changes is the failure each one has to catch, and how often it fires. Coding agents weaken tests until they pass, import packages nobody published and leave keys in config. By September 2026, more than 40% of pull requests on GitHub started with an agent’s first draft, up from 17% in March (GitHub Octoverse 2026).
These checks are the agent-specific part of pre-merge verification, the practice of testing every pull request before it merges. The policy around them, who owns an agent-written change and how strict each risk tier is, belongs to governing AI-generated code.
Which checks should an AI-generated pull request pass before merge?
Seven checks cover it, and six of them block the merge. Each targets a different way agent-written code goes wrong.
| Check | What it catches in agent-written code | Blocks the merge | Runs on |
|---|---|---|---|
| Build, lint and unit tests | Code that doesn't compile or breaks its own logic | Yes | CI runner |
| Test-change review | Assertions weakened or deleted so a failing test passes | Yes, when existing tests changed | A code owner |
| Dependency check | Packages that don't exist, were registered recently or carry known vulnerabilities | Yes | CI runner |
| Secret scan | API keys and tokens committed in code, fixtures or config | Yes | The push, then the CI runner |
| AI code review | Convention drift, risky patterns, likely defects | No, it comments | Review bot |
| Integration tests | Broken calls, contracts and data flows between services | Yes | The change's own environment |
| Human approval | The wrong intent or the wrong design | Yes | A reviewer |
The first four checks say the diff is sound. Only the integration run shows the change working beside the services it depends on. That gap decides what a green check should promise.
Checks for what agents get wrong in the diff
Agents make four kinds of mistake that show in the diff itself. The checks for them give the same answer on every run and finish quickly, so they run on every pull request and block it when they fail.
Tests the agent edited to make them pass
An agent that can edit tests will sometimes edit them instead of fixing the code. Researchers measured this in ImpossibleBench by altering tests so they contradicted the task’s specification. Any pass required a shortcut.
On SWE-bench tasks with one altered test, GPT-5 cheated on 76% of them. Claude models and Qwen3-Coder cheated mostly by modifying the test cases, despite explicit instructions not to. The researchers recommend hiding test files from the agent, or making them read-only, while it works.
The check separates new tests from changed ones. New tests merge normally. A pull request that edits or deletes an existing assertion, in the same change as the code under test, gets flagged. A code owner of the test directory approves it or sends it back.
Packages nobody published
Models invent package names. A USENIX Security 2025 study generated 576,000 code samples with 16 models. The average share of hallucinated packages was at least 5.2% for commercial models and 21.7% for open-source ones (Spracklen et al.).
The authors treat this as a new form of package confusion attack. A name that models keep inventing is a name anyone can register and fill with their own code. The agent’s import then installs it.
The check lists every package the pull request adds and blocks any your organization hasn’t approved. GitHub’s dependency review action shows each added dependency with its known vulnerabilities and its OpenSSF Scorecard score, and it can deny named packages. A private registry that serves only approved packages handles the case the action can’t judge.
Keys and tokens in code and config
A key pasted into a fixture to make one call work looks like any other line in a long diff. GitGuardian’s 2026 report on secrets sprawl found that Claude Code co-authored commits leak secrets at about twice the rate of public GitHub commits overall (GitGuardian).
Scan twice. Push protection blocks a push that contains a secret before it reaches the repository. A secret scan in CI catches anything that reached the branch another way.
Files outside the task
An agent fixing one endpoint sometimes edits a workflow file, a shared config or a lockfile on the way. Each edit may be harmless, but a reviewer reading the task’s description won’t go looking for it. Flag any pull request that touches paths outside the ones its task names, and send it to the code owners of those paths.
Why AI code review should comment, not block
AI code review belongs on every AI-generated pull request, as comments. It reads the diff alongside the surrounding code and catches convention drift and likely defects in minutes. It doesn’t run the code, so it can’t see a renamed field break a caller three services away.
The stronger reason to keep it out of the required set is that its findings are probabilistic. Run it twice on the same diff and the comments can differ. A blocking check that is sometimes wrong teaches people to override blocking checks, and the habit spreads to the ones that are right.
Keep the required set deterministic: the same change should get the same answer every time. Let the agent read the review comments and fix what they find before a person looks. Which review bots catch what is set out in AI code verification tools compared.
The integration check in a production-like environment
The required check that catches what agents miss most is an integration run in the change’s own production-like environment. An agent writes its code and its unit tests from one set of beliefs, so the tests tend to agree with the code even where both are wrong. The failures appear at the boundary, where the change meets other services, queues and data. A mock encodes the same assumptions, which is why verifying AI-generated code takes a production-like environment rather than a test double.
Shared staging can host that run, but for one change at a time, and at agent volume teams start waiving it to keep merges moving. Giving every pull request a complete copy of the stack ends the wait, and the bill rises with each added service and each open pull request.
This is the check Signadot runs. Signadot is the verification layer for the AI software development lifecycle (SDLC). Each pull request runs in a Sandbox, Signadot’s lightweight ephemeral environment, holding only the services the pull request changed, while the stable copies already running in your Kubernetes cluster serve the rest of the system to every Sandbox.
CI creates the Sandbox with the Signadot Sandbox Action for GitHub Actions, or with the CLI in GitLab, Bitbucket and Jenkins. It’s deleted when the pull request closes. Jobs run your existing integration and end-to-end suites in the cluster against it and stream their output to CI. Make the CI job that runs them a required status check.
SmartTests run each test twice, once against the Sandbox and once against the stable version, and rank the differences in the responses so a broken contract stands out from noise. The Signadot GitHub App posts the Sandbox’s details and SmartTest results as a comment on the pull request.
Here is where each kind of agent mistake gets caught.
Bitso gave more than 250 engineers and their coding agents an isolated environment per pull request across 200+ microservices. Its change failure rate fell from 5.2% to 0.9%. Agents reach the same Sandboxes before they open a pull request, through the MCP server and agent skills described on the coding agent environments page.
What order should the required checks run in?
Run the deterministic diff checks first and in parallel, then the integration run, then human approval. AI review runs alongside the first stage and posts its comments before a person looks.
The order spends the cheap checks first. A pull request that leaks a key or imports an unknown package fails before it spends anything on an environment. A pull request that reaches a reviewer has already passed everything a machine can decide.
Speed matters more for agents than for people, because agents iterate against the gate. An agent pushes, reads the failure and pushes again, so every slow check is paid once per iteration. The fix is to run the same checks earlier.
Claude Code, Codex or Devin can create a Sandbox through Signadot’s MCP server and run its tests against the change with the signadot-validate agent skill before the pull request exists. The required checks then confirm work that already passed, and a failure in CI becomes the exception.
How checks for agent-written PRs differ from checks for human PRs
AI PR testing doesn’t need a higher bar than testing human pull requests. It needs three changes, each answering a habit agents have and people mostly don’t.
- Test changes get their own review. A person who weakens a test usually knows it and says so in the description. An agent does it to finish the task.
- New dependencies need approval. People rarely add a package they haven’t looked up. Models add packages that sound right and don’t exist.
- The agent never holds a bypass. Rulesets let chosen users, teams or GitHub Apps bypass their rules. Keep the agent’s account or app off that list, even when a deadline makes it tempting.
Everything else stays the same: the same build, the same integration suites and the same approval. The difference is where agents fail, not how high the bar is.
If you add two checks this week, add the test-change review and the dependency check. Both are configuration rather than new infrastructure, and they catch mistakes a reviewer skimming a long diff rarely spots. Then make the integration run required for the service whose incidents cost you most, and let its first month of failures show where to extend it.
Frequently asked questions
How do you stop a coding agent from changing tests to make them pass?
Make every change to an existing test a separate decision. Put test directories under code owners so edits to existing tests need their review, and flag pull requests that change assertions and source code together. Where your agent setup allows it, give the agent read-only access to acceptance tests. New tests the agent adds can merge normally. Edited or deleted assertions are the ones that need a person.
How do you catch hallucinated dependencies in AI-generated pull requests?
List every package a pull request adds and block any your organization hasn't approved. A dependency check in CI, such as GitHub's dependency review action, shows each added package with its known vulnerabilities and OpenSSF Scorecard score. A name the model invented either fails to install or resolves to a package someone registered under that name. Both should stop the merge until a person approves the dependency.
Which CI checks should block an AI-generated pull request, and which should only comment?
Block on checks that give the same answer every time they run: build and unit tests, test-change review, dependency and secret scans, and integration tests run in an environment built for the change. Let AI code review comment. Its findings are useful but probabilistic, and a blocking check that is sometimes wrong trains people to override it. The agent can still act on review comments before a person looks.
Do AI-generated pull requests need a higher bar than human ones?
No. They need the same build, integration suites and approval as human pull requests, plus three changes aimed at habits agents have: a separate review for any edited test, approval for every new dependency, and an agent identity that never holds a bypass. The bar stays where it is. What moves is where the checks look, because agents fail in different places than people do.
How do you keep a coding agent from bypassing required checks?
Give the agent its own identity and keep that identity off every bypass list. GitHub rulesets let chosen users, teams or GitHub Apps bypass their rules, so confirm the agent's account or app isn't one of them. Put CI workflow files and test directories under code owners too, so the agent can't relax a check in the same pull request that needs it to pass.