---
title: "Sandboxes for AI code review: build and test every pull request warm"
description: "Promigence gives AI code-review agents a sandbox forked from an already-built snapshot of the repo, so every suggestion can be built and tested before it is posted."
url: "https://www.promigence.ai/for/code-review"
site: "Promigence"
---

# AI code review that checks every pull request on a warm, built repo

Promigence gives an AI code-review agent a sandbox forked from a verified, already-built snapshot of the repository, so it can build, run the tests and check its suggestions on every pull request without paying for a fresh clone and install each time.

**Who this is for:** Companies building AI code-review products, and teams running review agents on their own repositories.

## What breaks today
### Every pull request pays for a fresh build
To check a suggestion, the reviewer needs the code built and the tests runnable. From a cold machine that is a clone, an install and a build on every pull request.

### Suggestions nobody ran
A review comment that was never compiled or tested is a guess, and developers learn to ignore guesses.

### Review traffic arrives in bursts
A busy morning lands dozens of pull requests at once, and a review that queues behind the others arrives after the author has moved on.

## What changes with Promigence
### Fork from the latest built snapshot
Snapshot the default branch with its build. Each pull request forks from it and brings only its own changes.

### Run the checks before you comment
Build and test the suggested change inside the sandbox, so a comment can say whether it passed.

### Many reviews at once
Fork one sandbox per pull request. A burst of reviews starts together instead of waiting in a queue.

## A warm, built repo for every pull request
```bash
# When the default branch moves
promigence snapshot create --image node:22 \
  --setup "git clone https://github.com/your-org/app /work/repo && git -C /work/repo checkout <40-char sha>" \
  --setup "cd /work/repo && corepack enable && pnpm install && pnpm build" \
  --verify "cd /work/repo && pnpm test" --alias app --wait --wait-timeout 10m

# Per pull request: fork, check out the change, test before commenting
promigence fork --snapshot app --count 1 --cap 1
promigence exec --sandbox "$SANDBOX" -- sh -c "cd /work/repo && git fetch origin $PR_REF && git checkout FETCH_HEAD"
promigence exec --sandbox "$SANDBOX" -- sh -c "cd /work/repo && pnpm test"
```

## What environment should an AI code review bot use to build and test pull requests?

Use a fresh, isolated sandbox for each pull request, started from a built snapshot of the default branch so the review only has to apply the change. It should hold none of your secrets, reach only the hosts the install needs, and run the pull request's tests with outbound access cut. Give it a timeout and a spend cap as well, so a hanging test ends on its own. On Promigence, every one of these is a flag or a single command.

## How it works

### Keep the default branch built

Build a snapshot of the default branch with its install and build as setup steps and its test suite as the verify command, as in the example above. When the branch moves, rebuild it; a connected GitHub repository can do that on every push. Pull requests then start from installed dependencies and bring only their own change.

### Give the pull request's code no way out

A pull request runs code its author wrote, and so do the install scripts of any dependency it adds. Fetch the change while an allow-list lets the sandbox reach only your git host and package hosts, then cut its outbound access with `promigence sandbox network` and `--cut` before the tests run. A review that needs nothing from the network can start with `--network none`, as below; put your own snapshot's alias in place of the base snapshot.

```bash
promigence fork --snapshot promigence/base --count 1 --cap 1 --timeout 30m --network none --json
```

### Test a suggestion before posting it

Before the bot proposes a fix, apply it in the review sandbox and run the build and the tests in that same tree. Several candidate fixes can each get a copy from a snapshot, and the bot keeps the one whose tests pass. The snapshot-and-fork guide has that program in TypeScript, Python and the CLI.

### Say what ran in the comment

When reviews go through `promigence run`, the report separates task failures from environment failures. So a broken environment never reads as the author's broken test. For any failure, `promigence run report` with `--repro` prints the command that reproduces it, which belongs in the comment.

## What you get, in numbers

| What | Result | Conditions |
|---|---|---|
| 100 runs started at once, slowest 5% | 0.94 s | p95 over 400 runs, every run completed [Source](https://www.promigence.ai/#numbers) |
| Edit, then type-check, on a warm repository | 0.66 s | 4 vCPU; median of 30 runs, 0.80 s under load [Source](https://www.promigence.ai/#numbers) |
| 20 copies of a warm workspace | 1.41 s | All 20 usable; median of 3 rounds [Source](https://www.promigence.ai/#numbers) |

## What it costs

A team opens 300 pull requests a month. Every review runs in a medium sandbox (4 vCPU, 16 GiB) for about 5 minutes, under a 20-minute timeout and a $0.25 cap. The 300 and the 5 minutes are example inputs.

Quote per review: 1,200 s × $0.000128 = $0.1536. Typical review: 300 s × $0.000128 = $0.0384. A month of them: 300 × $0.0384 = $11.52.

Total: about $11.52 a month for review sandboxes, with no single review above its $0.1536 quote.

If a review's quote is above its cap, it never starts. Rebuilding the default-branch snapshot is billed at its size's rate for the seconds it runs, never more than an hour's worth.

## Security and limits

- A review's sandbox is walled off from every other one, yours or anyone else's, and that boundary is tested by attacking it.
- Runs can start with no network at all.
- A review sandbox that fails keeps its state for up to 7 days by default: reopen it with `promigence run open`, or delete it sooner.

## Related

- [Snapshot after npm install, then fork 10 copies](https://www.promigence.ai/docs/guides/snapshot-and-fork)
- [Run LLM-generated code safely](https://www.promigence.ai/docs/guides/run-ai-written-code-safely)
- [Time to feedback: the delay that matters for coding agents](https://www.promigence.ai/blog/time-to-feedback-coding-agents)
- [Quickstart](https://www.promigence.ai/docs/quickstart)

## Questions

### Why should a review bot run the tests before it comments?

Developers act on comments backed by a passing build. Running the change in a built copy of the repository lets the bot name the tests it ran and quote their result, and drop any suggestion that breaks the build before a person reads it.

### Is it safe to run a stranger's pull request there?

Yes, with the settings on this page. The sandbox holds a secret only if you give it one, its outbound access can be limited and then cut, and no sandbox can reach another.

### Does every pull request need a new snapshot?

No. One snapshot of the default branch serves every pull request until the branch moves, and each review applies its own change inside its sandbox.

### How many reviews can run at the same time?

As many as your plan allows at once: 20 sandboxes on a new account, up to 100 on Pro, and up to 500 on Max, or 1,000 on its $500 level. Past that, a new review is refused before it starts, and the error code says which limit it hit.

### What does one review cost?

The seconds its sandbox runs, at the rate for its size: $0.000128 a second at medium. A 5-minute review there comes to under four cents, and the quote before it starts covers its full timeout.

### What if a test fails because the environment broke?

The run report labels it an environment failure, apart from the pull request's own failures. `promigence run replay` runs it again as a new sandbox under the run's cap, so the bot never tells the author their code broke.

### Which languages and build tools work?

Whatever installs from an image or a Dockerfile plus your setup steps. The examples here use Node.js with pnpm; a Python or Go project swaps in its own install and test commands.

