# How to review a pull request an AI agent opened

[Learn](/learn) › Trusting AI-written code

# How to review a pull request an AI agent opened

Review a pull request from an AI agent the way you would review one from a new colleague you have not worked with: check the evidence before the code. A good one tells you what broke, why, what it changed, and how you can check it. If any of those is missing, ask for it before reading the diff.

## What a good AI pull request contains

Part

What you should see

If it is missing

What happened

The problem in plain words: which request, which error, since when

You cannot tell whether the fix matches the problem

Why it broke

The cause, with the file and line

The change may treat a symptom

What it changes

A short description that matches the diff

Read the diff with extra care

How to check it

A test you can run, or steps to follow

Nothing proves the fix

Risk

What else this could affect

Assume nobody thought about it

Every pull request Bugstack opens has those five parts. Bugstack does [autonomous software maintenance](/autonomous-software-maintenance), so a pull request is the only way it ever hands work to you.

## A method that takes five minutes

1.  **Read the cause, then stop.** Does the stated cause explain the problem you know about? If the cause sounds wrong, the fix is wrong, however clean the code is.
2.  **Find the test.** Open it. It should fail without the change, and its failure should be the bug itself.
3.  **Check the file list.** Count the files and ask why each one is there. An agent that wandered will show it here first.
4.  **Look at the checks.** Your CI should have run on the pull request. Red checks are a no.
5.  **Read the diff.** By now you know what it should say. You are looking for anything it says beyond that.

## Ask the agent, the way you would ask a person

If something is unclear, ask on the pull request. You can request a change on a Bugstack pull request with a review, and it makes the change on the same branch at the autonomy level you set for the repository.

Good things to ask:

-   “Could the same crash happen for another status value?”
-   “Why this file and not the one in the stack trace?”
-   “What does this do when the list is empty?”

A vague answer is information too. Do not merge on one.

## When to send it back

-   The test passes with and without the change.
-   The change is larger than the problem.
-   It edits something sensitive, such as sign-in code, payment code or a migration, and nobody on your team has looked.
-   You cannot explain the fix to a colleague.

Bugstack holds changes to sign-in and security code for a person by default, whatever level the repository is on.

## How much to trust it over time

Start by merging everything yourself. Bugstack starts every repository on Review for that reason: it opens the pull request and you merge it. When you have seen enough of its fixes hold, you can move a repository to Autopilot, where a fix merges once your proof setting is met. You can move it back at any time.

## Questions

### Is reviewing AI code different from reviewing human code?

The reading is the same and the risks differ. A person’s mistakes tend to be shortcuts. A model’s mistakes tend to be plausible code that solves a slightly different problem. That is why the stated cause and the test deserve more of your attention than the style.

### What if there is no test in the pull request?

Then nothing has shown the fix works. Ask for one, or write the smallest test that would have caught the bug and run it against the branch.

### Can I let an AI agent merge its own pull requests?

You can, once two things are true: there is proof beyond the agent’s own word, and you have seen its record. On Bugstack, Autopilot merges only when the repository’s proof setting is met, and the default asks for a sandbox proof and green CI.

## Related

-   [How to verify AI-generated code before it merges](/learn/verify-ai-generated-code)
-   [Is AI-generated code reliable?](/learn/is-ai-generated-code-reliable)
-   [Can AI maintain software?](/learn/can-ai-maintain-software)
-   [What is autonomous software maintenance?](/autonomous-software-maintenance)

## See it work on your own code.

$100 a month

Includes $100 of usage credit every month. Start with a 14-day trial: $50 of credit and a first security audit on us. A card is required.

[Get started](https://dashboard.bugstack.ai/login) [Book 15 minutes with the founder](https://cal.com/mason-bachmann-1atgdq/15min)