# The pull request lifecycle

> How BareCI's modules fit together from the first push to the merge, and how the Gate turns them into one verdict.

Source: https://bareci.com/docs/concepts/lifecycle

BareCI follows a pull request from its first push to its merge. Each step is a module, and a repository can use any subset.

```
push ──► Runners: CI on our machines (hot pool, NVMe, baked images)
     ──► Tests: sharded by history, flaky tests flagged, results kept
     ──► Preview: the change running at its own URL
     ──► Flows: AI end-to-end tests against the preview, replayed without a model in CI
     ──► Reviews: every reviewer's findings merged; agents fix or rebut each one
     ──► Gate: one check, "BareCI: ready", with every reason it is not yet
     ──► merge queue ──► Deploys on our machines
```

## Before the push

Agents test before they push. `bareci run` (or the `run_create` tool) runs any command from the worktree on a fresh machine from the repository's image, so an agent learns in a minute what it would otherwise learn from CI. See [Runs](https://bareci.com/docs/modules/runs).

## After the push

- [Runners](https://bareci.com/docs/modules/runners) run the repository's GitHub Actions jobs on fresh machines.
- [Tests](https://bareci.com/docs/modules/tests) keeps the JUnit results, flags flaky tests and balances shards.
- [Previews](https://bareci.com/docs/modules/previews) keeps a job's machine serving the change at its own address.
- [Flows](https://bareci.com/docs/modules/flows) replay the repository's end-to-end flows against that preview.
- [Reviews](https://bareci.com/docs/modules/reviews) collects every reviewer's findings into one list for the agent to work through.

## The verdict

The [Gate](https://bareci.com/docs/modules/gate) posts one GitHub check, `BareCI: ready`, on each pull request head. It is green only when every enabled module agrees, and while it is not, it lists every reason with the command or MCP call that fixes it. Agents read the same verdict with `bareci ready` or the `ready` tool.

## After the merge

[Deploys](https://bareci.com/docs/modules/deploys) run deploy jobs on isolated, on-demand machines, from the default branch or branches you list.

## One API, three clients

Everything above is a route of the `/v1` JSON API. The MCP server and the CLI call the same routes, and the dashboard reads them for people. Every answer is structured and names the next action.
